Example #1
0
        private void BackgroundWorker_RunWorkerCompleted(object sender, RunWorkerCompletedEventArgs e)
        {
            PowerShellStation pss = new PowerShellStation(notification);

            foreach (KeyValuePair <string, string> kvp in (List <KeyValuePair <string, string> >)e.Result)
            {
                switch (kvp.Key)
                {
                case "Client":
                    pss.SetStationName(kvp.Value);
                    break;

                case "Online":
                    pss.SetStatus(kvp.Value.Equals("true", StringComparison.CurrentCultureIgnoreCase) ? true : false);
                    break;

                case "UpdateStatus":
                    pss.SetServiceStatus(kvp.Value);
                    break;

                case "UpdateStartType":
                    pss.SetServiceStartMode(kvp.Value);
                    break;

                case "UploadSpeed":
                    pss.SetUploadSpeed((int)Math.Round(float.Parse(kvp.Value)));
                    break;

                case "DownloadSpeed":
                    pss.SetDownloadSpeed((int)Math.Round(float.Parse(kvp.Value)));
                    break;
                }
            }
            overview.AddOrUpdateStation(pss);
        }
        private void StationClick(object sender, EventArgs e)
        {
            PowerShellStation pss = (PowerShellStation)(sender as PictureBox).Parent;

            foreach (KeyValuePair <Client, BackgroundWorker> kvp in clients)
            {
                if (kvp.Key.ClientName.Equals(pss.StationName))
                {
                    kvp.Key.openPowerShell();
                    return;
                }
            }
        }