void header_OnChangeHostAllState(HostInfo hostinfo, bool isAllPlay) { //throw new NotImplementedException(); if (!isAllPlay) { ConfirmChild child = new ConfirmChild("TCS", "確定要關閉所有" + hostinfo.HostName + "的程序?"); child.Closed += (s, a) => { if (child.DialogResult == true) { // bool res; // VisualStateManager.GoToState(this,"Stop",true); for (int i = 0; i < dict.Values.Count; i++) { ProcessInfoCtl ctl; ctl = dict.Values.ToArray<ProcessInfoCtl>()[i]; if ((ctl.DataContext as ProcessInfo).HostIP == hostinfo.IP) { VisualStateManager.GoToState(ctl, "Stop", true); new ProcessService.ServiceSoapClient().ChangeProcessStateAsync(hostinfo.IP, (ctl.DataContext as ProcessInfo).ProcessName,false); } } } }; child.Show(); } else { for (int i = 0; i < dict.Values.Count; i++) { ProcessInfoCtl ctl; ctl = dict.Values.ToArray<ProcessInfoCtl>()[i]; if ((ctl.DataContext as ProcessInfo).HostIP == hostinfo.IP) { VisualStateManager.GoToState(ctl, "Normal", true); new ProcessService.ServiceSoapClient().ChangeProcessStateAsync(hostinfo.IP, (ctl.DataContext as ProcessInfo).ProcessName, true); } } } }
void ctl_OnChangeState(ProcessInfoCtl ctl,ProcessInfo info, bool bPlay) { //throw new NotImplementedException(); if (!bPlay) { ConfirmChild child = new ConfirmChild("TCS", "確定要停止" + info.ProcessName + "?"); child.Closed += (s, a) => { if (child.DialogResult == true) { ProcessService.ServiceSoapClient client = new ServiceSoapClient(); client.ChangeProcessStateAsync(info.HostIP, info.ProcessName, false); VisualStateManager.GoToState(ctl, "Stop", true); } }; child.Show(); } else { new ServiceSoapClient().ChangeProcessStateAsync(info.HostIP, info.ProcessName, true); VisualStateManager.GoToState(ctl, "Normal",true); } }