Beispiel #1
0
        public void ShowMessage(string message, string title, MessageBoxButtons buttons, MessageBoxIcon icon)
        {
            QMessageBox.StandardButton nativeButtons;
            QMessageBox.Icon           nativeIcon;
            switch (buttons)
            {
            case Moai.Platform.UI.MessageBoxButtons.OK:
                nativeButtons = QMessageBox.StandardButton.Ok;
                break;

            case Moai.Platform.UI.MessageBoxButtons.OKCancel:
                nativeButtons = QMessageBox.StandardButton.Ok | QMessageBox.StandardButton.Cancel;
                break;

            case Moai.Platform.UI.MessageBoxButtons.YesNo:
                nativeButtons = QMessageBox.StandardButton.Yes | QMessageBox.StandardButton.No;
                break;

            default:
                throw new NotSupportedException();
            }
            switch (icon)
            {
            case Moai.Platform.UI.MessageBoxIcon.None:
                nativeIcon = QMessageBox.Icon.NoIcon;
                break;

            case Moai.Platform.UI.MessageBoxIcon.Information:
                nativeIcon = QMessageBox.Icon.Information;
                break;

            case Moai.Platform.UI.MessageBoxIcon.Warning:
                nativeIcon = QMessageBox.Icon.Warning;
                break;

            case Moai.Platform.UI.MessageBoxIcon.Error:
                nativeIcon = QMessageBox.Icon.Critical;
                break;

            default:
                throw new NotSupportedException();
            }

            QMessageBox dialog = new QMessageBox(nativeIcon, title, message, (uint)nativeButtons, (Central.Manager.IDE as LinuxIDE));

            dialog.Show();
            //MessageDialog dialog = new MessageDialog((Central.Manager.IDE as LinuxIDE), DialogFlags.Modal, nativeIcon, nativeButtons, message);
            //dialog.Show();
        }
Beispiel #2
0
        void ShowDemo(string name)
        {
            if (demoWidgetContainer.Layout.Count <= 1)
            {
                demoWidgetContainer.Layout.RemoveWidget(demoWidget);
                var demoTypeInfo = demoDictionary[name];
                demoWidget.Dispose();

                demoWidget = (BaseDemoWidget)Activator.CreateInstance(demoTypeInfo);
                demoWidgetContainer.Layout.AddWidget(demoWidget);
                demoWidgetContainer.Repaint();
            }
            else
            {
                var info = new QMessageBox(icon: QMessageBox.Icon.Critical, title: "Error", text: "Invalid number of demo widgets");
                info.Show();
            }
        }