Exemplo n.º 1
0
        public UpdateDialog(LogDataProcessor logProcessor, IReadOnlyList <LogUpdateList> updates)
        {
            Title      = "Manager update - arcdps Log Manager";
            ClientSize = new Size(500, -1);
            var layout = new DynamicLayout();

            Content = layout;

            layout.BeginVertical(new Padding(10), new Size(10, 20));
            {
                layout.BeginVertical(spacing: new Size(0, 0));
                {
                    // This is a very hacky solution for WrapMode.Word not working properly on the Gtk platform
                    layout.AddRow(new Label
                    {
                        Text = "This new version of the log manager brings improvements for processing some of the ",
                        Wrap = WrapMode.None
                    });
                    layout.AddRow(new Label
                    {
                        Text = "logs. They have to be processed again to correctly update the data. Affected logs are ",
                        Wrap = WrapMode.None
                    });
                    layout.AddRow(new Label
                    {
                        Text = "listed below. Do you wish to do so now?",
                        Wrap = WrapMode.None
                    });
                    layout.AddRow(null);
                }
                layout.EndVertical();
                layout.AddRow(ConstructGridView(updates));
            }
            layout.EndVertical();

            var later = new Button {
                Text = "Later"
            };
            var yes = new Button {
                Text = "Yes"
            };

            later.Click += (sender, args) => Close();
            yes.Click   += (sender, args) =>
            {
                foreach (var update in updates)
                {
                    foreach (var log in update.UpdateableLogs)
                    {
                        logProcessor.Schedule(log);
                    }
                }
                Close();
            };

            AbortButton   = later;
            DefaultButton = yes;
            PositiveButtons.Add(yes);
            NegativeButtons.Add(later);
        }
Exemplo n.º 2
0
        void InitializeComponent()
        {
            Title     = "Preferences";
            Padding   = MasterPadding;
            Resizable = true;

            Width  = (int)(Screen.PrimaryScreen.Bounds.Width / 3.25f);
            Height = (int)(Screen.PrimaryScreen.Bounds.Height / 2.5f);

            Content = new TabControl
            {
                BackgroundColor = SystemColors.ControlBackground,
                Pages           =
                {
                    BuildControlsTab(),
                    BuildDefinitionsTab(),
                    BuildTexturesTab(),
                    BuildColorsTab()
                }
            };

            PositiveButtons.Add(new Button {
                Text = "OK", ID = BtnOKName, Command = CmdOK
            });
            NegativeButtons.Add(new Button {
                Text = "Cancel", ID = BtnCancelName, Command = CmdCancel
            });
        }
Exemplo n.º 3
0
        public InsertDiskDialog(DiskImage diskImage)
        {
            Title       = "Insert Disk";
            ClientSize  = new Size(400, -1);
            Resizable   = false;
            Maximizable = false;
            Minimizable = false;

            PositiveButtons.Add(SelectResultButton);
            NegativeButtons.Add(CancelResultButton);
            DefaultButton = SelectDiskButton;

            if (diskImage != null)
            {
                FileNameTextBox.Text     = diskImage.DiskFile;
                BootDiskCheckBox.Checked = diskImage.IsBootDisk;
                FloppyCheckBox.Checked   = diskImage.IsFloppy;
            }

            var dialogStack = new StackLayout
            {
                Orientation = Orientation.Vertical,
                VerticalContentAlignment   = VerticalAlignment.Center,
                HorizontalContentAlignment = HorizontalAlignment.Stretch,
                Padding = new Padding(10, 10),
                Spacing = 5
            };

            dialogStack.Items.Add(new Label {
                Text = "ISO/IMG file:"
            });

            var innerStack = new StackLayout
            {
                Orientation = Orientation.Horizontal,
                Padding     = new Padding(0, 0),
                Spacing     = 5,
                HorizontalContentAlignment = HorizontalAlignment.Stretch,
                VerticalContentAlignment   = VerticalAlignment.Center
            };

            innerStack.Items.Add(new StackLayoutItem(FileNameTextBox, true));
            innerStack.Items.Add(SelectDiskButton);
            dialogStack.Items.Add(innerStack);

            dialogStack.Items.Add(new Panel {
                Height = 10
            });
            dialogStack.Items.Add(BootDiskCheckBox);
            dialogStack.Items.Add(FloppyCheckBox);

            SelectDiskButton.Click   += SelectDiskButon_Click;
            SelectResultButton.Click += SelectResultButton_Click;
            CancelResultButton.Click += CancelResultButton_Click;

            Content = dialogStack;
        }
Exemplo n.º 4
0
        private void InitializeComponent()
        {
            DisplayMode = DialogDisplayMode.Attached;
            Width       = 400;
            Height      = 250;

            buttonAdd      = new Button();
            buttonAdd.Text = "Add";
            PositiveButtons.Add(buttonAdd);
            DefaultButton = buttonAdd;

            buttonCancel      = new Button();
            buttonCancel.Text = "Cancel";
            NegativeButtons.Add(buttonCancel);
            AbortButton = buttonCancel;

            layout1 = new DynamicLayout();
            layout1.DefaultSpacing = new Size(8, 8);
            layout1.Padding        = new Padding(6);
            layout1.BeginVertical();

            label1       = new Label();
            label1.Wrap  = WrapMode.Word;
            label1.Style = "Wrap";
            layout1.AddRow(label1);

            radioCopy         = new RadioButton();
            radioCopy.Checked = true;
            layout1.AddRow(radioCopy);

            radioLink = new RadioButton(radioCopy);
            layout1.AddRow(radioLink);

            radioSkip = new RadioButton(radioCopy);
            layout1.AddRow(radioSkip);

            var spacing = new Label();

            spacing.Height = 15;
            layout1.Add(spacing, true, true);

            checkBox1 = new CheckBox();
            layout1.AddRow(checkBox1);

            layout1.EndVertical();
            Content = layout1;

            radioCopy.CheckedChanged += RadioButton_CheckedChanged;
            radioLink.CheckedChanged += RadioButton_CheckedChanged;
            radioSkip.CheckedChanged += RadioButton_CheckedChanged;
            checkBox1.CheckedChanged += CheckBox1_CheckedChanged;
            buttonAdd.Click          += ButtonOk_Click;
            buttonCancel.Click       += ButtonAdd_Click;
        }
