Beispiel #1
0
        private void MenuElement_Box_Click(object sender, RoutedEventArgs e)
        {
            MenuElement menu = (MenuElement)sender;

            switch (menu.Header.ToString())
            {
            case "Add connection":
                RedisServerWindow redisServerWindow = new RedisServerWindow();
                redisServerWindow.ShowDialog();
                break;

            default:
                break;
            }
        }
Beispiel #2
0
        /// <summary>
        /// TopButton event
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void TopButton_Click(object sender, RoutedEventArgs e)
        {
            TopButton topButton = (TopButton)sender;

            if (null == topButton)
            {
                return;
            }
            switch (topButton.Name)
            {
            case "btnAddConnection":
                RedisServerWindow redisServerWindow = new RedisServerWindow();
                redisServerWindow.ShowDialog();
                break;
            }
        }
Beispiel #3
0
        /// <summary>
        /// server context-menu item click event
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void MenuElement_Server_Click(object sender, RoutedEventArgs e)
        {
            MenuElement item        = (MenuElement)sender;
            ContextMenu menu        = (ContextMenu)item.Parent;
            string      uid         = (string)menu.Tag;
            RedisServer redisServer = RedisUtils.getRedisServer(uid);

            if (null == redisServer)
            {
                return;
            }
            TreeViewItem viewItem = (TreeViewItem)redisServerBox.ItemContainerGenerator.ContainerFromItem(redisServer);

            viewItem.IsSelected = true;

            switch (item.Header.ToString())
            {
            case "Connection":
            case "Reload":
                redisRestconnection(redisServer);
                break;

            case "Disconnection":
                redisQuitConnection(redisServer);
                break;

            case "Delete":
                redisQuitConnection(redisServer);
                redisServer.RedisClient.Dispose();
                App.redisServers.Remove(redisServer);
                ConfigUtils.saveConfig();
                break;

            case "Edit":
                redisQuitConnection(redisServer);
                RedisServerWindow editServerWindow = new RedisServerWindow();
                RedisConnection   conn             = (RedisConnection)redisServer.Connection.Clone();
                editServerWindow.Server = redisServer;
                editServerWindow.ShowDialog();
                break;

            default:
                break;
            }
        }