private void LEDButton_Click(object sender, RoutedEventArgs e) { var Datarow = ((Button)sender).CommandParameter; TaskConsoleWCFService.JobStatusRow ThisRow = (TaskConsoleWCFService.JobStatusRow)Datarow; string message = ThisRow.servername + ":\n" + "Agent Status: " + ThisRow.AgentStatus + "\n Last Connected: " + ThisRow.lastconnected; MessageBox.Show(message, "Agent Status"); }
private void Details_Click(object sender, RoutedEventArgs e) { var Datarow = ((Button)sender).CommandParameter; TaskConsoleWCFService.JobStatusRow ThisRow = (TaskConsoleWCFService.JobStatusRow)Datarow; var ConsoleService = ConsoleContract.CreateChannel(new EndpointAddress(MyEndpoint)); //Lets pass the Jobber object to a new window that is more intelligent than a messagebox.... var dajob = ConsoleService.GetJobByGUID(ThisRow.LastTaskGuid); var showdetails = new ShowDetails(dajob); showdetails.Title = "Job Details"; showdetails.Show(); }
public MainWindow() { InitializeComponent(); MyIP = ConsoleIP().ToString(); //Trying to find an open port, starting with MyPort: IPGlobalProperties ipGlobalProperties = IPGlobalProperties.GetIPGlobalProperties(); TcpConnectionInformation[] tcpConnInfoArray = ipGlobalProperties.GetActiveTcpConnections(); bool ihaveopenport = false; while (!ihaveopenport) { ihaveopenport = true; foreach (TcpConnectionInformation tcpi in tcpConnInfoArray) { if (tcpi.LocalEndPoint.Port == MyPort) { ihaveopenport = false; MyPort++; break; } } } MyEndpoint = "net.tcp://" + ConsoleIP().ToString() + ":" + MyPort.ToString() + "/StivTaskConsole/"; this.host = new ServiceHost(typeof(TaskConsoleWCFService.Service1)); bindbert.Security.Mode = SecurityMode.None; bindbert.MaxBufferSize = 640000; string myid = WindowsIdentity.GetCurrent().Name.Split('\\')[1].ToLower(); if (myid.ToLower().StartsWith("b-")) { UserTextBox.Text = myid.ToLower().Remove(0, 2); } ConsoleContract = new ChannelFactory <TaskConsoleWCFService.ContractDefinition>(bindbert); var ConsoleService = ConsoleContract.CreateChannel(new EndpointAddress(MyEndpoint)); StartWCFService(); ConsoleService.SetPort(MyPort.ToString()); //Here is where we load default definition files from current directory if they exist! var mydir = System.IO.Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location); if (File.Exists(mydir + @"\ServerList.xml")) { try { var LoadedList = SRCServerList.LoadFromFile(mydir + @"\ServerList.xml"); HierarchicServerList = LoadedList; try { ServerPickerWindow(); } catch { } } catch { MessageBox.Show("Failed to load list of servers from der einen file! Woe unto you!"); } } ; ColorDropbox.Items.Add("Red"); ColorDropbox.Items.Add("Blue"); ColorDropbox.Items.Add("Yellow"); ColorDropbox.Items.Add("Purple"); ColorDropbox.Items.Add("Orange"); ColorDropbox.Items.Add("Green"); ColorDropbox.Items.Add("Dark"); TaskConsoleWCFService.JobStatusRow TCRowItem = new TaskConsoleWCFService.JobStatusRow(); var dispatcherTimer = new System.Windows.Threading.DispatcherTimer(); dispatcherTimer.Tick += new EventHandler(dispatcherTimer_Tick); dispatcherTimer.Interval = new TimeSpan(0, 0, 1); dispatcherTimer.Start(); var DatasourceUpdate = new System.Windows.Threading.DispatcherTimer(); DatasourceUpdate.Tick += new EventHandler(UpdateJobDataGrid_Tick); DatasourceUpdate.Interval = new TimeSpan(0, 0, 7); DatasourceUpdate.Start(); DasGrid.ItemsSource = JobDataGridSource.Values.ToArray(); }