Exemplo n.º 5
0
        public NewMachineDialog()
        {
            Title       = "New Machine";
            ClientSize  = new Size(540, -1);
            Resizable   = false;
            Maximizable = false;
            Minimizable = false;
            PositiveButtons.Add(CreateResultButton);
            NegativeButtons.Add(CancelResultButton);
            DefaultButton = CreateResultButton;

            var dialogStack = new StackLayout
            {
                Orientation = Orientation.Vertical,
                VerticalContentAlignment   = VerticalAlignment.Center,
                HorizontalContentAlignment = HorizontalAlignment.Stretch,
                Padding = new Padding(10, 10),
                Spacing = 5
            };

            dialogStack.Items.Add(new StackLayoutItem(DialogTabs, true));

            // Setup main page
            DialogTabs.Pages.Add(MainPage);
            MainPageLayout.Rows.Add(new TableRow(
                                        new TableCell(MachineName, true),
                                        new TableCell(MachineArch, true)
                                        ));
            MainPageLayout.Rows.Add(new TableRow(
                                        new TableCell(OsFamily, true),
                                        new TableCell(OsName, true)
                                        ));
            MainPageLayout.Rows.Add(new TableRow(
                                        new TableCell(OsVersion, true),
                                        new TableCell(new Panel(), true)
                                        ));
            MainPage.Content = MainPageLayout;

            // Setup Memory Page
            DialogTabs.Pages.Add(MemoryPage);
            MemoryPageLayout.Rows.Add(new TableRow(
                                          new TableCell(RamInput, true),
                                          new TableCell(new Panel(), true)
                                          ));
            MemoryPage.Content = MemoryPageLayout;

            DialogTabs.Pages.Add(DisksPage);

            Content = dialogStack;

            CreateResultButton.Click += CreateResultButton_Click;
            CancelResultButton.Click += CancelResultButton_Click;
        }
Exemplo n.º 6
0
        private void InitializeComponent()
        {
            DisplayMode = DialogDisplayMode.Attached;
            Size        = new Size(400, 160);

            buttonOk = new Button
            {
                Text = "Ok"
            };
            PositiveButtons.Add(buttonOk);
            DefaultButton = buttonOk;

            buttonCancel = new Button
            {
                Text = "Cancel"
            };
            NegativeButtons.Add(buttonCancel);
            AbortButton = buttonCancel;

            layout1 = new DynamicLayout
            {
                DefaultSpacing = new Size(4, 4),
                Padding        = new Padding(6)
            };
            layout1.BeginVertical();

            layout1.Add(null, true, true);

            label1 = new Label();
            layout1.Add(label1);

            textBox1 = new TextBox();
            layout1.Add(textBox1);

            label2 = new Label
            {
                TextColor     = new Color(SystemColors.ControlText, 0.5f),
                TextAlignment = TextAlignment.Center
            };
            layout1.Add(label2);

            layout1.Add(null, true, true);

            layout1.EndVertical();
            Content = layout1;

            textBox1.TextChanged += TextBox1_TextChanged;
            buttonOk.Click       += ButtonOk_Click;
            buttonCancel.Click   += ButtonCancel_Click;
        }
        private void InitializeComponent()
        {
            Title       = "Reference Editor";
            DisplayMode = DialogDisplayMode.Attached;
            Resizable   = true;
            Padding     = new Padding(4);
            Size        = new Size(500, 400);
            MinimumSize = new Size(450, 300);

            buttonOk      = new Button();
            buttonOk.Text = "Ok";
            PositiveButtons.Add(buttonOk);
            DefaultButton = buttonOk;

            buttonCancel      = new Button();
            buttonCancel.Text = "Cancel";
            NegativeButtons.Add(buttonCancel);
            AbortButton = buttonCancel;

            layout1 = new DynamicLayout();
            layout1.DefaultSpacing = new Size(4, 4);
            layout1.BeginHorizontal();

            grid1       = new GridView();
            grid1.Style = "GridView";
            layout1.Add(grid1, true, true);

            stack1             = new StackLayout();
            stack1.Orientation = Orientation.Vertical;
            stack1.Spacing     = 4;

            buttonAdd      = new Button();
            buttonAdd.Text = "Add";
            stack1.Items.Add(new StackLayoutItem(buttonAdd, false));

            buttonRemove      = new Button();
            buttonRemove.Text = "Remove";
            stack1.Items.Add(new StackLayoutItem(buttonRemove, false));

            layout1.Add(stack1, false, true);

            Content = layout1;

            grid1.SelectionChanged += Grid1_SelectionChanged;
            grid1.KeyDown          += Grid1_KeyDown;
            buttonAdd.Click        += ButtonAdd_Click;
            buttonRemove.Click     += ButtonRemove_Click;
            buttonOk.Click         += ButtonOk_Click;
            buttonCancel.Click     += ButtonCancel_Click;
        }
