Пример #1
0
        protected override void OnSelectionChanged(SelectionChangedEventArgs e)
        {
            base.OnSelectionChanged(e);

            selected_serverinfo_textblock = this.SelectedItem as ServerInfoTextBlock;
            if (selected_serverinfo_textblock == null)
            {
                if (CommandView.current != null)
                {
                    CommandView.current.Visibility = Visibility.Hidden;
                }
                return;
            }

            if (ServerCommand.current != null)
            {
                ServerCommand.current.Visibility = Visibility.Visible;
                ServerCommand.current.Refresh(selected_serverinfo_textblock.serverinfo);
            }

            if (WindowMain.current != null)
            {
                WindowMain.current.Refresh(selected_serverinfo_textblock.serverinfo.name);
            }
        }
Пример #2
0
        protected override void OnMouseDoubleClick(MouseButtonEventArgs e)
        {
            base.OnMouseDoubleClick(e);
            if (e.ChangedButton == MouseButton.Left)
            {
                ServerInfoTextBlock sitb = this.SelectedItem as ServerInfoTextBlock;
                if (sitb == null)
                {
                    return;
                }

                Window_AddServer wms = new Window_AddServer();
                wms.textBox_name.Text         = sitb.serverinfo.name;
                wms.textBox_ip.Text           = sitb.serverinfo.ip;
                wms.textBox_id.Text           = sitb.serverinfo.id;
                wms.textBox_password.Password = sitb.serverinfo.password;

                Point pt = this.PointToScreen(new Point(0, 0));
                wms.Left = pt.X;
                wms.Top  = pt.Y;
                if (wms.ShowDialog() == true)
                {
                    JObject jobj = ServerInfo.jobj_root[parent.Content] as JObject;
                    if (jobj == null)
                    {
                        return;
                    }

                    // JProperty 바꾸기
                    JProperty newprop = ServerInfo.ConvertToJson(new ServerInfo(wms.textBox_name.Text, wms.textBox_ip.Text, wms.textBox_id.Text, wms.textBox_password.Password));
                    jobj[ServerList.selected_serverinfo_textblock.serverinfo.name].Parent.Replace(newprop);

                    if (!ServerInfo.save())
                    {
                        return;
                    }

                    sitb.Text                = sitb.serverinfo.name = wms.textBox_name.Text;
                    sitb.serverinfo.ip       = wms.textBox_ip.Text;
                    sitb.serverinfo.id       = wms.textBox_id.Text;
                    sitb.serverinfo.password = wms.textBox_password.Password;
                }
            }
        }
Пример #3
0
        private void BtnAddServer_Click(object sender, RoutedEventArgs e)
        {
            Window_AddServer wms = new Window_AddServer();
            Point            pt  = this.PointToScreen(new Point(0, 0));

            wms.Left = pt.X;
            wms.Top  = pt.Y;
            if (wms.ShowDialog() == true)
            {
                string name     = wms.textBox_name.Text;
                string ip       = wms.textBox_ip.Text;
                string id       = wms.textBox_id.Text;
                string password = wms.textBox_password.Password;


                try
                {
                    JObject jobj = ServerInfo.jobj_root[this.Content] as JObject;
                    if (jobj == null)
                    {
                        return;
                    }

                    ServerInfoTextBlock si = new ServerInfoTextBlock(name, ip, id, password);
                    jobj.Add(ServerInfo.ConvertToJson(si.serverinfo));

                    if (!ServerInfo.save())
                    {
                        return;
                    }

                    this.child.Items.Add(si);
                }
                catch (Exception ex)
                {
                    Log.PrintError(ex.Message, "Add Server");
                    Log.PrintError("서버 이름이 중복됩니다.\r", "Add Server", Status.current.richTextBox_status);
                }
            }
        }