示例#1
0
        public ReturnCode YesNoOkDialogSync(ChooseFromYesNoDescriptor descriptor)
        {
            try
            {
                switch (descriptor.m_dialogButtons)
                {
                    case DialogButtons.OK:
                        GUIDialogOK dlgOK = (GUIDialogOK)GUIWindowManager.GetWindow((int)GUIWindow.Window.WINDOW_DIALOG_OK);

                        if (dlgOK == null)
                            return ReturnCode.Cancel;
                        //dlgOK.Reset(); //breaking for users of older MP versions?
                        dlgOK.SetHeading(descriptor.m_sTitle);
                        dlgOK.SetLine(1, descriptor.m_sLabel);
                        dlgOK.DoModal(GUIWindowManager.ActiveWindow);

                        return ReturnCode.OK;

                    case DialogButtons.YesNo:
                    case DialogButtons.YesNoCancel:
                        GUIDialogYesNo dlgYesNo = (GUIDialogYesNo)GUIWindowManager.GetWindow((int)GUIWindow.Window.WINDOW_DIALOG_YES_NO);

                        if (dlgYesNo == null)
                            return ReturnCode.No;
                        dlgYesNo.Reset(); //breaking for users of older MP versions?
                        dlgYesNo.SetHeading(descriptor.m_sTitle);
                        dlgYesNo.SetLine(1, descriptor.m_sLabel);
                        if (descriptor.m_dialogDefaultButton == ReturnCode.Yes)
                            dlgYesNo.SetDefaultToYes(true);
                        else
                            dlgYesNo.SetDefaultToYes(false);
                        dlgYesNo.DoModal(GUIWindowManager.ActiveWindow);

                        if (dlgYesNo.IsConfirmed)
                            return ReturnCode.Yes;
                        else
                            return ReturnCode.No;
                }
                return ReturnCode.No;
            }
            catch (Exception ex)
            {
                MPTVSeriesLog.Write("The YesNoOkDialog Method has generated an error: " + ex.Message);
                return ReturnCode.Cancel;
            }
            finally
            {
                this.m_Facade.Focus = true;
            }
        }
示例#2
0
        public ReturnCode YesNoOkDialog(ChooseFromYesNoDescriptor descriptor)
        {
            ReturnCode returnCode = ReturnCode.OK;
            if (this.m_Facade == null)
            {
                return ReturnCode.NotReady;
            }

            if (m_localControlForInvoke.InvokeRequired)
            {
                returnCode = (ReturnCode)m_localControlForInvoke.Invoke(new YesNoOkDialogDelegate(YesNoOkDialogSync), new Object[] { descriptor });
            }
            else
            {
                returnCode = YesNoOkDialogSync(descriptor);
            }
            return returnCode;
        }