Exemplo n.º 8
0
        void InitializeComponent()
        {
            Resizable = true;

            var tblGroups = new TableLayout(1, 2);

            tblGroups.Add(new GroupBox {
                Text = "Upper", Content = new Button {
                    Text = "Upper Button"
                }
            }, 0, 0);
            tblGroups.Add(new GroupBox {
                Text = "Lower", Content = new Button {
                    Text = "Lower Button"
                }
            }, 0, 1);

            tblGroups.SetRowScale(0, true);
            tblGroups.SetRowScale(1, true);

            if (_tabs)
            {
                Content = new TabControl
                {
                    Pages =
                    {
                        new TabPage
                        {
                            Text    = "TabPage",
                            Content = tblGroups
                        }
                    }
                };
            }
            else
            {
                Content = tblGroups;
            }

            if (_posNegButtons)
            {
                PositiveButtons.Add(new Button {
                    Text = "OK"
                });
                NegativeButtons.Add(new Button {
                    Text = "Cancel"
                });
            }
        }
Exemplo n.º 9
0
        private void InitializeComponent()
        {
            Title       = "Delete Items";
            DisplayMode = DialogDisplayMode.Attached;
            Resizable   = true;
            Size        = new Size(450, 300);
            MinimumSize = new Size(350, 250);

            buttonDelete = new Button
            {
                Text = "Delete"
            };
            PositiveButtons.Add(buttonDelete);
            DefaultButton      = buttonDelete;
            buttonDelete.Style = "Destuctive";

            buttonCancel = new Button
            {
                Text = "Cancel"
            };
            NegativeButtons.Add(buttonCancel);
            AbortButton = buttonCancel;

            layout1 = new DynamicLayout
            {
                DefaultSpacing = new Size(2, 2)
            };
            layout1.BeginVertical();

            label1 = new Label
            {
                Wrap = WrapMode.Word,
                Text = "The following items will be deleted (this action cannot be undone):"
            };
            layout1.Add(label1, true, false);

            treeView1 = new TreeGridView
            {
                ShowHeader = false
            };
            layout1.Add(treeView1, true, true);

            DefaultButton.Text = "Delete";

            Content = layout1;

            buttonDelete.Click += ButtonDelete_Click;
            buttonCancel.Click += ButtonCancel_Click;
        }
Exemplo n.º 10
0
        public LoginDialog()
        {
            Title = "Login";

            Padding = 10;

            name     = new TextBox();
            password = new PasswordBox {
                Width = 100
            };

            Content = new StackLayout
            {
                Items =
                {
                    new Label {
                        Text = "Name"
                    },
                    name,
                    new Label {
                        Text = "Password"
                    },
                    password,
                }
            };

            // buttons
            DefaultButton = new Button {
                Text = "Login"
            };
            PositiveButtons.Add(DefaultButton);

            DefaultButton.Click += (sender, e) =>
            {
                //Setting properties to be able to get these string out of the dialog
                string userName     = name.Text;
                string userPassword = password.Text;
                Close();
            };

            AbortButton = new Button {
                Text = "C&ancel"
            };
            AbortButton.Click += (sender, e) => Close();
            NegativeButtons.Add(AbortButton);
        }
        public ChangePasswordDialog()
        {
            Title   = "Change Password";
            Padding = 10;

            RecoveryCode = new TextBox();
            NewPassword  = new PasswordBox {
                Width = 100
            };

            Content = new StackLayout
            {
                Items =
                {
                    new Label {
                        Text = "Recovery Code"
                    },
                    RecoveryCode,
                    new Label {
                        Text = "New Password"
                    },
                    NewPassword,
                }
            };

            // buttons
            DefaultButton = new Button {
                Text = "Change"
            };
            PositiveButtons.Add(DefaultButton);

            DefaultButton.Click += (sender, e) =>
            {
                Close();
            };

            AbortButton = new Button {
                Text = "C&ancel"
            };
            AbortButton.Click += (sender, e) => Close();
            NegativeButtons.Add(AbortButton);
        }
        void InitializeComponent()
        {
            Title     = "Preferences";
            Padding   = MasterPadding;
            Resizable = true;

            Content = new TabControl
            {
                BackgroundColor = SystemColors.ControlBackground,
                Pages           =
                {
                    BuildControlsTab()
                }
            };

            PositiveButtons.Add(new Button {
                Text = "OK"
            });
            NegativeButtons.Add(new Button {
                Text = "Cancel"
            });
        }
