示例#1
0
        /// <summary>
        /// Initializes the application
        /// </summary>
        public void InitializeApplication()
        {
            int y = 10;
            // Initialize the HUD
            Button fullScreen   = hud.AddButton(ToggleFullscreen, "Toggle full screen", 35, y, 125, 22);
            Button toggleRef    = hud.AddButton(ToggleReference, "Toggle reference (F3)", 35, y += 24, 125, 22);
            Button changeDevice = hud.AddButton(ChangeDevice, "Change Device (F2)", 35, y += 24, 125, 22);

            // Hook the button events for when these items are clicked
            fullScreen.Click   += new EventHandler(OnFullscreenClicked);
            toggleRef.Click    += new EventHandler(OnRefClicked);
            changeDevice.Click += new EventHandler(OnChangeDevicClicked);

            // Now add the sample specific UI
            y = 10;
            Checkbox fillModeBox = sampleUi.AddCheckBox(FillModeButton, "WireFrame (F8)", 35, y, 150, 20, false,
                                                        System.Windows.Forms.Keys.F8, false);

            sampleUi.AddStatic(SegmentLabel, "Number of segments: 2", 10, y += 30, 150, 16);
            Slider   segmentSlider = sampleUi.AddSlider(SegmentSlider, 10, y += 14, 150, 24, 1, 10, 2, false);
            Checkbox hwPatch       = sampleUi.AddCheckBox(HwPatchButton, "User hardware N-patches", 10, y += 26, 150, 20, true,
                                                          System.Windows.Forms.Keys.H, false);

            // Hook the events
            fillModeBox.Changed        += new EventHandler(OnFillmodeChanged);
            segmentSlider.ValueChanged += new EventHandler(OnSegmentChanged);
            hwPatch.Changed            += new EventHandler(OnHardwareChanged);
        }
示例#2
0
        private void _btnGiveUp_ButtonPressEvent(object o, ButtonPressEventArgs args)
        {
            var dialog = new Dialog("Закончить игру?", Program.mv, DialogFlags.Modal);

            dialog.AddButton("Да", ResponseType.Yes).ButtonReleaseEvent += new ButtonReleaseEventHandler((obj, e) =>
            {
                if (ClientManager == null)
                {
                    Game.GiveUpPlayer(Game.CurrentPlayer);
                }
                else
                {
                    ClientManager.Server.GiveUp();
                }
                dialog.Destroy();
            });
            dialog.AddButton("Нет", ResponseType.No).ButtonReleaseEvent += new ButtonReleaseEventHandler((obj, e) =>
            {
                dialog.Destroy();
            });
            //dialog.ShowNow();
            var t = dialog.Run();

            System.Diagnostics.Debug.WriteLine(t);
        }
示例#3
0
        // TODO does not work correctly yet
        public static string StringInput(Window parent_window, string title)
        {
            var dialog = new Dialog(title, parent_window, Gtk.DialogFlags.DestroyWithParent);

            dialog.Modal = true;

            Entry text_entry = new Entry("Name");

            text_entry.Visible = true;

            dialog.Add(text_entry);
            dialog.AddButton("OK", ResponseType.Ok);
            dialog.AddButton("Cancel", ResponseType.Cancel);

            ResponseType response = (ResponseType)dialog.Run();

            dialog.Destroy();

            if (response == ResponseType.Ok)
            {
                return(text_entry.Text);
            }
            else
            {
                return("");
            }
        }
示例#4
0
文件: Program.cs 项目: rogasp/TCPTest
        static string AskIP(int tatami)
        {
            var dialog = new Dialog("IP address", 30, 5);
            var t      = new TextField(0, 0, 15, txtServers[tatami - 1].Text);
            var oldIp  = t.Text;

            dialog.Add(t);

            dialog.AddButton(new Button("OK", true)
            {
                Clicked = () => {
                    txtServers[tatami - 1].Text   = t.Text;
                    btnStart[tatami - 1].CanFocus = false;
                    btnStop[tatami - 1].CanFocus  = true;
                    Application.MainLoop.Invoke(() =>
                    {
                        AddLogg($"Changed IP from {oldIp} to {t.Text} on tatami {tatami}");
                        SetStatus(tatami, Status.TRY_START);
                    });
                    tatamis[tatami - 1].Connect(t.Text.ToString());
                    dialog.Running = false;
                }
            });

            dialog.AddButton(new Button("CANCEL", false)
            {
                Clicked = () => {
                    dialog.Running = false;
                }
            });

            Application.Run(dialog);

            return("");
        }
