private void ModifyServer(object parameter) { ServerListBoxItem sip = this.SelectedItem as ServerListBoxItem; if (sip == null) { return; } Window_AddServer wms = new Window_AddServer(sip.ServerModel); //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) { string name = wms.ServerName; string ip = wms.Ip; int port = wms.Port; if (((this.Parent as ServerGroupPanel)?.Parent as ServerGroupRootPanel)?.ServerViewModel.ModifyServer(sip.ServerModel, (this.Parent as ServerGroupPanel)?.Content.ToString(), name, ip, port) != 0) { return; } } }
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.ServerName; string ip = wms.Ip; int port = wms.Port; //string id = wms.textBox_id.Text; //string password = wms.textBox_password.Password; if (((this.Parent as ServerGroupPanel)?.Parent as ServerGroupRootPanel)?.ServerViewModel.AddServer(this.Content.ToString(), name, ip, port) != 0) { return; } ServerListBoxItem si = new ServerListBoxItem() { ServerModel = new ServerModel(((this.Parent as ServerGroupPanel)?.Parent as ServerGroupRootPanel)?.ServerViewModel.JobjRoot?[this.Content]?[name]?.Parent as JProperty) }; (this.Parent as ServerGroupPanel)?.slb.Items.Add(si); } }
private void DisConnectServer(object parameter) { ServerListBoxItem sip = this.SelectedItem as ServerListBoxItem; if (sip == null) { return; } sip.ServerModel.SshManager?.DisConnect(); if (WindowMain.current != null) { WindowMain.current.Clear(); } }
private void ConnectServer(object parameter) { ServerListBoxItem sip = this.SelectedItem as ServerListBoxItem; if (sip == null) { return; } if (sip.ServerModel.SshManager?.ReConnect() == true) { ; } WindowMain.current.Refresh(sip.ServerModel); }
private void DeleteServer(object parameter) { WindowMain.current.ShowMessageDialog( "Delete Server", "해당 서버 정보를 정말 삭제하시겠습니까?", MahApps.Metro.Controls.Dialogs.MessageDialogStyle.AffirmativeAndNegative, () => { ServerListBoxItem slbi = this.SelectedItem as ServerListBoxItem; if (slbi == null) { return; } if (((this.Parent as ServerGroupPanel)?.Parent as ServerGroupRootPanel)?.ServerViewModel.DeleteServer((this.Parent as ServerGroupPanel)?.Content.ToString(), slbi.ServerModel.Name) != 0) { return; } this.Items.Remove(slbi); }); }
private void ContextMenu_Opened(object sender, RoutedEventArgs e) { ServerListBoxItem sip = this.SelectedItem as ServerListBoxItem; if (sip == null) { return; } if (sip.IsConnected) { item_delete.IsEnabled = false; item_connect.IsEnabled = false; item_disconect.IsEnabled = true; item_modify.IsEnabled = false; } else { item_delete.IsEnabled = true; item_connect.IsEnabled = true; item_disconect.IsEnabled = false; item_modify.IsEnabled = true; } }