Exemplo n.º 13
0
        public CacheDialog(ManagerForm managerForm)
        {
            Title = "Log cache - arcdps Log Manager";
            var formLayout = new DynamicLayout();

            var item = new Button {
                Text = "Close"
            };

            item.Click += (sender, args) => Close();
            PositiveButtons.Add(item);

            var deleteButton = new Button
            {
                Text = "Delete the cache",
            };

            var pruneButton = new Button
            {
                Text = "Prune missing logs",
            };

            var countLabel = new Label {
                Text = "Not loaded"
            };
            var unloadedCountLabel = new Label {
                Text = "Not loaded"
            };
            var sizeLabel = new Label {
                Text = "No file"
            };

            formLayout.BeginVertical(new Padding(10), new Size(0, 0));
            {
                // This is a very hacky solution for WrapMode.Word not working properly on the Gtk platform
                formLayout.AddRow(new Label
                {
                    Text = "The processed contents of logs are saved in a cache file to save time. You can",
                    Wrap = WrapMode.None
                });
                formLayout.AddRow(new Label
                {
                    Text = "delete the cached results here to process the logs again or prune results for",
                    Wrap = WrapMode.None
                });
                formLayout.AddRow(new Label
                {
                    Text = "logs that are not in the scanned directory anymore.",
                    Wrap = WrapMode.None
                });
            }
            formLayout.EndVertical();
            formLayout.BeginVertical(new Padding(10), new Size(5, 5));
            {
                UpdateLabelTexts(managerForm, countLabel, unloadedCountLabel, sizeLabel);
                formLayout.AddRow(new Label {
                    Text = "Total cached logs:"
                }, countLabel);
                formLayout.AddRow(new Label {
                    Text = "Unloaded cached logs:"
                }, unloadedCountLabel);
                formLayout.AddRow(new Label {
                    Text = "Cache file size:"
                }, sizeLabel);
            }
            formLayout.EndVertical();
            formLayout.BeginVertical(new Padding(10), new Size(5, 5));
            {
                formLayout.AddRow(pruneButton);
                formLayout.AddRow(deleteButton);
            }
            formLayout.EndVertical();

            pruneButton.Click += (sender, args) =>
            {
                int unloadedLogs = managerForm.LogCache?.GetUnloadedLogCount(managerForm.LoadedLogs) ?? 0;
                if (MessageBox.Show(
                        $"Prune the cache? {unloadedLogs} results of currently unloaded logs will be forgotten. " +
                        "If the logs are added back in the future, they will have to be processed again.",
                        MessageBoxButtons.OKCancel) == DialogResult.Ok)
                {
                    int pruned = managerForm.LogCache?.Prune(managerForm.LoadedLogs) ?? 0;
                    MessageBox.Show($"Cache pruned, {pruned} results forgotten.");
                    managerForm.LogCache?.SaveToFile();
                    UpdateLabelTexts(managerForm, countLabel, unloadedCountLabel, sizeLabel);
                    managerForm.ReloadLogs();
                }
            };

            deleteButton.Click += (sender, args) =>
            {
                int logCount = managerForm.LogCache?.LogCount ?? 0;
                if (MessageBox.Show(
                        $"Delete the cache? The results of all {logCount} cached logs will be forgotten. " +
                        "All logs will have to be processed again.",
                        MessageBoxButtons.OKCancel) == DialogResult.Ok)
                {
                    managerForm.LogCache?.Clear();
                    managerForm.LogCache?.SaveToFile();
                    MessageBox.Show($"Cache deleted, {logCount} results forgotten.");
                    UpdateLabelTexts(managerForm, countLabel, unloadedCountLabel, sizeLabel);
                    managerForm.ReloadLogs();
                }
            };

            UpdateLabelTexts(managerForm, countLabel, unloadedCountLabel, sizeLabel);

            Content = formLayout;
        }
Exemplo n.º 14
0
        public ManualInstallDialog()
        {
            WebView2Loader.CenterDialog(this);
            string Loc(string str) => Application.Instance.Localize(typeof(WebView2Loader), str);

            Title = Loc("Install WebView2 Runtime");

            MinimumSize = new Size(300, 200);

            // controls

            var installButton = new Button {
                Text = Loc("Download && Install Now")
            };

            installButton.Click += OnInstall;

            var downloadButton = new LinkButton {
                Text = Loc("Open the WebView2 download page to install manually")
            };

            downloadButton.Click += OnDownload;

            var cancelButton = new Button {
                Text = Loc("Fallback to IE")
            };

            cancelButton.Click += OnCancel;

            var description = new Label
            {
                TextAlignment = TextAlignment.Center,
                Text          = Loc("This application requires the Microsoft Edge WebView2 Runtime.\nPlease install it to continue.")
            };

            // layout

            var layout = new DynamicLayout {
                Padding = 10, DefaultSpacing = new Size(5, 5)
            };

            layout.AddSpace();
            layout.Add(description);
            layout.AddSpace();

            layout.AddSeparateRow(null, downloadButton);

            Content = layout;

            DefaultButton = installButton;
            PositiveButtons.Add(installButton);
            NegativeButtons.Add(cancelButton);

            Shown += (sender, e) => installButton.Focus();

            timer = new UITimer {
                Interval = 1.0
            };
            timer.Elapsed += timer_Elapsed;
            timer.Start();
        }
        private void InitializeComponent()
        {
            Title       = "New File";
            DisplayMode = DialogDisplayMode.Attached;
            Size        = new Size(370, 285);
            MinimumSize = new Size(370, 200);
            Resizable   = true;

            buttonCreate = new Button
            {
                Text = "Create"
            };
            PositiveButtons.Add(buttonCreate);
            DefaultButton = buttonCreate;

            buttonCancel = new Button
            {
                Text = "Cancel"
            };
            NegativeButtons.Add(buttonCancel);
            AbortButton = buttonCancel;

            layout1 = new DynamicLayout
            {
                Padding = new Padding(6)
            };

            table1 = new TableLayout(2, 3)
            {
                Spacing = new Size(4, 4)
            };

            labelName = new Label
            {
                Text = "Name: ",
                VerticalAlignment = VerticalAlignment.Center
            };
            table1.Add(labelName, 0, 0, false, false);

            layout2 = new DynamicLayout
            {
                DefaultSpacing = new Size(4, 4)
            };
            layout2.BeginHorizontal();

            textBox1 = new TextBox();
            layout2.Add(textBox1, true, true);

            labelExt = new Label
            {
                Text = " .spriteFont",
                VerticalAlignment = VerticalAlignment.Center,
                Width             = 80
            };
            layout2.Add(labelExt, false, true);

            table1.Add(layout2, 1, 0, true, false);

            labelType = new Label
            {
                Text = "Type: ",
                VerticalAlignment = VerticalAlignment.Top
            };
            table1.Add(labelType, 0, 1, false, true);

            list1 = new ListBox();
            table1.Add(list1, 1, 1, true, true);

            layout1.Add(table1, true, true);

            labelError = new Label
            {
                TextAlignment = TextAlignment.Center
            };
            table1.Add(labelError, 1, 2, true, false);

            layout1.Add(labelError, true, false);

            Content = layout1;

            textBox1.TextChanged       += TextBox1_TextChanged;
            list1.SelectedIndexChanged += List1_SelectedIndexChanged;
            buttonCreate.Click         += ButtonCreate_Click;
            buttonCancel.Click         += ButtonCancel_Click;
        }