示例#5
0
        public static void SortOrder()
        {
            Dialog     dialog     = new Dialog("Sort By", 25, 10);
            RadioGroup radioGroup = new RadioGroup(3, 1, new string[] { "Ascending", "Descending" }, (int)Utils.Settings.SortOrder);

            dialog.Add(radioGroup);

            Button btnOk = new Button("OK", true);

            btnOk.Clicked = delegate()
            {
                Utils.Settings.SortOrder = (Utils.SortOrder)radioGroup.Selected;
                Utils.Settings.Save();

                MyDrive.SortItems();

                dialog.Running = false;
                Application.Top.SetFocus(MyDrive.Window);
            };
            Button btnCancel = new Button("Cancel");

            btnCancel.Clicked = delegate()
            {
                dialog.Running = false;
                Application.Top.SetFocus(MyDrive.Window);
            };
            dialog.AddButton(btnOk);
            dialog.AddButton(btnCancel);

            Application.Run(dialog);
            Application.Refresh();
        }
示例#6
0
 protected void BuildSimpleEditorDialog()
 {
     editNode.Modal = true;
     editNode.AddButton("Отмена", ResponseType.Cancel);
     editNode.AddButton("Ok", ResponseType.Ok);
     Gtk.Table editNodeTable = new Table(2, 2, false);
     LableName                = new Label("Название:");
     LableName.Justify        = Justification.Right;
     LableDescription         = new Label("Описание:");
     LableDescription.Justify = Justification.Right;
     editNodeTable.Attach(LableName, 0, 1, 0, 1);
     inputNameEntry = new Entry();
     if (NameMaxLength.HasValue)
     {
         inputNameEntry.MaxLength = NameMaxLength.Value;
     }
     inputNameEntry.WidthRequest = 300;
     editNodeTable.Attach(inputNameEntry, 1, 2, 0, 1);
     inputDiscriptionEntry = new Entry();
     editNodeTable.Attach(LableDescription, 0, 1, 1, 2);
     editNodeTable.Attach(inputDiscriptionEntry, 1, 2, 1, 2);
     if (DiscriptionMaxLength.HasValue)
     {
         inputDiscriptionEntry.MaxLength = DiscriptionMaxLength.Value;
     }
     if (!DescriptionField)
     {
         inputDiscriptionEntry.Sensitive = false;
         LableDescription.Sensitive      = false;
     }
     editNode.VBox.Add(editNodeTable);
     editNode.Response += new ResponseHandler(on_editnode_response);
 }
        void OnClose(object sender, EventArgs args)
        {
            bool cancel = false;

            if (!isSaved)
            {
                var dialog = new Dialog();
                dialog.AddButton("Close without save", ResponseType.No);
                dialog.AddButton(Stock.Cancel, ResponseType.Cancel);
                dialog.AddButton("Save changes", ResponseType.Ok);
                var dialogLabel = new Label("Save changes in file?");
                dialog.VBox.PackStart(dialogLabel, false, false, 0);
                dialog.ShowAll();
                int response = dialog.Run();
                if (response == (int)ResponseType.Ok)
                {
                    System.IO.File.WriteAllText(fileName, editorView.Buffer.Text);
                }
                if (response == (int)ResponseType.Cancel)
                {
                    cancel = true;
                }
                dialog.Destroy();
            }
            if (!cancel)
            {
                Application.Quit();
            }
        }
示例#8
0
        protected void OnDeleteEvent(object sender, DeleteEventArgs a)
        {
            Dialog dialog = new Dialog
            {
                Title           = "Confirm",
                DefaultResponse = 0,
            };

            dialog.AddButton("No", 0);
            dialog.AddButton("Yes", 1);
            dialog.VBox.PackStart(new Label("Are you sure you want to exit?"));
            dialog.VBox.ShowAll();
            dialog.WindowPosition = WindowPosition.CenterAlways;

            if (dialog.Run() == 1)
            {
                dialog.Hide();
                dialog.Destroy();
                KeyPressEvent -= WindowKeyPress;
                Application.Quit();
                a.RetVal = false;
            }
            else
            {
                dialog.Hide();
                dialog.Destroy();
                a.RetVal = true;
            }
        }
        public static Frame ShowFrame()
        {
            Dialog          val      = Dialog.Create();
            Action <String> myAction = new Action <String>(a => { });

            val.Text = "Game Control | Headquarter\n\n" +
                       "";

            val.AddButton("Rename", ColorHelper.FromHexString("3d0c87"), (Action) delegate
            {
                InputDialog input = InputDialog.ShowFor("Rename your Company", $"{Company.Current.Name}", new Action <String>(a => {
                    GameHeadquarter.RenameCompany(a.ToString());
                }));
            }, true);

            val.AddButton("Level Up", ColorHelper.FromHexString("041887"), (Action) delegate
            {
                GameHeadquarter.LevelUp();
            }, false);

            val.AddButton("Close", (Action) delegate { }, true);

            val.Show();
            return((Frame)(object)val);
        }
