private void ExecuteShareViewTemplate(object parameter) { //to do: Make it singleton MachinesManager dataManager = new MachinesManager(); if (this.SelectedTaskViewModel == null) { return; } MachinesView view = new MachinesView(); MachinesViewModel machinesVM = new MachinesViewModel(dataManager.Machines, true); view.DataContext = machinesVM; if (!base.ShowDialog(Translator.Translate("UI_MACHINES"), view)) { return; } foreach (TaskInfo task in this.SelectedTaskViewModel.Tasks) { _viewsManager.ShareTaskAsync(machinesVM.SelectedMachine.Name, this.SelectedTaskViewModel.ViewTemplate, task, task.GetSharedPath()); } }
protected async void ShareSelectedTasks(string machineName) { ApplicationViewModel.BeginAction(ActionType.ShareTask); try { foreach (var task in this.SelectedTasks) { await _viewsManager.ShareTaskAsync(machineName, this.ViewTemplate, task, task.GetSharedPath()); } } catch (Exception e) { Logger.AddException(e); } finally { ApplicationViewModel.EndAction(ActionType.ShareTask); } }