Exemplo n.º 16
0
        public RegisterDialog()
        {
            Title = "Register";
            TextBox     firstName = new TextBox();
            TextBox     lastName  = new TextBox();
            PasswordBox password  = new PasswordBox {
                Width = 100
            };

            Content = new StackLayout
            {
                Padding = 10,
                Items   =
                {
                    new Label {
                        Text = "First Name"
                    },
                    firstName,
                    new Label {
                        Text = "Last Name"
                    },
                    lastName,
                    new Label {
                        Text = "Password"
                    },
                    password,
                }
            };


            // buttons
            DefaultButton = new Button {
                Text = "Register"
            };
            PositiveButtons.Add(DefaultButton);

            DefaultButton.Click += (sender, e) =>
            {
                //Opening a save file dialog
                SaveFileDialog saveFile = new SaveFileDialog();
                if (saveFile.ShowDialog(this) == DialogResult.Ok)
                {
                    //After dialog is closed program encrypts user data and writes it to the specified file
                    string fileName        = saveFile.FileName;
                    string passPhrase      = Cryptography.GetUniqueKey(6);
                    string recoveryCode    = Cryptography.GetRecoveryCode(6);
                    string encRecoveryCode = Cryptography.Encrypt(recoveryCode, passPhrase);
                    string encFirstName    = Cryptography.Encrypt(firstName.Text, passPhrase);
                    string encLastName     = Cryptography.Encrypt(lastName.Text, passPhrase);
                    string encPassword     = Cryptography.Encrypt(password.Text, passPhrase);

                    System.IO.File.WriteAllText(fileName, (passPhrase + "-"));
                    System.IO.File.AppendAllText(fileName, (encFirstName + "-"));
                    System.IO.File.AppendAllText(fileName, (encLastName + "-"));
                    System.IO.File.AppendAllText(fileName, (encPassword + "-"));
                    System.IO.File.AppendAllText(fileName, (encRecoveryCode + "-"));
                    MessageBox.Show(this, "Registered Succesfully!\nYour recovery code is: " + recoveryCode);
                }
                Close();
            };

            AbortButton = new Button {
                Text = "C&ancel"
            };
            AbortButton.Click += (sender, e) => Close();
            NegativeButtons.Add(AbortButton);
        }
Exemplo n.º 17
0
        public AddDialog()
        {
            Title   = "Add";
            Padding = 10;

            Name = new TextBox();
            CryptocurrencyName = new TextBox();
            Address            = new TextBox();
            PublicKey          = new TextBox();
            PrivateKey         = new TextBox();
            PassPhrase         = new TextBox();
            WordCode           = new TextBox();

            Content = new StackLayout
            {
                Items =
                {
                    new Label {
                        Text = "Name"
                    },
                    Name,
                    new Label {
                        Text = "Cryptocurrency Name"
                    },
                    CryptocurrencyName,
                    new Label {
                        Text = "Address"
                    },
                    Address,
                    new Label {
                        Text = "Public Key"
                    },
                    PublicKey,
                    new Label {
                        Text = "Private Key"
                    },
                    PrivateKey,
                    new Label {
                        Text = "Pass Phrase"
                    },
                    PassPhrase,
                    new Label {
                        Text = "Word Code"
                    },
                    WordCode,
                }
            };

            // buttons
            DefaultButton = new Button {
                Text = "OK"
            };
            PositiveButtons.Add(DefaultButton);

            DefaultButton.Click += (sender, e) =>
            {
                Close();
            };

            AbortButton = new Button {
                Text = "C&ancel"
            };
            AbortButton.Click += (sender, e) => Close();
            NegativeButtons.Add(AbortButton);
        }