示例#10
0
文件: Simple2D.cs 项目: d3x0r/xperdex
        /// <summary>
        /// Initializes the application
        /// </summary>
        public void InitializeApplication()
        {
            int y = 10;
            // Initialize the HUD
            Button fullScreen   = hud.AddButton(ToggleFullscreen, "Toggle full screen", 35, y, 125, 22);
            Button toggleRef    = hud.AddButton(ToggleReference, "Toggle reference (F3)", 35, y += 24, 125, 22);
            Button changeDevice = hud.AddButton(ChangeDevice, "Change Device (F2)", 35, y += 24, 125, 22);

            // Hook the button events for when these items are clicked
            fullScreen.Click   += new EventHandler(OnFullscreenClicked);
            toggleRef.Click    += new EventHandler(OnRefClicked);
            changeDevice.Click += new EventHandler(OnChangeDevicClicked);


            y = 10;

            Button   toggleFaiy           = sampleUi.AddButton(ButtonToggleCanvas, "Toggle Canvas", 10, y += 24, 125, 22);
            Checkbox unsafeParticle       = sampleUi.AddCheckBox(CheckUnsafeParticle, "Use Unsafe Methods", 30, y += 24, 125, 22, true);
            Button   toggleTiles          = sampleUi.AddButton(ButtonToggleTiles, "Toggle Tiles", 10, y += 24, 125, 22);
            Button   toggleAnimatedSprite = sampleUi.AddButton(ButtonToggleAnimatedSprite, "Toggle Animated Sprite", 10, y += 24, 125, 22);
            Button   toggleMovingSprite   = sampleUi.AddButton(ButtonToggleMovingSprite, "Toggle Moving Sprite", 10, y += 24, 125, 22);

            toggleFaiy.Click           += new EventHandler(OnToggleParticle);
            unsafeParticle.Changed     += new EventHandler(OnChangeUnsafe);
            toggleTiles.Click          += new EventHandler(OnToggleTiles);
            toggleAnimatedSprite.Click += new EventHandler(OnToggleAnimatedSprite);
            toggleMovingSprite.Click   += new EventHandler(OnToggleMovingSprite);

            particleIsUsingUnsafeMethods = true;
            tilesEnabled = true;
        }
示例#11
0
        /// <summary>
        /// Initializes the application
        /// </summary>
        public void InitializeApplication()
        {
            int y = 10;
            // Initialize the HUD
            Button fullScreen   = hud.AddButton(ToggleFullscreen, "Toggle full screen", 35, y, 125, 22);
            Button toggleRef    = hud.AddButton(ToggleReference, "Toggle reference (F3)", 35, y += 24, 125, 22);
            Button changeDevice = hud.AddButton(ChangeDevice, "Change Device (F2)", 35, y += 24, 125, 22);

            // Hook the button events for when these items are clicked
            fullScreen.Click   += new EventHandler(OnFullscreenClicked);
            toggleRef.Click    += new EventHandler(OnRefClicked);
            changeDevice.Click += new EventHandler(OnChangeDevicClicked);

            // Now add the sample specific UI
            y = 10;
            sampleUi.IsUsingKeyboardInput = true;
            sampleUi.AddStatic(DetailLabel, "Level of Detail:", 0, y, 200, 16);
            Checkbox opt = sampleUi.AddCheckBox(UseOptimizedCheckBox, "Use optimized mesh", 50, y, 200, 20, true);
            Slider   sl  = sampleUi.AddSlider(Detail, 10, y += 16, 200, 16, 4, 4, 4, false);

            // Hook the sample events
            opt.Changed     += new EventHandler(OnOptimizedChanged);
            sl.ValueChanged += new EventHandler(OnDetailChanged);

            // Set button masks
            camera.SetButtonMasks((int)MouseButtonMask.Left, (int)MouseButtonMask.Wheel, 0);
        }
示例#12
0
    public static void AppQuitButtonHandler(Enlightenment.Evas.Item item, object EventInfo)
    {
        Dialog d = new Dialog("Quit Application", "Are you sure you want to quit?", "Quitting will lose all unsaved data!");

        d.AddButton("Yes", AppQuitButtonYesHandler);
        d.AddButton("No", AppQuitButtonNoHandler);
        d.Run();
    }
