public void SetValues(Type typeContent, IEnumerable values) { this.State = TypeControl.Create; using (DBContext context = new DBContext(false)) { foreach (var item in values) { CurrentStartProcess = StartProcess.New(); CurrentStartProcess.IdUser = App.CurrentUser.ID; CurrentStartProcess.PathToApp = item.ToString(); CurrentStartProcess.Caption = Path.GetFileNameWithoutExtension(item.ToString()); context.StartProcesses.AddObject(CurrentStartProcess); context.SaveChanges(); Process.Add(CurrentStartProcess); CurrentStartProcess = null; } } this.State = TypeControl.Normal; }
public void CreateProcess() { this.State = TypeControl.Create; using (DBContext context = new DBContext(false)) { CurrentStartProcess = StartProcess.New(); ProcessControlWindow pcw = new ProcessControlWindow(); this.IsFolderPath = false; WindowPositionBehaviour.SetWindowPosition(pcw, WindowPosition.None); WindowVisibilityBehaviour.SetIsDialogVisible(pcw, true); if (pcw.DialogResult == true) { CurrentStartProcess.IdUser = App.CurrentUser.ID; context.StartProcesses.AddObject(CurrentStartProcess); context.SaveChanges(); _processCollection.Add(CurrentStartProcess); } CurrentStartProcess = null; } this.State = TypeControl.Normal; }