Exemplo n.º 18
0
        public ApiDialog(ApiData apiData)
        {
            Title      = "API data - arcdps Log Manager";
            ClientSize = new Size(300, -1);
            var formLayout = new DynamicLayout();

            Content = formLayout;

            var item = new Button {
                Text = "Close"
            };

            item.Click += (sender, args) => Close();
            PositiveButtons.Add(item);

            var deleteButton = new Button
            {
                Text = "Delete the cache",
            };

            var enableCheckbox = new CheckBox {
                Text = "Use the GW2 API", Checked = Settings.UseGW2Api
            };

            enableCheckbox.CheckedChanged += (sender, args) => Settings.UseGW2Api = enableCheckbox.Checked ?? false;

            var guildCountLabel = new Label {
                Text = "Not loaded"
            };
            var sizeLabel = new Label {
                Text = "No file"
            };

            UpdateLabelTexts(apiData, guildCountLabel, sizeLabel);

            formLayout.BeginVertical(new Padding(10), new Size(5, 5));
            {
                formLayout.AddRow(new Label
                {
                    Text = "Guild names and tags have to be loaded from the official GW2 API as\n" +
                           "the EVTC logs only contain GUID values."
                });
            }
            formLayout.EndVertical();
            formLayout.BeginVertical(new Padding(10), new Size(5, 5));
            {
                formLayout.AddRow(new Label {
                    Text = "Guilds:"
                }, guildCountLabel);
                formLayout.AddRow(new Label {
                    Text = "Cache file size:"
                }, sizeLabel);
            }
            formLayout.EndVertical();
            formLayout.BeginVertical(new Padding(10), new Size(5, 5));
            {
                formLayout.AddRow(enableCheckbox);
                formLayout.AddRow(deleteButton);
            }
            formLayout.EndVertical();

            void OnGuildAdded(object sender, EventArgs _)
            {
                Application.Instance.AsyncInvoke(() => { UpdateLabelTexts(apiData, guildCountLabel, sizeLabel); });
            }

            deleteButton.Click += (sender, args) =>
            {
                if (MessageBox.Show(
                        $"Delete the API cache? The API data of all {apiData.CachedGuildCount} guilds will be " +
                        "forgotten. Renamed guilds will have their names/tags updated, but data of disbanded " +
                        "guilds won't be retrievable anymore. You may have to restart the program for " +
                        "everything to update.",
                        MessageBoxButtons.OKCancel) == DialogResult.Ok)
                {
                    apiData.Clear();
                    apiData.SaveDataToFile();
                    MessageBox.Show("API Cache deleted.");
                    UpdateLabelTexts(apiData, guildCountLabel, sizeLabel);
                }
            };

            apiData.GuildAdded += OnGuildAdded;

            Closed += (sender, args) => apiData.GuildAdded -= OnGuildAdded;
        }
Exemplo n.º 19
0
        public ProgramUpdateDialog(Release release)
        {
            Title      = $"Update available";
            ClientSize = new Size(-1, -1);
            var layout = new DynamicLayout();

            Content = layout;

            var changelog = new Button {
                Text = "View changes"
            };
            var later = new Button {
                Text = "Later"
            };
            var ignore = new Button {
                Text = "Ignore"
            };
            var download = new Button {
                Text = "Download"
            };

            layout.BeginVertical(new Padding(10), new Size(10, 10));
            {
                layout.AddRow(new Label
                {
                    Text = $"Log Manager {release.Version} is available for download."
                });
                layout.AddRow(changelog);
            }
            layout.EndVertical();

            later.Click  += (sender, args) => Close();
            ignore.Click += (sender, args) =>
            {
                Settings.IgnoredUpdateVersions = Settings.IgnoredUpdateVersions.Append(release.Version).Distinct().ToList();
                Close();
            };
            changelog.Click += (sender, args) =>
            {
                var processInfo = new ProcessStartInfo()
                {
                    FileName        = release.ChangelogUrl,
                    UseShellExecute = true
                };
                Process.Start(processInfo);
            };
            download.Click += (sender, args) =>
            {
                var processInfo = new ProcessStartInfo()
                {
                    FileName        = release.ToolSiteUrl,
                    UseShellExecute = true
                };
                Process.Start(processInfo);
                Close();
            };

            AbortButton   = later;
            DefaultButton = download;
            PositiveButtons.Add(download);
            NegativeButtons.Add(later);
            NegativeButtons.Add(ignore);
        }