示例#13
0
    static void OptionsDialog()
    {
        Dialog d = new Dialog(62, 15, "Options");

        d.Add(new Label(1, 1, "  Download Directory:"));
        d.Add(new Label(1, 3, "         Listen Port:"));
        d.Add(new Label(1, 5, "  Upload Speed Limit:"));
        d.Add(new Label(35, 5, "kB/s"));
        d.Add(new Label(1, 7, "Download Speed Limit:"));
        d.Add(new Label(35, 7, "kB/s"));

        Entry download_dir = new Entry(24, 1, 30, "~/Download");

        d.Add(download_dir);

        Entry listen_port = new Entry(24, 3, 6, "34");

        d.Add(listen_port);

        Entry upload_limit = new Entry(24, 5, 10, "1024");

        d.Add(upload_limit);

        Entry download_limit = new Entry(24, 7, 10, "1024");

        d.Add(download_limit);

        bool ok = false;

        Button b = new Button("Ok", true);

        b.Clicked += delegate { ok = true; b.Container.Running = false; };
        d.AddButton(b);

        b          = new Button("Cancel");
        b.Clicked += delegate { b.Container.Running = false; };
        d.AddButton(b);

        Application.Run(d);

        if (ok)
        {
            int v;

            if (!Int32.TryParse(listen_port.Text, out v))
            {
                Application.Error("Error", "The value `{0}' is not a valid port number", listen_port.Text);
                return;
            }

            if (!Directory.Exists(download_dir.Text))
            {
                Application.Error("Error", "The directory\n{0}\ndoes not exist", download_dir.Text);
                return;
            }
        }
    }
        void OnOpen(object sender, EventArgs args)
        {
            bool cancel = false;

            if (!isSaved)
            {
                var dialog = new Dialog();
                dialog.AddButton("Close without save", ResponseType.No);
                dialog.AddButton(Stock.Cancel, ResponseType.Cancel);
                dialog.AddButton("Save changes", ResponseType.Ok);
                var dialogLabel = new Label("Save changes in file?");
                dialog.VBox.PackStart(dialogLabel, false, false, 0);
                dialog.ShowAll();
                int response = dialog.Run();
                if (response == (int)ResponseType.Ok)
                {
                    System.IO.File.WriteAllText(fileName, editorView.Buffer.Text);
                }
                if (response == (int)ResponseType.Cancel)
                {
                    cancel = true;
                }
                dialog.Destroy();
            }

            if (!cancel)
            {
                Gtk.FileChooserDialog filechooser =
                    new Gtk.FileChooserDialog("Choose the file to open",
                                              parent,
                                              FileChooserAction.Open
                                              );
                filechooser.Visible = true;
                filechooser.AddButton(Stock.Cancel, ResponseType.Cancel);
                filechooser.AddButton(Stock.Open, ResponseType.Ok);

                if (filechooser.Run() == (int)ResponseType.Ok)
                {
                    fileName = filechooser.Filename;
                    editorView.Buffer.Text = System.IO.File.ReadAllText(filechooser.Filename);
                }

                filechooser.Destroy();
                parent.Title      = fileName;
                isSaved           = true;
                saveBtn.Sensitive = false;
                save.Sensitive    = false;
                undoBtn.Sensitive = false;
                undo.Sensitive    = false;
                undoStack.Clear();
                redoBtn.Sensitive = false;
                redo.Sensitive    = false;
                redoStack.Clear();
            }
        }
示例#15
0
        public void Initialize()
        {
            dialog = new Dialog(Framework.Instance);
            dialog.SetFont(0, "Arial", 14, FontWeight.Normal);
            dialog.SetFont(1, "Arial", 20, FontWeight.Bold);
            dialog.SetSize(600, 400);
            dialog.SetBackgroundColors(
                new ColorValue(0.5f, 0.5f, 0.5f, 128f),
                new ColorValue(0.5f, 0.5f, 0.5f, 128f),
                new ColorValue(0, 0, 0, 128f),
                new ColorValue(0, 0, 0, 128f));

            text = dialog.AddStatic((int)WelcomeDialogControlIds.Static,
                                    "Hi, and welcome to R/C Desk Pilot.\nDownloading news, please wait...",
                                    dialog.Width / 2 - 290, 10, 580, 265);
            Element e = text[0];

            e.FontIndex  = 1;
            e.textFormat = DrawTextFormat.Top | DrawTextFormat.Center | DrawTextFormat.WordBreak;

            infoButton        = dialog.AddButton((int)WelcomeDialogControlIds.InfoButton, "website", dialog.Width / 2 - 70, dialog.Height - 120, 140, 30);
            infoButton.Click += new EventHandler(infoButton_Click);
            e            = infoButton[0];
            e.FontIndex  = 1;
            e.textFormat = DrawTextFormat.VerticalCenter | DrawTextFormat.Center | DrawTextFormat.WordBreak;
            e            = infoButton[1];
            e.FontIndex  = 1;
            e.textFormat = DrawTextFormat.VerticalCenter | DrawTextFormat.Center | DrawTextFormat.WordBreak;

            startText = dialog.AddStatic((int)WelcomeDialogControlIds.Static,
                                         "Click one of the buttons below to start flying or watch the demo.",
                                         dialog.Width / 2 - 290, dialog.Height - 80, 580, 30);
            e            = startText[0];
            e.FontIndex  = 1;
            e.textFormat = DrawTextFormat.Top | DrawTextFormat.Center | DrawTextFormat.WordBreak;

            startButton        = dialog.AddButton((int)WelcomeDialogControlIds.StartButton, "Start", dialog.Width / 4 - 60, dialog.Height - 40, 120, 30);
            startButton.Click += new EventHandler(startButton_Click);
            e            = startButton[0];
            e.FontIndex  = 1;
            e.textFormat = DrawTextFormat.VerticalCenter | DrawTextFormat.Center | DrawTextFormat.WordBreak;
            e            = startButton[1];
            e.FontIndex  = 1;
            e.textFormat = DrawTextFormat.VerticalCenter | DrawTextFormat.Center | DrawTextFormat.WordBreak;

            demoButton        = dialog.AddButton((int)WelcomeDialogControlIds.DemoButton, "Demo", 3 * dialog.Width / 4 - 60, dialog.Height - 40, 120, 30);
            demoButton.Click += new EventHandler(demoButton_Click);
            e            = demoButton[0];
            e.FontIndex  = 1;
            e.textFormat = DrawTextFormat.VerticalCenter | DrawTextFormat.Center | DrawTextFormat.WordBreak;
            e            = demoButton[1];
            e.FontIndex  = 1;
            e.textFormat = DrawTextFormat.VerticalCenter | DrawTextFormat.Center | DrawTextFormat.WordBreak;
        }
