/// <summary> /// Remove a layout item from this instance. /// </summary> /// <param name="item">The item to remove.</param> /// <returns>True if the item was sucsessfully remove, else false.</returns> public bool RemoveLayoutItem(ILayoutItemViewModel item) { bool sucsess; switch (item) { case IToolViewModel tool: sucsess = AnchorablesSource.Remove(tool); break; case IDocumentViewModel document: sucsess = DocumentsSource.Remove(document); break; default: sucsess = false; break; } if (item == ActiveContent && sucsess) { ILayoutItemViewModel newActive = DocumentsSource.FirstOrDefault(); if (newActive is null) { newActive = AnchorablesSource.FirstOrDefault(); } ActiveContent = newActive; } return(sucsess); }
public bool CanRun() { //check if any commands in active workflow DocumentViewModel wvm = DocumentsSource.FirstOrDefault(x => x.IsSelected); return(wvm != null && wvm.Workflow.Any()); }
public void Run() { DocumentViewModel wvm = DocumentsSource.FirstOrDefault(x => x.IsSelected); var workflow = wvm.Workflow; RAD_Task RAD_Task = Kernel.Get <RAD_Task>(); WCC_Task WCC_Task = Kernel.Get <WCC_Task>(); Logger.Clear(); Logger.LogString("Starting Workflow..."); // FIXME structure? foreach (IWorkflowItem item in workflow) { WFR completed = WFR.WFR_Error; if (item.GetType().IsSubclassOf(typeof(RAD_Command))) { completed = RAD_Task.RunCommandSync((RAD_Command)item); } else if (item.GetType().IsSubclassOf(typeof(WCC_Command))) { completed = WCC_Task.RunCommandSync((WCC_Command)item); } else //workflowitems { completed = item.Run(); } if (completed == WFR.WFR_Error) { Logger.LogString("Aborting."); break; } else { continue; } } Logger.LogString("Done."); }