private void ButtonAddXml_OnClick(object sender, RoutedEventArgs e) { var ci = new ConnectionInfo(ConnectionTypes.MSSQL, GetNewXmlFileEntryName(), null, true, ""); var cef = new AddConnectionWindow(ci) { Owner = this }; if (cef.ShowDialog() == true) { var item = new ConnectionListItem() { Name = ci.Type.ToString(), Type = ci.Type.ToString(), Tag = ci }; var source = LvXmlFiles.ItemsSource as ObservableCollection <ConnectionListItem>; if (source != null) { source.Add(item); } App.XmlFiles.Add(ci); LvXmlFiles.SelectedItem = item; } LvXmlFiles.Focus(); Properties.Settings.Default.XmlFiles = App.XmlFiles; Properties.Settings.Default.Connections = App.Connections; Properties.Settings.Default.Save(); }
private void ButtonAddConnection_OnClick(object sender, RoutedEventArgs e) { var ci = new ConnectionInfo(ConnectionTypes.MSSQL, GetNewConnectionEntryName(), null, false, ""); var cef = new AddConnectionWindow(ci) { Owner = this }; if (cef.ShowDialog() == true) { var item = new ConnectionListItem() { Name = ci.Name, Type = ci.Type.ToString(), Tag = ci }; var source = LvConnections.ItemsSource as ObservableCollection <ConnectionListItem>; if (source != null) { source.Add(item); } App.Connections.Add(ci); LvConnections.SelectedItem = item; } LvConnections.Focus(); SaveConnection(); }
public string commandHandle(string command, string node) { if (node.Length < 1) { mainWindow.appendConsole("Nie wybrano docelowego punktu końcowego", null, null); return(null); } switch (command) { case "resource-location": string portresponse = sendCommand(node, "get-ports|", false); ResourceRelocationWindow relocationwindow = new ResourceRelocationWindow(this, node, portresponse); relocationwindow.ShowDialog(); return("DONE"); case "disable-node": return(sendCommand(node, command + "|", true)); case "close-connection": string connresponse = sendCommand(node, "get-connection-list|", false); DropConnectionWindow dropWindow = new DropConnectionWindow(this, connresponse, node, mainWindow); dropWindow.ShowDialog(); return("DONE"); case "sub-connection-HPC": string port_response = sendCommand(node, "get-ports|", false); string connectionresponse = sendCommand(node, "get-connection-list|", false); AddConnectionWindow window = new AddConnectionWindow(this, port_response, connectionresponse, node); window.ShowDialog(); return("DONE"); case "get-connection-list": return(sendCommand(node, command + "|", true)); case "get-ports": return(sendCommand(node, command + "|", true)); default: mainWindow.appendConsole("Stało się niemożliwe", null, null); return("ERROR"); } }
private void ButtonConfigureConnection_OnClick(object sender, RoutedEventArgs e) { if (LvConnections.SelectedItem == null) { return; } var item = (ConnectionListItem)LvConnections.SelectedItem; var ci = (ConnectionInfo)item.Tag; var cef = new AddConnectionWindow(ci); if (cef.ShowDialog() == true) { item.Name = ci.Name; item.Type = ci.Type.ToString(); } LvConnections.Focus(); }
public string commandHandle(string command, string node) { if (node.Length < 1) { mainWindow.appendConsole("Nie wybrano docelowego punktu końcowego", null, null); return(null); } switch (command) { // do klienta case "resource-location": string portresponse = sendCommand(node, "get-ports|", false); string con_response = sendCommand(node, "get-resource-list|", false); ResourceRelocationWindow relocationwindow = new ResourceRelocationWindow(this, node, portresponse, con_response, availableModules, availableConteners); relocationwindow.ShowDialog(); return("DONE"); // do klienta case "get-resource-list": return(sendCommand(node, command + "|", true)); // do klienta case "delete-resource": string conresponse = sendCommand(node, "get-resource-list|", false); DropConnectionWindow deleteWindow = new DropConnectionWindow(this, conresponse, node, mainWindow, "client"); deleteWindow.ShowDialog(); return("DONE"); // do krosownicy case "disable-node": return(sendCommand(node, command + "|", true)); // do krosownicy case "close-connection": string connresponse = sendCommand(node, "get-connection-list|", false); DropConnectionWindow dropWindow = new DropConnectionWindow(this, connresponse, node, mainWindow, "router"); dropWindow.ShowDialog(); return("DONE"); // do krosownicy case "sub-connection-HPC": string port_response = sendCommand(node, "get-ports|", false); string connectionresponse = sendCommand(node, "get-connection-list|", false); AddConnectionWindow window = new AddConnectionWindow(this, port_response, connectionresponse, node, availableModules, availableConteners); window.ShowDialog(); return("DONE"); // do krosownicy case "get-connection-list": return(sendCommand(node, command + "|", true)); // do klienta i krosownicy case "get-ports": return(sendCommand(node, command + "|", true)); case "load-config": LoadConfig(node); return("DONE"); default: mainWindow.appendConsole("Stało się niemożliwe", null, null); return("ERROR"); } }