示例#16
0
        /// <summary>
        /// Prompt user for items to be deployed to the device.
        /// </summary>
        /// <param name="targetDevice"></param>
        private async Task ChooseDeployments(Device targetDevice)
        {
            using (var newDialog = new Dialog(parentForm))
            {
                newDialog.Text     = "Select Installs";
                newDialog.AutoSize = false;
                newDialog.Height   = 500;
                newDialog.Width    = 260;

                var selectListBox = new CheckedListBox();
                selectListBox.CheckOnClick  = true;
                selectListBox.Size          = new System.Drawing.Size(300, 250);
                selectListBox.DisplayMember = nameof(TaskInfo.TaskName);

                var depList = await GetModules();

                foreach (var d in depList)
                {
                    selectListBox.Items.Add(d, false);
                }
                // Add deployment selection list.
                newDialog.AddCustomControl("TaskList", "Select items to install:", selectListBox);

                // Add a 'Select None' button with lamba action.
                var selectNone = newDialog.AddButton("selectNoneButton", "Select None", () =>
                {
                    for (int i = 0; i < selectListBox.Items.Count; i++)
                    {
                        selectListBox.SetItemChecked(i, false);
                    }
                });
                selectNone.Width = 200;

                // Add a 'Select All' button with lamba action.
                var selectAll = newDialog.AddButton("selectAllButton", "Select All", () =>
                {
                    for (int i = 0; i < selectListBox.Items.Count; i++)
                    {
                        selectListBox.SetItemChecked(i, true);
                    }
                });
                selectAll.Width = 200;

                newDialog.ShowDialog();
                if (newDialog.DialogResult == DialogResult.OK)
                {
                    foreach (TaskInfo task in selectListBox.CheckedItems)
                    {
                        deployments.Enqueue(task);
                    }
                }
            }
        }
示例#17
0
        public static void NewFolder()
        {
            string newFolderName  = "New Folder";
            int    newFolderCount = 0;

            while (MyDrive.Files != null && MyDrive.Files.Find((file) => file.Name.Equals(newFolderName)) != null)
            {
                newFolderName = string.Format("New Folder ({0})", ++newFolderCount);
            }

            Dialog    dialog    = new Dialog("Enter Folder Name", 50, 8);
            TextField textField = new TextField(newFolderName)
            {
                X     = 1,
                Y     = 1,
                Width = Dim.Fill(1)
            };

            dialog.Add(textField);

            Button btnOk = new Button("OK", true);

            btnOk.Clicked = delegate()
            {
                Utils.Drive.NewFolder(MyDrive.CurrentDirectory.Id, textField.Text.ToString()).ContinueWith((task) =>
                {
                    Application.MainLoop.Invoke(() =>
                    {
                        MyDrive.Files.Add(task.Result);

                        MyDrive.SortItems();

                        MyDrive.SelectItem(task.Result);

                        dialog.Running = false;
                        Application.Top.SetFocus(MyDrive.Window);
                    });
                });
            };
            Button btnCancel = new Button("Cancel");

            btnCancel.Clicked = delegate()
            {
                dialog.Running = false;
                Application.Top.SetFocus(MyDrive.Window);
            };
            dialog.AddButton(btnOk);
            dialog.AddButton(btnCancel);

            Application.Run(dialog);
            Application.Refresh();
        }
示例#18
0
        /// <summary>
        /// Initializes the application
        /// </summary>
        public void InitializeApplication()
        {
            int y = 10;

            // Initialize the HUD
            Bonsai.Core.Controls.Button fullScreen   = hud.AddButton(ToggleFullscreen, "Toggle full screen", 35, y, 125, 22);
            Bonsai.Core.Controls.Button changeDevice = hud.AddButton(ChangeDevice, "Change Device (F2)", 35, y += 24, 125, 22);
            //fullScreen.IsVisible = false;
            //changeDevice.IsVisible = false;
            // Hook the button events for when these items are clicked
            fullScreen.Click   += new EventHandler(OnFullscreenClicked);
            changeDevice.Click += new EventHandler(OnChangeDeviceClicked);
        }