Exemplo n.º 20
0
        private void InitializeComponent()
        {
            Title       = "Select Folder";
            DisplayMode = DialogDisplayMode.Attached;
            Size        = new Size(400, 200);

            buttonOk      = new Button();
            buttonOk.Text = "Ok";
            PositiveButtons.Add(buttonOk);
            DefaultButton = buttonOk;

            buttonCancel      = new Button();
            buttonCancel.Text = "Cancel";
            NegativeButtons.Add(buttonCancel);
            AbortButton = buttonCancel;

            layout1 = new DynamicLayout();
            layout1.DefaultSpacing = new Size(4, 4);
            layout1.Padding        = new Padding(6);
            layout1.BeginVertical();

            layout1.Add(null, true, true);

            label1      = new Label();
            label1.Text = "Path to use:";
            layout1.Add(label1);

            stack1             = new StackLayout();
            stack1.Spacing     = 4;
            stack1.Orientation = Orientation.Horizontal;

            textBox1 = new TextBox();
            stack1.Items.Add(new StackLayoutItem(textBox1, VerticalAlignment.Center, true));

            buttonBrowse             = new Button();
            buttonBrowse.Text        = "...";
            buttonBrowse.MinimumSize = new Size(1, 1);
            stack1.Items.Add(new StackLayoutItem(buttonBrowse, VerticalAlignment.Center, false));

            layout1.Add(stack1);

            label2      = new Label();
            label2.Text = "Macros:";
            layout1.Add(label2);

            stack2             = new StackLayout();
            stack2.Spacing     = 4;
            stack2.Orientation = Orientation.Horizontal;

            foreach (var symbol in symbols)
            {
                var buttonSymbol = new Button();
                buttonSymbol.Text   = symbol;
                buttonSymbol.Click += ButtonSymbol_Click;
                stack2.Items.Add(new StackLayoutItem(buttonSymbol, true));
            }

            layout1.Add(stack2);

            layout1.Add(null, true, true);

            Content = layout1;

            textBox1.TextChanged += TextBox1_TextChanged;
            buttonBrowse.Click   += ButtonBrowse_Click;
            buttonOk.Click       += ButtonOk_Click;
            buttonCancel.Click   += ButtonCancel_Click;
        }
        void InitializeComponent()
        {
            Title     = "Preferences";
            Padding   = MasterPadding;
            Resizable = true;

            // Uncommenting this line will cause the spawned TestDialog to be blank.
            //Size = new Size(300, 550);

            var lbxFgd = new ListBox()
            {
                AllowDrop = true
            };

            lbxFgd.Items.Add("test/quake4ericwTools.fgd");
            lbxFgd.Items.Add("test/func_instance.fgd");

            var btnAddFgd = new Button {
                Text = "Add..."
            };
            var btnRemoveFgd = new Button {
                Text = "Remove"
            };

            var btnFgdCombineStack = new RadioButton {
                Text = "Stack", Checked = true
            };
            var btnFgdCombineBlend = new RadioButton(btnFgdCombineStack)
            {
                Text = "Blend"
            };

            var layoutFgdAddRemove = new TableLayout(2, 1)
            {
                Spacing = new Size(MasterPadding, 0)
            };

            layoutFgdAddRemove.Add(btnAddFgd, 0, 0);
            layoutFgdAddRemove.Add(btnRemoveFgd, 1, 0);

            var tblFgdCombine = new TableLayout(2, 1)
            {
                Spacing = new Size(MasterPadding, 0)
            };

            tblFgdCombine.Add(btnFgdCombineStack, 0, 0);
            tblFgdCombine.Add(btnFgdCombineBlend, 1, 0);

            var stkFgd = new StackLayout
            {
                Spacing = MasterPadding,
                HorizontalContentAlignment = HorizontalAlignment.Center,
                Items =
                {
                    layoutFgdAddRemove,
                    tblFgdCombine
                }
            };

            var tblFgd = new TableLayout(1, 2)
            {
                Spacing = new Size(0, MasterPadding)
            };

            tblFgd.Add(lbxFgd, 0, 0);
            tblFgd.Add(stkFgd, 0, 1);

            tblFgd.SetRowScale(0, true);
            tblFgd.SetRowScale(1, false);

            var gbxFgd = new GroupBox
            {
                Padding = new Padding(MasterPadding, MasterPadding, MasterPadding, 0),
                Text    = "Entity definition files",
                Content = tblFgd,
                ID      = "gbxFgd"
            };

            var lbxWad = new ListBox()
            {
                AllowDrop = true
            };

            lbxWad.Items.Add("test/quake.wad");
            lbxWad.Items.Add("test/jam6_tens.wad");

            var btnAddWad = new Button {
                Text = "Add..."
            };
            var btnRemoveWad = new Button {
                Text = "Remove"
            };

            var tblWadAddRemove = new TableLayout(2, 1)
            {
                Spacing = new Size(MasterPadding, 0)
            };

            tblWadAddRemove.Add(btnAddWad, 0, 0);
            tblWadAddRemove.Add(btnRemoveWad, 1, 0);

            var stkWad = new StackLayout
            {
                Spacing = MasterPadding,
                HorizontalContentAlignment = HorizontalAlignment.Center,
                Items =
                {
                    tblWadAddRemove
                }
            };

            var tblPalette = new TableLayout(2, 1)
            {
                Spacing = new Size(MasterPadding, 0)
            };

            tblPalette.Add(new Label {
                Text = "Palette:", VerticalAlignment = VerticalAlignment.Center
            }, 0, 0);
            tblPalette.Add(new FilePicker()
            {
                FileAction = Eto.FileAction.OpenFile
            }, 1, 0);

            var tblWad = new TableLayout(1, 3)
            {
                Spacing = new Size(0, MasterPadding)
            };

            tblWad.Add(lbxWad, 0, 0);
            tblWad.Add(stkWad, 0, 1);
            tblWad.Add(tblPalette, 0, 2);

            tblWad.SetRowScale(0, true);
            tblWad.SetRowScale(1, false);
            tblWad.SetRowScale(2, false);

            var gbxWad = new GroupBox
            {
                Padding = new Padding(MasterPadding, MasterPadding, MasterPadding, 0),
                Text    = "Texture collections",
                Content = tblWad,
                ID      = "gbxWad"
            };

            var tblMaster = new TableLayout(1, 2);

            tblMaster.Add(gbxFgd, 0, 0);
            tblMaster.Add(gbxWad, 0, 1);

            tblMaster.SetRowScale(0, true);
            tblMaster.SetRowScale(1, true);

            Content = new TabControl
            {
                BackgroundColor = SystemColors.ControlBackground,
                Pages           =
                {
                    new TabPage {
                        Padding = MasterPadding, Text = "Resources", Content = tblMaster
                    },
                    new TabPage {
                        Text = "Controls"
                    }
                }
            };

            var cmdOK = new Command();

            cmdOK.Executed += (sender, e) => Close();

            var cmdCancel = new Command();

            cmdCancel.Executed += (sender, e) => Close();

            PositiveButtons.Add(new Button {
                Text = "OK", Command = cmdOK
            });
            NegativeButtons.Add(new Button {
                Text = "Cancel", Command = cmdCancel
            });
        }
