Reply to thread

Hi,


Thanks for reply.


I did tried that, but what happens is that, it will work properly for first 2 times after that the dialog won't work or after the dialog is shown it will freez the mediaportal all toghter :(.


Here is the code of my dialog

____________________________________________________________________________

using MediaPortal.Dialogs;

using MediaPortal.GUI.Library;


namespace Plugin1

{

    /// <summary>

    ///

    /// </summary>

    public class MyDlg : GUIDialogWindow

    {

        public enum ResultCode

        {

            Close,

            Next,

            Previous

        } ;


        [SkinControl(2)]

        protected GUILabelControl lblHeading = null;

        [SkinControl(4)]

        protected GUILabelControl lblName = null;

        [SkinControl(10)]

        protected GUIButtonControl btnPlus = null;

        [SkinControl(11)]

        protected GUIButtonControl btnMin = null;

        [SkinControl(12)]

        protected GUIButtonControl btnOk = null;

        [SkinControl(13)]

        protected GUIButtonControl btnNextItem = null;

        [SkinControl(14)]

        protected GUIButtonControl btnPlay = null;

        [SkinControl(15)]

        protected GUIButtonControl btnPreviousItem = null;

        [SkinControl(100)]

        protected GUIImage imgStar1 = null;

        [SkinControl(101)]

        protected GUIImage imgStar2 = null;

        [SkinControl(102)]

        protected GUIImage imgStar3 = null;

        [SkinControl(103)]

        protected GUIImage imgStar4 = null;

        [SkinControl(104)]

        protected GUIImage imgStar5 = null;


        private int rating = 1;

        private string fileName;

        private ResultCode resultCode;


        public MyDlg()

        {

            GetID = 6789;

        }


        public override bool Init()

        {

            return Load(GUIGraphicsContext.Skin + @"\dialogRating.xml");

        }


        protected override void OnClicked(int controlId, GUIControl control, Action.ActionType actionType)

        {

            base.OnClicked(controlId, control, actionType);

            if (control == btnOk)

            {

                PageDestroy();

                resultCode = ResultCode.Close;

                return;

            }

            if (control == btnNextItem)

            {

                PageDestroy();

                resultCode = ResultCode.Next;

                return;

            }

            if (control == btnPreviousItem)

            {

                PageDestroy();

                resultCode = ResultCode.Previous;

                return;

            }

            if (control == btnMin)

            {

                if (rating >= 1)

                {

                    rating--;

                }

                UpdateRating();

                return;

            }

            if (control == btnPlus)

            {

                if (rating < 5)

                {

                    rating++;

                }

                UpdateRating();

                return;

            }

        }


        public override bool OnMessage(GUIMessage message)

        {

            switch (message.Message)

            {

                case GUIMessage.MessageType.GUI_MSG_WINDOW_INIT:

                    {

                        resultCode = ResultCode.Close;

                        base.OnMessage(message);

                        UpdateRating();

                    }

                    return true;

            }


            return base.OnMessage(message);

        }


        public void SetHeading(string strLine)

        {

            //LoadSkin();

            AllocResources();

            InitControls();


            lblHeading.Label = strLine;

        }


        public void SetHeading(int iString)

        {

            if (iString == 0)

            {

                SetHeading(string.Empty);

            }

            else

            {

                SetHeading(GUILocalizeStrings.Get(iString));

            }

        }


        public void SetTitle(string title)

        {

            //LoadSkin();

            AllocResources();

            InitControls();

            lblName.Label = title;

        }


    }

}


Here is the code from where i am calling this dialog

__________________________________________________________________________


            MyDlg obj = (MyDlg)GUIWindowManager.GetWindow(6789);

            if (obj == null) return;

            obj.Reset();

            obj.SetHeading("Test");

            obj.DoModal(GetID);



Do you have any sample from where i get some help



Thanks,

Mrinal Jaiswal


Top Bottom