示例#19
0
        /// <summary>
        /// Adds the guid stuff to the application
        /// </summary>
        public void InitializeApplication()
        {
            int y = 10;
            // Create the buttons
            Button fullScreen   = hud.AddButton(2, "Toggle full screen", 35, y, 125, 22);
            Button toggleRef    = hud.AddButton(3, "Toggle reference (F3)", 35, y += 24, 125, 22);
            Button changeDevice = hud.AddButton(4, "Change Device (F2)", 35, y += 24, 125, 22);

            // Hook the button events for when these items are clicked
            fullScreen.Click   += new EventHandler(OnFullscreenClicked);
            toggleRef.Click    += new EventHandler(OnRefClicked);
            changeDevice.Click += new EventHandler(OnChangeDevicClicked);
        }
示例#20
0
            protected void CleanDBActivated(object o, System.EventArgs args)
            {
                Dialog dlg = new Dialog("You will delete the database, are you sure?", controller.mainwindow,
                                        DialogFlags.Modal);

                dlg.AddButton("Yes, clean the database", ResponseType.Accept);
                dlg.AddButton("No", ResponseType.Cancel);
                if (dlg.Run() == (int)ResponseType.Accept)
                {
                    controller.database.Ejecutar("DELETE FROM Songs");
                    controller.View_ThreadLoadSongs();
                }
                dlg.Destroy();
            }
示例#21
0
        protected void OnButtonPickDatePeriodClicked(object sender, EventArgs e)
        {
            #region Widget creation
            Window parentWin  = (Window)Toplevel;
            var    selectDate = new Dialog("Укажите период", parentWin, DialogFlags.DestroyWithParent);
            selectDate.Modal = true;
            selectDate.AddButton("Отмена", ResponseType.Cancel);
            selectDate.AddButton("Ok", ResponseType.Ok);

            periodSummary = new Label();
            selectDate.VBox.Add(periodSummary);

            HBox hbox = new HBox(true, 6);

            StartDateCalendar = new Calendar();
            StartDateCalendar.DisplayOptions = DisplayOptions;
            StartDateCalendar.Date           = StartDateOrNull ?? DateTime.Today;
            StartDateCalendar.DaySelected   += StartDateCalendar_DaySelected;

            EndDateCalendar = new Calendar();
            EndDateCalendar.DisplayOptions = DisplayOptions;
            EndDateCalendar.Date           = EndDateOrNull ?? DateTime.Today;
            EndDateCalendar.DaySelected   += EndDateCalendar_DaySelected;

            hbox.Add(StartDateCalendar);
            hbox.Add(EndDateCalendar);

            selectDate.VBox.Add(hbox);
            selectDate.ShowAll();
            #endregion

            int response = selectDate.Run();
            if (response == (int)ResponseType.Ok)
            {
                startDate = StartDateCalendar.GetDate();
                endDate   = EndDateCalendar.GetDate();
                OnStartDateChanged();
                OnEndDateChanged();
                OnPeriodChanged();
                OnPeriodChangedByUser();
            }

            #region Destroy
            EndDateCalendar.Destroy();
            StartDateCalendar.Destroy();
            hbox.Destroy();
            selectDate.Destroy();
            #endregion
        }
示例#22
0
        void DeadlineButton_Clicked(object sender, EventArgs e)
        {
            var dialog = new Dialog("Sample", null, DialogFlags.DestroyWithParent);

            dialog.Modal = true;
            dialog.AddButton("Cancel", ResponseType.Cancel);
            dialog.AddButton("OK", ResponseType.Ok);
            dialog.ContentArea.Add(calendar);
            calendar.Show();
            if (dialog.Run() == (int)ResponseType.Ok)
            {
                deadlineButton.Label = calendar.Date.ToShortDateString();
            }
            dialog.Destroy();
        }