Exemplo n.º 22
0
        public StartDialog()
        {
            GetWallets = new List <Wallet>();

            Title = "Cryptocompanion";


            Content = new StackLayout
            {
                Padding = 10,
                Items   =
                {
                }
            };


            // buttons
            DefaultButton = new Button {
                Text = "Login"
            };
            RegisterButton = new Button {
                Text = "Register"
            };
            PositiveButtons.Add(DefaultButton);
            PositiveButtons.Add(RegisterButton);

            AbortButton = new Button {
                Text = "Quit"
            };
            AbortButton.Click += (sender, e) => Application.Instance.Quit();
            NegativeButtons.Add(AbortButton);

            DefaultButton.Click += (sender, e) =>
            {
                LoginCheck = false;
                //Opening a user specified file and reading it to the end
                user = new User();
                OpenFileDialog fileDialog = new OpenFileDialog();
                if (fileDialog.ShowDialog(this) == DialogResult.Ok)
                {
                    string fileName;
                    fileName = fileDialog.FileName;
                    string fileContent;
                    using (System.IO.StreamReader sr = System.IO.File.OpenText(fileName))
                    {
                        fileContent = sr.ReadToEnd();
                    }
                    //If file isn't empty and user data is correct then it is decrypted
                    if (!String.IsNullOrEmpty(fileContent))
                    {
                        var content = fileContent.Split('-');
                        if (content.Length > 1)
                        {
                            PassPhrase = content[0];
                            string decFirstName    = Cryptography.Decrypt(content[1], PassPhrase);
                            string decLastName     = Cryptography.Decrypt(content[2], PassPhrase);
                            string decPassword     = Cryptography.Decrypt(content[3], PassPhrase);
                            string decRecoveryCode = Cryptography.Decrypt(content[4], PassPhrase);

                            user.FirstName    = decFirstName;
                            user.LastName     = decLastName;
                            user.Password     = decPassword;
                            user.RecoveryCode = decRecoveryCode;

                            //Split encrypted file content into wallet objects and set decrypted properties, that are also a product of split
                            var objects = content[5].Split('*');
                            if (objects.Length > 0)
                            {
                                foreach (var obj in objects)
                                {
                                    var items = obj.Split('_');
                                    if (items.Length > 1)
                                    {
                                        Wallet wallet = new Wallet
                                        {
                                            Name               = Cryptography.Decrypt(items[0], PassPhrase),
                                            Address            = Cryptography.Decrypt(items[1], PassPhrase),
                                            CryptocurrencyName = Cryptography.Decrypt(items[2], PassPhrase),
                                            PassPhrase         = Cryptography.Decrypt(items[3], PassPhrase),
                                            WordCode           = Cryptography.Decrypt(items[4], PassPhrase),
                                            PublicKey          = Cryptography.Decrypt(items[5], PassPhrase),
                                            PrivateKey         = Cryptography.Decrypt(items[6], PassPhrase),
                                        };
                                        GetWallets.Add(wallet);
                                    }
                                }
                            }
                        }
                    }
                    //Open a login dialog that authenticates user
                    LoginDialog login = new LoginDialog();
                    login.ShowModal(this);
                    if (login.UserName == (user.FirstName + " " + user.LastName) && login.UserPassword == user.Password)
                    {
                        MessageBox.Show(this, "Login Succesful!");
                        LoginCheck = true;
                    }
                    Close();
                }
            };

            RegisterButton.Click += (sender, e) => new RegisterDialog().ShowModal();
        }
Exemplo n.º 23
0
        public CreateSchemaObjectDialog()
        {
            model       = new CSOViewModel();
            DataContext = model;

            Title     = "Create an Object by Schema";
            Padding   = 5;
            Resizable = true;

            types         = ListAvailableTypes();
            typesFiltered = types;

            search = new SearchBox
            {
                PlaceholderText = "Search for a schema class"
            };
            search.Focus();
            search.TextChanged += Search_TextChanged;


            //list = new ListBox
            //{
            //  Size = new Size(200, 200),
            //  ItemTextBinding = Binding.Property<Type, string>(x => x.Name),
            //  DataStore = typesFiltered,
            //  SelectedIndex = 0
            //};
            //list.SelectedIndexBinding.BindDataContext((CSOViewModel m) => m.SelectedIndex, DualBindingMode.OneWayToSource);
            //list.SelectedValueBinding.BindDataContext((CSOViewModel m) => m.SelectedType, DualBindingMode.OneWayToSource);


            tree = new TreeGridView {
                Size = new Size(300, 200)
            };
            tree.Columns.Add(new GridColumn {
                DataCell = new TextBoxCell(0)
            });
            tree.DataStore = GenerateTree();
            tree.BindDataContext(x => x.SelectedItem, (CSOViewModel m) => m.SelectedItem, DualBindingMode.OneWayToSource);

            description = new TextArea
            {
                ReadOnly = true,
                Size     = new Size(400, 200)
            };

            description.TextBinding.BindDataContext(Binding.Property((CSOViewModel m) => m.SelectedItem).
                                                    Convert(x => GetDescription(x)), DualBindingMode.OneWay);

            Content = new TableLayout
            {
                Spacing = new Size(5, 5),
                Padding = new Padding(10),
                Rows    =
                {
                    new TableRow(search),
                    new TableRow(tree,   description),
                }
            };

            // buttons
            DefaultButton = new Button {
                Text = "Create"
            };
            DefaultButton.BindDataContext(x => x.Enabled, Binding.Property((CSOViewModel m) => m.SelectedItem)
                                          .Convert(x => x != null && x.Tag != null), DualBindingMode.OneWay);

            DefaultButton.Click += (sender, e) =>
            {
                HasResult = true;
                Close();
            };
            PositiveButtons.Add(DefaultButton);

            AbortButton = new Button {
                Text = "C&ancel"
            };
            AbortButton.Click += (sender, e) => Close();
            NegativeButtons.Add(AbortButton);
        }