예제 #1
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));
                    this.child.Items.Add(si);
                    ServerInfo.save();
                }
                catch (Exception ex)
                {
                    //Log.PrintError(ex.Message, "Add Server", Home.m_wnd.richTextBox_status);
                    Log.PrintError("서버 이름이 중복됩니다.\r", "Add Server", Home.m_wnd.richTextBox_status);
                }
            }
        }
예제 #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)
                {
                    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;

                    ServerInfo.save();
                }
            }
        }