示例#23
0
        /// <summary>Initializes the application</summary>
        public void InitializeApplication()
        {
            isUsingPreshader = true;

            for (int i = 0; i < MaxNumberLights; i++)
            {
                lightControl[i] = new DirectionWidget();
                lightControl[i].LightDirection = new Vector3((float)Math.Sin((float)Math.PI
                                                                             * 2 * i / MaxNumberLights - (float)Math.PI / 6), 0, -(float)Math.Cos((float)Math.PI
                                                                                                                                                  * 2 * i / MaxNumberLights - (float)Math.PI / 6));
            }

            activeLight        = 0;
            numberActiveLights = 1;
            lightScale         = 1.0f;

            int y = 10;
            // Initialize the dialogs
            Button fullScreen   = hud.AddButton(ToggleFullscreen, "Toggle full screen", 35, y, 125, 22);
            Button toggleRef    = hud.AddButton(ToggleReference, "Toggle reference (F3)", 35, y += 24, 125, 22);
            Button changeDevice = hud.AddButton(ChangeDevice, "Change Device (F2)", 35, y += 24, 125, 22);

            // Hook the button events for when these items are clicked
            fullScreen.Click   += new EventHandler(OnFullscreenClicked);
            toggleRef.Click    += new EventHandler(OnRefClicked);
            changeDevice.Click += new EventHandler(OnChangeDevicClicked);

            // Now add the sample specific UI
            y = 10;
            sampleUi.AddStatic(NumberLightsStatic, string.Format("# Lights: {0}", numberActiveLights), 35, y += 24, 125, 22);
            Slider lightSlider = sampleUi.AddSlider(NumberLights, 50, y += 24, 100, 22, 1, MaxNumberLights, numberActiveLights, false);

            y += 24;
            sampleUi.AddStatic(LightScaleStatic, string.Format("Light scale: {0}", lightScale.ToString("f2",
                                                                                                       System.Globalization.CultureInfo.CurrentUICulture)), 35, y += 24, 125, 22);
            Slider scaleSlider = sampleUi.AddSlider(LightScaleControl, 50, y += 24, 100, 22, 0, 20, (int)(lightScale * 10.0f), false);

            y += 24;
            Button activeLightControl = sampleUi.AddButton(ActiveLightControl, "Change active light (K)", 35, y += 24, 125, 22,
                                                           System.Windows.Forms.Keys.K, false);
            Checkbox preShader = sampleUi.AddCheckBox(EnablePreshader, "Enable preshaders", 35, y += 24, 125, 22, isUsingPreshader);

            // Hook the events
            preShader.Changed        += new EventHandler(OnPreshaderClick);
            lightSlider.ValueChanged += new EventHandler(OnNumberLightsChanged);
            activeLightControl.Click += new EventHandler(OnActiveLightClick);
            scaleSlider.ValueChanged += new EventHandler(OnLightScaleChanged);
        }
示例#24
0
        private void Input_msgShow(object sender, EventArgs e)
        {
            //IL_0009: Unknown result type (might be due to invalid IL or missing references)
            //IL_000f: Expected O, but got Unknown
            //IL_000f: Unknown result type (might be due to invalid IL or missing references)
            //IL_0014: Unknown result type (might be due to invalid IL or missing references)
            //IL_0021: Expected O, but got Unknown
            //IL_003b: Unknown result type (might be due to invalid IL or missing references)
            //IL_0045: Expected O, but got Unknown
            InputArgs inputArgs = (InputArgs)e;
            Dialog    val       = null;

            try
            {
                Entry  val2 = (Entry)(object)new Entry();
                Dialog val3 = new Dialog();
                ((Window)val3).set_Title(inputArgs.Title);
                val = (Dialog)(object)val3;
                val.AddButton("ok", (ResponseType)(-5));
                ((Container)val.get_VBox()).Add((Widget)(object)new Label(inputArgs.Message));
                ((Window)val).SetPosition((WindowPosition)3);
                ((Container)val.get_VBox()).Add((Widget)(object)val2);
                ((Widget)val).ShowAll();
                val.Run();
                inputArgs.Response = val2.get_Text();
            }
            finally
            {
                if (val != null)
                {
                    ((Object)val).Destroy();
                }
            }
        }
示例#25
0
        private void GetForcast(object sender, EventArgs e)
        {
            //IL_000d: Unknown result type (might be due to invalid IL or missing references)
            //IL_0013: Expected O, but got Unknown
            //IL_0025: Unknown result type (might be due to invalid IL or missing references)
            //IL_002a: Unknown result type (might be due to invalid IL or missing references)
            //IL_0036: Expected O, but got Unknown
            //IL_005c: Unknown result type (might be due to invalid IL or missing references)
            //IL_0066: Expected O, but got Unknown
            Dialog val = null;

            try
            {
                LinkButton val2 = (LinkButton)(object)new LinkButton(weatherResponse.OptionalLink);
                ((Button)val2).add_Clicked((EventHandler)Weather_Clicked);
                Dialog val3 = new Dialog();
                ((Window)val3).set_Title("Forcast");
                val = (Dialog)(object)val3;
                val.AddButton("ok", (ResponseType)(-5));
                ((Window)val).SetPosition((WindowPosition)3);
                ((Container)val.get_VBox()).Add((Widget)(object)new Label(weatherResponse.ForcastDescription));
                ((Container)val.get_VBox()).Add((Widget)(object)val2);
                ((Widget)val).ShowAll();
                val.Run();
            }
            finally
            {
                if (val != null)
                {
                    ((Object)val).Destroy();
                }
            }
        }
