void MarketSurface() { if (!CanStart()) { return; } var control = new DistributeSurfaceControl(); var vm = new DistributeSurfaceViewModel() { IsBusy = true }; control.DataContext = vm; OpenView("Trend Market(" + ProcessMode.ToString() + "):" + GetHeader(), control); Task.Factory.StartNew(() => { try { Save(); var ml = TargetObject.GetMarketDataList(); var tl = TargetObject.GetDistributeTrendByMarket(ml); App.Current.Dispatcher.Invoke(() => { vm.LoadData(tl); }); } catch (Exception ex) { LogSupport.Error(ex); } }).ContinueWith((t) => { vm.IsBusy = false; }); }
void Surface() { var control = new SurfaceControl(); var vm = new SurfaceControlViewModel() { IsBusy = true }; control.DataContext = vm; OpenView("3 Matrix Analyse(" + ProcessMode.ToString() + "):" + GetHeader(), control); Task.Factory.StartNew(() => { try { Save(); Dictionary <string, List <Tuple <double, double, double> > > rl = TargetObject.Get3DCurve(); App.Current.Dispatcher.Invoke(() => { vm.LoadData(rl); }); } catch (Exception ex) { LogSupport.Error(ex); } }).ContinueWith((t) => { vm.IsBusy = false; }); }
void DimentionAnalyse() { var control = new DimentionAnalyseControl(); var vm = new DimentionAnalyseControlViewModel() { IsBusy = true }; control.DataContext = vm; OpenView("Dimention Analyse(" + ProcessMode.ToString() + "):" + GetHeader(), control); Task.Factory.StartNew(() => { try { Save(); var rl = TargetObject.GetDimentionAnalyse(); App.Current.Dispatcher.Invoke(() => { vm.LoadData(rl); }); } catch (Exception ex) { LogSupport.Error(ex); } }).ContinueWith((t) => { vm.IsBusy = false; }); }
void TimeTrend() { if (!CanStart()) { return; } var control = new DistributeTrendControl(); var vm = control.DataContext as DistributeTrendViewModel; vm.IsTimeMode = true; OpenView("Trend Time(" + ProcessMode.ToString() + "):" + GetHeader(), control); Task.Factory.StartNew(() => { Save(); var ml = TargetObject.GetMarketDataList(); var tl = TargetObject.GetDistributeTrendByTime(ml); App.Current.Dispatcher.Invoke(() => { vm.LoadData(tl); }); }).ContinueWith((t) => { vm.IsBusy = false; }); }
private void SetLogEntryProperties(Net.Logging.LogEvent entry) { entry.User = CurrentUser.UserName; entry.Computer = ClientIpAddress; entry.Source = ClientApplicationName; entry.Category = ProcessMode.ToString(); }
public static void StartProtect(Guid daemonProcessGuid, int protectedProcessId, int delaySeconds, ProcessMode processMode, string entryPoint, params string[] args) { Thread thread = new Thread(() => { string daemonProcessFullPath = Assembly.GetExecutingAssembly().Location; string daemonProcessName = Assembly.GetExecutingAssembly().GetName().Name; List <string> daemonProcessArgs = new List <string>(); daemonProcessArgs.Add(string.Format("\"{0}\"", daemonProcessGuid.ToString())); daemonProcessArgs.Add(string.Format("\"{0}\"", protectedProcessId.ToString())); daemonProcessArgs.Add(string.Format("\"{0}\"", delaySeconds.ToString())); daemonProcessArgs.Add(string.Format("\"{0}\"", processMode.ToString())); daemonProcessArgs.Add(string.Format("\"{0}\"", entryPoint)); foreach (string item in args) { daemonProcessArgs.Add(string.Format("\"{0}\"", item)); } ProcessStartInfo startInfo = new ProcessStartInfo(daemonProcessFullPath); startInfo.Arguments = string.Join(" ", daemonProcessArgs.ToArray()); startInfo.CreateNoWindow = true; startInfo.ErrorDialog = false; startInfo.UseShellExecute = false; startInfo.Verb = "runas"; int exitCode = 0; Process daemonProcess = null; while (true) { if (daemonProcess != null) { if (!daemonProcess.HasExited) { daemonProcess.WaitForExit(); } try { exitCode = daemonProcess.ExitCode; } catch { } if (exitCode == -1) { break; } daemonProcess = null; } foreach (Process item in Process.GetProcessesByName(daemonProcessName)) { try { List <string> commandLineArguments = DaemonProcessHelper.GetCommandLineArguments(DaemonProcessHelper.GetCommandLineByProcessId(item.Id)); if (commandLineArguments != null && commandLineArguments.Count > 0 && commandLineArguments[0].Equals(daemonProcessGuid.ToString(), StringComparison.OrdinalIgnoreCase)) { daemonProcess = item; break; } } catch { } } if (daemonProcess == null) { try { daemonProcess = Process.Start(startInfo); } catch (Exception e) { InternalLogger.Log(e); break; } } } if (daemonProcess != null) { daemonProcess.Dispose(); daemonProcess = null; } }); thread.IsBackground = true; try { thread.Start(); } catch (Exception e) { InternalLogger.Log(e); } }
public DirectoryInfo GetRootDataDirectory() { return(new DirectoryInfo(Path.Combine(DataRootDirectory, ProcessMode.ToString()))); }