Beispiel #1
0
        public void TransitionToScreen(Screen screen)
        {
            ScreenToTransitionTo = screen;
            IsTransitioning      = true;
            TransitionStartTime  = DateTime.Now;

            // We're transitioning screens, so any active menus should be disposed
            ContextMenus.Clear();

            // We don't want to force close popups though, because they may be waiting for input
            // the screen should handle this occurance for safety
        }
Beispiel #2
0
        static void Main()
        {
            ContextMenus a = new ContextMenus();

            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);
            using (ProcessIcon pi = new ProcessIcon())
            {
                if (a.actvate)
                {
                    pi.Display();
                }
                // Make sure the application runs!
                Application.Run();
            }
        }
Beispiel #3
0
        private static void OnObjectChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
        {
            if (d is ButtonBase element && e.NewValue is ICupSupportedObject newValue)
            {
                element.PreviewMouseLeftButtonUp -= OnButtonMouseUp;
                element.PreviewMouseLeftButtonUp += OnButtonMouseUp;

                element.Command = new AsyncCommand(() => CupClient.Instance?.InstallUpdateAsync(newValue.CupContentType, newValue.Id));
                element.SetBinding(UIElement.VisibilityProperty, new Binding {
                    Path      = new PropertyPath(nameof(newValue.IsCupUpdateAvailable)),
                    Converter = new BooleanToVisibilityConverter(),
                    Source    = newValue
                });

                ToolTips.SetCupUpdate(d, newValue);
                ContextMenus.SetCupUpdate(d, newValue);
            }
Beispiel #4
0
        private void myRubberBand_Closed(object sender, EventArgs e)
        {
            bool handled = ZoomTo(myZoomStartPoint, Mouse.GetPosition(myGraphVisual), false);

            if (handled)
            {
                return;
            }

            var key = GraphItemForContextMenu != null?GraphItemForContextMenu.GetType().Name : "Default";

            ContextMenu menu = null;

            ContextMenus.TryGetValue(key, out menu);
            ContextMenu = menu;

            if (ContextMenu == null)
            {
                return;
            }

            ContextMenu.PlacementTarget = this;
            ContextMenu.IsOpen          = true;
        }
Beispiel #5
0
        public void TestInitialize()
        {
            var timeProvider = TestUtils.MockTimeProvider();

            _contextMenus = new ContextMenus(new StatusService(new StatusDateTime(timeProvider), new RandomMinuteGenerator(timeProvider)));
        }
        private void btn_upgrade_Click_1(object sender, EventArgs e)
        {
            Cursor oCursor = Cursors.WaitCursor;

            try
            {
                if (rdb_OD.Checked || rdb_FD.Checked || rdb_PW.Checked)
                {
                    if (string.IsNullOrEmpty(txtdatabase.Text) || string.IsNullOrEmpty(txtserver.Text) || string.IsNullOrEmpty(txtusername.Text))
                    {
                        oCursor = Cursors.Default;
                        MessageBox.Show("Please enter database details.", "HRDsq Plugin", MessageBoxButtons.OK, MessageBoxIcon.Error);
                        return;
                    }
                    //  btn_upgrade.Enabled = false;

                    EnCryptDecryptEngine _objED = new EnCryptDecryptEngine();

                    if (File.Exists(AppDomain.CurrentDomain.BaseDirectory + "\\config.txt"))
                    {
                        File.Delete(AppDomain.CurrentDomain.BaseDirectory + "\\config.txt");
                    }

                    string dbcontents = "", port = "", server = "";

                    if (txtserver.Text.Contains(":"))
                    {
                        port = (txtserver.Text.Split(new string[] { ":" }, StringSplitOptions.None)[1]).Split(' ')[0].ToString();

                        server = (txtserver.Text.Split(new string[] { ":" }, StringSplitOptions.None)[0]).Split(' ')[0].ToString();
                    }
                    else
                    {
                        server = txtserver.Text;
                        port   = "3306";
                    }


                    string connection = "server=" + server + ";user id=" + txtusername.Text + "; password="******";database=" + txtdatabase.Text + ";SslMode=none" + ";" + "Port=" + port + ";" + "AllowZeroDateTime=True;" + "AllowUserVariables=True; pooling=false " + "";


                    Library.WriteErrorLog(connection + "jsdhvksv");
                    try
                    {
                        using (MySqlConnection con = new MySqlConnection(connection))
                        {
                            con.Open();
                        }
                    }
                    catch (Exception ex)
                    {
                        MessageBox.Show("Not able to connect to specified database.", "HRDsq Plugin", MessageBoxButtons.OK, MessageBoxIcon.Error);
                        return;
                    }

                    dbcontents = _objED.Encrypt(txtdatabase.Text.ToString().Trim(), true) + Environment.NewLine + _objED.Encrypt(server.Trim(), true) + Environment.NewLine + _objED.Encrypt(txtusername.Text.ToString().Trim(), true) + Environment.NewLine + _objED.Encrypt(txtpass.Text.ToString(), true) + Environment.NewLine + _objED.Encrypt(port.Trim(), true);

                    StreamWriter sw = null;

                    try
                    {
                        sw = new StreamWriter(AppDomain.CurrentDomain.BaseDirectory + "\\config.txt", true);
                        sw.WriteLine(dbcontents);
                        sw.Flush();
                        sw.Close();

                        ContextMenus cc = new ContextMenus();
                        cc.Restart_Click(null, null);
                        this.Close();
                    }

                    catch (Exception ex)
                    {
                        btn_upgrade.Enabled = true;
                        oCursor             = Cursors.Default;


                        MessageBox.Show("Something when wrong.." + Environment.NewLine + ex.Message + Environment.NewLine + ex.StackTrace, "HRDsq Plugin", MessageBoxButtons.OK, MessageBoxIcon.Error);
                        return;
                    }
                }
            }

            catch (Exception ex)
            {
                btn_upgrade.Enabled = true;
                Library.WriteErrorLog(ex.Message);
            }
        }