示例#26
0
        private void MBox_msgShow(object sender, EventArgs e)
        {
            //IL_0009: Unknown result type (might be due to invalid IL or missing references)
            //IL_000e: Unknown result type (might be due to invalid IL or missing references)
            //IL_001b: Expected O, but got Unknown
            //IL_003c: Unknown result type (might be due to invalid IL or missing references)
            //IL_0046: Expected O, but got Unknown
            msgBoxEventArg msgBoxEventArg = (msgBoxEventArg)e;
            Dialog         val            = null;

            try
            {
                Dialog val2 = new Dialog();
                ((Window)val2).set_Title(msgBoxEventArg.Title);
                val = (Dialog)(object)val2;
                val.AddButton("ok", (ResponseType)(-5));
                ((Window)val).SetPosition((WindowPosition)3);
                ((Container)val.get_VBox()).Add((Widget)(object)new Label(msgBoxEventArg.Message));
                ((Widget)val).ShowAll();
                val.Run();
            }
            finally
            {
                if (val != null)
                {
                    ((Object)val).Destroy();
                }
            }
        }
示例#27
0
        void Init()
        {
            Dialog.KeepWindowTitle = true;

            SetSize(Progress.FORM_WIDTH, (CanCancel ? 7 : 5) + _LineCount);

            _textActivity = new IText[_LineCount];
            for (int iLine = 0; iLine < _LineCount; ++iLine)
            {
                _textActivity[iLine] = Dialog.AddText(5, -1, 5 + Progress.TEXT_WIDTH - 1, string.Empty);
            }
            _textProgress = Dialog.AddText(5, -1, 5 + Progress.TEXT_WIDTH - 1, string.Empty);

            if (CanCancel)
            {
                Dialog.AddText(5, -1, 0, string.Empty).Separator = 1;

                IButton button = Dialog.AddButton(0, -1, _jobThread == null ? "Cancel" : "Abort");
                button.CenterGroup = true;
                Dialog.Default     = button;
            }

            Dialog.Initialized += OnInitialized;
            Dialog.Closing     += OnClosing;
            Dialog.Idled       += OnIdled;
        }
示例#28
0
    public static void AppAboutButtonHandler(Enlightenment.Evas.Item item, object EventInfo)
    {
        Dialog d = new Dialog("About EFL#", "EFL# Widget Test", "Coded by Hisham Mardam Bey");

        d.AddButton("Close", AppAboutButtonCloseHandler);
        d.Run();
    }
示例#29
0
        private void saveFile()
        {
            var fileChooser = new FileChooserDialog(
                "Save File (*.clong)", this, FileChooserAction.Save,
                "Cancel", ResponseType.Cancel,
                "Save As", ResponseType.Accept
                );

            fileChooser.Filter = new FileFilter();
            fileChooser.Filter.AddPattern("*.clong");
            if (fileChooser.Run() == (int)ResponseType.Accept)
            {
                FileManager.Save(
                    fileChooser.Filename,
                    docView.GetText(),
                    exView.Examples,
                    dictView.Words
                    );
                currentFile = fileChooser.Filename;
                Title       = AppSettings.WindowTitle + " - " + currentFile;
                var popup = new Dialog(
                    "Success", this, DialogFlags.DestroyWithParent
                    );
                popup.ContentArea.Add(new Label("Successfully saved!"));
                popup.AddButton("Okay", ResponseType.Accept);
                popup.ShowAll();
                popup.Resizable = false;
                popup.Run();
                popup.Dispose();
            }
            fileChooser.Dispose();
        }
        private static void UpdateDialog(string format, params object[] args)
        {
            string text = String.Format(format, args);

            if (dialog == null)
            {
                dialog       = new Dialog();
                dialog.Title = "Loading data from assemblies...";
                dialog.AddButton(Stock.Cancel, 1);
                dialog.Response += new ResponseHandler(ResponseCB);
                dialog.SetDefaultSize(480, 100);

                VBox vbox = dialog.VBox;
                HBox hbox = new HBox(false, 4);
                vbox.PackStart(hbox, true, true, 0);

                Gtk.Image icon = new Gtk.Image(Stock.DialogInfo, IconSize.Dialog);
                hbox.PackStart(icon, false, false, 0);
                dialog_label = new Label(text);
                hbox.PackStart(dialog_label, false, false, 0);
                dialog.ShowAll();
            }
            else
            {
                dialog_label.Text = text;
                while (Application.EventsPending())
                {
                    Application.RunIteration();
                }
            }
        }
示例#31
0
 public static void AppAboutButtonHandler(Enlightenment.Evas.Item item, object EventInfo)
 {
   Dialog d = new Dialog("About EFL#", "EFL# Widget Test", "Coded by Hisham Mardam Bey");
   d.AddButton("Close", AppAboutButtonCloseHandler);
   d.Run();	
 }
示例#32
0
 public static void AppQuitButtonHandler(Enlightenment.Evas.Item item, object EventInfo)
 {
   Dialog d = new Dialog("Quit Application", "Are you sure you want to quit?", "Quitting will lose all unsaved data!");
   d.AddButton("Yes", AppQuitButtonYesHandler);
   d.AddButton("No", AppQuitButtonNoHandler);
   d.Run();
 }