} // updateBatch /// <summary> /// Process document /// </summary> /// <param name="processAction"> document action</param> /// <returns>true if performed</returns> public Boolean ProcessIt(String processAction) { m_processMsg = null; DocumentEngine engine = new DocumentEngine(this, GetDocStatus()); return(engine.ProcessIt(processAction, GetDocAction())); } // process
// ------------------------------------------------------------------------------------------------------------- /********************************************************************************* * //! CRITICAL CODE: Do not rename nor move. * // This part is entangled with predefined Domains, thru some * // serialized event-handlers with Action<T>, Func<T> and lambdas. *********************************************************************************/ public static void UpdatePalettes(DocumentEngine DocEngine) { if (DocEngine == null) { return; } var IdeaPalettes = new Dictionary <IRecognizableElement, IEnumerable <IRecognizableElement> >(); foreach (var Palette in DocEngine.GetExposedElementsPalettes()) { IdeaPalettes.Add(Palette, DocEngine.GetExposedItemsOfElementPalette(Palette)); } CompositionDirector.IdeaPalette.UpdatePalettes(DocEngine, IdeaPalettes); var MarkerPalettes = new Dictionary <IRecognizableElement, IEnumerable <IRecognizableElement> >(); foreach (var Palette in DocEngine.GetExposedMarkersPalettes()) { MarkerPalettes.Add(Palette, DocEngine.GetExposedItemsOfMarkerPalette(Palette)); } CompositionDirector.MarkerPalette.UpdatePalettes(DocEngine, MarkerPalettes); var ComplementPalettes = new Dictionary <IRecognizableElement, IEnumerable <IRecognizableElement> >(); foreach (var Palette in DocEngine.GetExposedComplementsPalettes()) { ComplementPalettes.Add(Palette, DocEngine.GetExposedItemsOfComplementPalette(Palette)); } CompositionDirector.ComplementPalette.UpdatePalettes(DocEngine, ComplementPalettes); }
public bool ProcessIt(string processAction) { _processMsg = null; DocumentEngine engine = new DocumentEngine(this, GetDocStatus()); return(engine.ProcessIt(processAction, GetDocAction())); }
public DocumentTransaction GetTransaction(DocumentEngine engine, bool create, bool isInternal) { var transaction = Slot.Value; if (create && transaction == null) { bool alreadyLock; lock (TransactionList) { alreadyLock = TransactionList.Values.Any(x => x.ThreadId == Environment.CurrentManagedThreadId); transaction = new DocumentTransaction(GetNextTransactionID(), engine, this, isInternal); TransactionList[transaction.TransactionId] = transaction; } if (!alreadyLock) { Locker.EnterTransaction(); } Slot.Value = transaction; } return(transaction); }
public void UpdatePalettes(DocumentEngine Engine, IDictionary <IRecognizableElement, IEnumerable <IRecognizableElement> > Palettes, params string[] InitialClustersTechNames) { this.Engine = Engine; this.ClearPalettes(); if (Palettes == null) { return; } var UnclusteredPalettes = (Palettes.Count > 1 ? Palettes.Where(plt => plt.Key.Name == String.Empty) : Palettes); var ClusteredPalettes = (Palettes.Count > 1 ? Palettes.Where(plt => plt.Key.Name != String.Empty) : Enumerable.Empty <KeyValuePair <IRecognizableElement, IEnumerable <IRecognizableElement> > >()); if (UnclusteredPalettes.Any()) { var VisualPalette = new WidgetItemsPalette(this.Engine, Palettes.First().Key); VisualPalette.ItemsSource = UnclusteredPalettes.SelectMany(plt => plt.Value); this.Children.Add(VisualPalette); } if (ClusteredPalettes.Any()) { var ExpanderTextBrush = Display.GetResource <Brush, EntitledPanel>("PanelTextBrush"); var Selection = ClusteredPalettes.Where(plt => plt.Value.Any()); if (!InitialClustersTechNames.IsEmpty()) { var Initials = InitialClustersTechNames.Select(tn => ClusteredPalettes.FirstOrDefault(plt => plt.Key.TechName == tn)); Selection = Selection.OrderedInitiallyWith(Initials.ExcludeEmptyItems().ToArray()); } foreach (var Palette in Selection) { var VisualPalette = new WidgetItemsPalette(this.Engine, Palette.Key); VisualPalette.ItemsSource = Palette.Value; var ExpandPanel = new Expander(); ExpandPanel.Header = Palette.Key.Name; ExpandPanel.Content = VisualPalette; ExpandPanel.IsExpanded = true; ExpandPanel.Foreground = ExpanderTextBrush; this.Children.Add(ExpandPanel); } } }
public WidgetItemsPalette(DocumentEngine Engine, IRecognizableElement Palette) : this() { this.CurrentEngine = Engine; this.Palette = Palette; var OwnerPanel = this.GetNearestVisualDominantOfType <EntitledPanel>(); if (OwnerPanel == null) { return; } OwnerPanel.CreationText = "Create new Definition..."; }
// ----------------------------------------------------------------------------------------- public static void Edit(DocumentEngine Engine, MModelPropertyDefinitor Property, Idea TargetIdea) { Engine.StartCommandVariation("Edit Internal Property"); DialogOptionsWindow EditingWindow = null; var Editor = new DetailInternalPropertyEditor("Edit internal property...", Property, TargetIdea); var Changed = Display.OpenContentDialogWindow <DetailInternalPropertyEditor>(ref EditingWindow, "Edit Property", Editor); if (Changed.IsTrue()) { TargetIdea.UpdateVersion(); Engine.CompleteCommandVariation(); } else { Engine.DiscardCommandVariation(); } }
private void tvFoundBooks_AfterSelect(object sender, TreeViewEventArgs e) { DocumentEngine engine = new DocumentEngine(); string path = e.Node.Tag?.ToString() ?? ""; if (File.Exists(path)) { var(dateCreated, dateLastAccessed, fileName, fileExtension, fileLength, hasError) = engine.GetFileProperties(e.Node.Tag.ToString()); if (!hasError) { txtFileName.Text = fileName; } } }
private void tvFoundBooks_AfterSelect(object sender, TreeViewEventArgs e) { DocumentEngine engine = new DocumentEngine(); string path = e.Node.Tag?.ToString() ?? ""; if (File.Exists(path)) { var(dateCreated, dateLastAccessed, fileName, fileExtension, fileLength, hasError) = engine.GetFileProperties(e.Node.Tag.ToString()); if (!hasError) { txtFileName.Text = fileName; txtFileExtension.Text = fileExtension; dtCreated.Value = dateCreated; dtLastAccessed.Value = dateLastAccessed; txtFilePath.Text = e.Node.Tag.ToString(); txtFileSize.Text = $"{Round(fileLength.ToMegabytes(), 2).ToString()} MB"; } } }
public static IEnumerable <DocumentFileInfo> DetectDomainsInFolder(string SourceFolder) { Folder = SourceFolder; var DetectedFiles = Directory.GetFiles(Folder, "*." + Domain.FILE_EXTENSION_DOMAIN, SearchOption.TopDirectoryOnly); foreach (var DetectedFile in DetectedFiles) { var DocumentInfo = DocumentEngine.GetDocumentFileInfoFrom(DetectedFile); if (DocumentInfo != null) { yield return(DocumentInfo); } else { Console.WriteLine("Cannot analyze Domain file '{0}'.", DetectedFile); } } }
private void TvFoundBooks_AfterSelect(object sender, TreeViewEventArgs e) { var documentEngine = new DocumentEngine(); var filePath = e.Node.Tag?.ToString() ?? string.Empty; if (File.Exists(filePath)) { var(fileName, fileExtension, dateCreated, dateLastAccessed, fileSize, hasError) = documentEngine.GetFileProperties(filePath); if (!hasError) { tbFileName.Text = fileName; tbFileExtension.Text = fileExtension; dtDateCreated.Value = dateCreated; dtDateLastAccessed.Value = dateLastAccessed; tbPath.Text = e.Node.Tag.ToString(); tbFileSize.Text = $"{Round(fileSize.ToMegabytes(), 2)} MB"; } } }
private void _tvFoundBooks_ItemInvoked(Windows.UI.Xaml.Controls.TreeView sender, Windows.UI.Xaml.Controls.TreeViewItemInvokedEventArgs args) { var selectedItem = (Models.Item)args.InvokedItem; DocumentEngine engine = new DocumentEngine(); string path = selectedItem.FullName.ToString(); if (File.Exists(path)) { var(dateCreated, dateLastAccessed, fileName, fileExtention, fileLength, hasError) = engine.GetFileProperties(selectedItem.FullName.ToString()); if (!hasError) { txtFileName.Text = fileName; txtExtension.Text = fileExtention; dtCreated.Value = dateCreated; dtLastAccessed.Value = dateLastAccessed; txtFilePath.Text = selectedItem.FullName.ToString(); txtFileSize.Text = $"{Round(fileLength.ToMegabytes(), 2).ToString()} MB"; } } }
/// <summary> /// What happens after you select a book inside the Tree View /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void tvFoundBooks_AfterSelect(object sender, TreeViewEventArgs e) { DocumentEngine engine = new DocumentEngine(); //?? only gets the right operand if it is not null, if it is null it takes from the right string path = e.Node.Tag?.ToString() ?? ""; if (File.Exists(path)) { //Initializes all these variables and get their file with GetFileProperties var(dateCreated, dateLastAccessed, fileName, fileExtention, fileLength, hasError) = engine.GetFileProperties(e.Node.Tag.ToString()); if (!hasError) { txtFileName.Text = fileName; txtExtension.Text = fileExtention; dtCreated.Value = dateCreated; dtLastAccessed.Value = dateLastAccessed; txtFilePath.Text = e.Node.Tag.ToString(); txtFileSize.Text = $"{Round(fileLength.ToMegaBytes(), 2)} MB"; } } }
protected void Process(string docxSampleFileName, Model model, EngineConfig config) { if (!Directory.Exists(_outputFolder)) { Directory.CreateDirectory(_outputFolder); } var outputFileName = $"{_outputFolder}/{docxSampleFileName}.docx"; if (File.Exists(outputFileName)) { File.Delete(outputFileName); } var inputFileName = $"{SamplesFolder}/{docxSampleFileName}.docx"; using var templateStream = File.Open(inputFileName, FileMode.Open, FileAccess.Read); var engine = new DocumentEngine(config); var docx = engine.Run(templateStream, model); File.WriteAllBytes(outputFileName, docx); }
private void Initialize(IStartupOptions startOptions) { LogInformation("Initializing core.."); if (File.Exists(startOptions.ConfigFile)) { LogInformation("Loading configuration."); //The IOManager is not initialized yet, so read the data directly. Settings = JsonConvert.DeserializeObject <MetaServerSettings>(File.ReadAllText(startOptions.ConfigFile)); } else { LogInformation("Initializing new configuration."); Settings = new MetaServerSettings(startOptions.RootPath) { //TODO: Add additional startup options. }; } #region Create Directory Structure. if (Directory.Exists(Settings.RootPath) == false) { Directory.CreateDirectory(Settings.RootPath); } if (Directory.Exists(Settings.TransactionPath) == false) { Directory.CreateDirectory(Settings.TransactionPath); } #endregion //Settings.LoginFile if (File.Exists(Settings.ConfigFile) == false) { //The IOManager is not initialized yet, so write the data directly. File.WriteAllText(Settings.ConfigFile, JsonConvert.SerializeObject(Settings)); } if (File.Exists(Settings.LoginFile) == false) { var loginCatalog = new MetaLoginCollection(); #if DEBUG var defaultLogin = new MetaLogin("root"); defaultLogin.SetPassword("p@ssWord!"); loginCatalog.Add(defaultLogin); #endif //The IOManager is not initialized yet, so write the data directly. File.WriteAllText(Settings.LoginFile, JsonConvert.SerializeObject(loginCatalog)); } LogInformation("Initializing security engine."); Security = new SecurityEngine(this); LogInformation("Initializing IO engine."); IO = new IOEngine(this); LogInformation("Initializing schema engine."); Schema = new SchemaEngine(this); LogInformation("Initializing session engine."); Session = new SessionEngine(this); LogInformation("Initializing latch engine."); Latch = new LatchEngine(this); LogInformation("Initializing transaction engine."); Transaction = new TransactionEngine(this); LogInformation("Initializing document engine."); Document = new DocumentEngine(this); LogInformation("Initializing query engine."); Query = new QueryEngine(this); LogInformation("Starting transaction recovery."); Transaction.Recover(); LogInformation("Transaction recovery complete."); }
public DocAtions GetActions(int AD_Table_ID, int Record_ID, string docStatus, bool processing, string orderType, bool isSOTrx, string docAction, string tableName, List <string> _values, List <string> _names) { DocAtions action = new DocAtions(); string[] options = null; int index = 0; string defaultV = ""; action.DocStatus = docStatus; VLogger.Get().Fine("DocStatus=" + docStatus + ", DocAction=" + docAction + ", OrderType=" + orderType + ", IsSOTrx=" + isSOTrx + ", Processing=" + processing + ", AD_Table_ID=" + AD_Table_ID + ", Record_ID=" + Record_ID); options = new String[_values.Count()]; String wfStatus = MWFActivity.GetActiveInfo(ctx, AD_Table_ID, Record_ID); if (wfStatus != null) { VLogger.Get().SaveError("WFActiveForRecord", wfStatus); action.Error = "WFActiveForRecord"; return(action); } // Status Change if (!CheckStatus(tableName, Record_ID, docStatus)) { VLogger.Get().SaveError("DocumentStatusChanged", ""); action.Error = "DocumentStatusChanged"; return(action); } // if (processing != null) { bool locked = "Y".Equals(processing); if (!locked && processing.GetType() == typeof(Boolean)) { locked = ((Boolean)processing); } // do not show Unlock action on Production execution if (locked && !(AD_Table_ID == ViennaAdvantage.Model.X_VAMFG_M_WrkOdrTransaction.Table_ID)) { options[index++] = DocumentEngine.ACTION_UNLOCK; } } // Approval required .. NA if (docStatus.Equals(DocumentEngine.STATUS_NOTAPPROVED)) { options[index++] = DocumentEngine.ACTION_PREPARE; options[index++] = DocumentEngine.ACTION_VOID; } // Draft/Invalid .. DR/IN else if (docStatus.Equals(DocumentEngine.STATUS_DRAFTED) || docStatus.Equals(DocumentEngine.STATUS_INVALID)) { options[index++] = DocumentEngine.ACTION_COMPLETE; // options[index++] = DocumentEngine.ACTION_Prepare; options[index++] = DocumentEngine.ACTION_VOID; } // In Process .. IP else if (docStatus.Equals(DocumentEngine.STATUS_INPROGRESS) || docStatus.Equals(DocumentEngine.STATUS_APPROVED)) { options[index++] = DocumentEngine.ACTION_COMPLETE; options[index++] = DocumentEngine.ACTION_VOID; } // Complete .. CO else if (docStatus.Equals(DocumentEngine.STATUS_COMPLETED)) { options[index++] = DocumentEngine.ACTION_CLOSE; } // Waiting Payment else if (docStatus.Equals(DocumentEngine.STATUS_WAITINGPAYMENT) || docStatus.Equals(DocumentEngine.STATUS_WAITINGCONFIRMATION)) { options[index++] = DocumentEngine.ACTION_VOID; options[index++] = DocumentEngine.ACTION_PREPARE; } // Closed, Voided, REversed .. CL/VO/RE else if (docStatus.Equals(DocumentEngine.STATUS_CLOSED) || docStatus.Equals(DocumentEngine.STATUS_VOIDED) || docStatus.Equals(DocumentEngine.STATUS_REVERSED)) { return(action); } int refIndex = index; bool indexFromModule = true; GetActionFromModuleClass(AD_Table_ID, docStatus, out index, options); if (index == 0) { index = refIndex; indexFromModule = false; } /******************** * Order */ if (AD_Table_ID == MOrder.Table_ID) { // Draft .. DR/IP/IN if (docStatus.Equals(DocumentEngine.STATUS_DRAFTED) || docStatus.Equals(DocumentEngine.STATUS_INPROGRESS) || docStatus.Equals(DocumentEngine.STATUS_INVALID)) { options[index++] = DocumentEngine.ACTION_PREPARE; //JID_0213: Close option should not be visible before doc status is completed in doc process. //options[index++] = DocumentEngine.ACTION_CLOSE; // Draft Sales Order Quote/Proposal - Process if (isSOTrx && ("OB".Equals(orderType) || "ON".Equals(orderType))) { docAction = DocumentEngine.ACTION_PREPARE; } } // Complete .. CO else if (docStatus.Equals(DocumentEngine.STATUS_COMPLETED)) { options[index++] = DocumentEngine.ACTION_VOID; options[index++] = DocumentEngine.ACTION_REACTIVATE; } else if (docStatus.Equals(DocumentEngine.STATUS_WAITINGPAYMENT)) { options[index++] = DocumentEngine.ACTION_REACTIVATE; options[index++] = DocumentEngine.ACTION_CLOSE; } } /******************** * Shipment */ else if (AD_Table_ID == MInOut.Table_ID) { // Complete .. CO if (docStatus.Equals(DocumentEngine.STATUS_COMPLETED)) { // options[index++] = DocumentEngine.ACTION_VOID; options[index++] = DocumentEngine.ACTION_REVERSE_CORRECT; } } /******************** * Invoice */ else if (AD_Table_ID == MInvoice.Table_ID) { // Complete .. CO if (docStatus.Equals(DocumentEngine.STATUS_COMPLETED)) { // options[index++] = DocumentEngine.ACTION_VOID; options[index++] = DocumentEngine.ACTION_REVERSE_CORRECT; } } /******************** * Payment */ else if (AD_Table_ID == MPayment.Table_ID) { // Complete .. CO if (docStatus.Equals(DocumentEngine.STATUS_COMPLETED)) { //options[index++] = DocumentEngine.ACTION_VOID; options[index++] = DocumentEngine.ACTION_REVERSE_CORRECT; } } /******************** * GL Journal */ else if (AD_Table_ID == MJournal.Table_ID || AD_Table_ID == MJournalBatch.Table_ID) { // Complete .. CO if (docStatus.Equals(DocumentEngine.STATUS_COMPLETED)) { options[index++] = DocumentEngine.ACTION_REVERSE_CORRECT; //options[index++] = DocumentEngine.ACTION_REVERSE_ACCRUAL; } } /******************** * Allocation */ else if (AD_Table_ID == MAllocationHdr.Table_ID) { // Complete .. CO if (docStatus.Equals(DocumentEngine.STATUS_COMPLETED)) { // options[index++] = DocumentEngine.ACTION_VOID; options[index++] = DocumentEngine.ACTION_REVERSE_CORRECT; } } /******************** * Bank Statement */ else if (AD_Table_ID == MBankStatement.Table_ID) { // Complete .. CO if (docStatus.Equals(DocumentEngine.STATUS_COMPLETED)) { options[index++] = DocumentEngine.ACTION_VOID; } } /******************** * Inventory Movement, Physical Inventory */ else if (AD_Table_ID == MMovement.Table_ID || AD_Table_ID == MInventory.Table_ID) { // Complete .. CO if (docStatus.Equals(DocumentEngine.STATUS_COMPLETED)) { // SI_0622 : not to show VOID and REVERSE_CORRECT action on Physical Inventory bool isPhysicalInventory = false; if (AD_Table_ID == MInventory.Table_ID) { MInventory inventory = MInventory.Get(ctx, Record_ID); isPhysicalInventory = !inventory.IsInternalUse(); } if (!isPhysicalInventory) { //options[index++] = DocumentEngine.ACTION_VOID; options[index++] = DocumentEngine.ACTION_REVERSE_CORRECT; } } } // Added By Arpit else if (AD_Table_ID == MMovementConfirm.Table_ID) { // Complete .. CO if (docStatus.Equals(DocumentEngine.STATUS_COMPLETED)) { // SI_0630 : System should not allow to void the Move confirmation after its completion //options[index++] = DocumentEngine.ACTION_VOID; } } //End // /******************** //* Warehouse Task New Add by raghu 11 april,2011 //*/ // else if (AD_Table_ID == X_M_WarehouseTask.Table_ID // || AD_Table_ID == X_M_TaskList.Table_ID) // { // // Draft .. DR/IP/IN // if (docStatus.Equals(DocActionVariables.STATUS_DRAFTED) // || docStatus.Equals(DocActionVariables.STATUS_INPROGRESS) // || docStatus.Equals(DocActionVariables.STATUS_INVALID)) // { // options[index++] = DocActionVariables.ACTION_PREPARE; // } // // Complete .. CO // else if (docStatus.Equals(DocActionVariables.STATUS_COMPLETED)) // { // options[index++] = DocActionVariables.ACTION_VOID; // options[index++] = DocActionVariables.ACTION_REVERSE_CORRECT; // } // } /******************** * Work Order New Add by raghu 11 april,2011 */ else if (AD_Table_ID == ViennaAdvantage.Model.X_VAMFG_M_WorkOrder.Table_ID) { // Draft .. DR/IP/IN if (docStatus.Equals(DocActionVariables.STATUS_DRAFTED) || docStatus.Equals(DocActionVariables.STATUS_INPROGRESS) || docStatus.Equals(DocActionVariables.STATUS_INVALID)) { options[index++] = DocActionVariables.ACTION_PREPARE; } // Complete .. CO else if (docStatus.Equals(DocActionVariables.STATUS_COMPLETED)) { //options[index++] = DocActionVariables.ACTION_VOID; options[index++] = DocActionVariables.ACTION_REACTIVATE; } } /******************** * Work Order Transaction New Add by raghu 11 april,2011 */ else if (AD_Table_ID == ViennaAdvantage.Model.X_VAMFG_M_WrkOdrTransaction.Table_ID) { // Draft .. DR/IP/IN if (docStatus.Equals(DocActionVariables.STATUS_DRAFTED) || docStatus.Equals(DocActionVariables.STATUS_INPROGRESS) || docStatus.Equals(DocActionVariables.STATUS_INPROGRESS) || docStatus.Equals(DocActionVariables.STATUS_INVALID)) { options[index++] = DocActionVariables.ACTION_PREPARE; } // Complete .. CO else if (docStatus.Equals(DocActionVariables.STATUS_COMPLETED)) { //options[index++] = DocActionVariables.ACTION_VOID; options[index++] = DocActionVariables.ACTION_REVERSE_CORRECT; } } /* Obsolete Inventory New add by Amit 24-May-2016 */ //else if (tableName == "VA024_ObsoleteInventory") //{ // // DR/IN // if (docStatus.Equals(DocumentEngine.STATUS_DRAFTED) // || docStatus.Equals(DocumentEngine.STATUS_INVALID)) // { // options[index++] = DocumentEngine.ACTION_COMPLETE; // options[index++] = DocumentEngine.ACTION_VOID; // } // // Complete // else if (docStatus.Equals(DocActionVariables.STATUS_COMPLETED)) // { // options[index++] = DocActionVariables.ACTION_VOID; // options[index++] = DocActionVariables.ACTION_REVERSE_CORRECT; // } //} /***For Primary thread***/ ///** // * Fill actionCombo // */ //for (int i = 0; i < index; i++) //{ // // Serach for option and add it // bool added = false; // for (int j = 0; j < _values.Length && !added; j++) // if (options[i].Equals(_values[j])) // { // //actionCombo.addItem(_names[j]); // vcmbAction.Items.Add(_names[j]); // added = true; // } //} // setDefault if (docAction.Equals("--")) // If None, suggest closing { docAction = DocumentEngine.ACTION_CLOSE; } // check applied to display Document Actions on Transactions based on the document type // and the setting "Check Document Action Access" on Role window int C_DocType_ID = 0; int C_DocTypeTarget_ID = 0; MTable table = MTable.Get(ctx, AD_Table_ID); PO po = table.GetPO(ctx, Record_ID, null); if (Util.GetValueOfInt(po.Get_Value("C_DocType_ID")) > 0) { C_DocType_ID = Util.GetValueOfInt(po.Get_Value("C_DocType_ID")); } if (Util.GetValueOfInt(po.Get_Value("C_DocTypeTarget_ID")) > 0) { C_DocTypeTarget_ID = Util.GetValueOfInt(po.Get_Value("C_DocTypeTarget_ID")); C_DocType_ID = C_DocTypeTarget_ID; } if (C_DocType_ID > 0) { String[] docActionHolder = new String[] { docAction }; if (po is DocOptions) { index = ((DocOptions)po).customizeValidActions(docStatus, processing, orderType, isSOTrx ? "Y" : "N", AD_Table_ID, docActionHolder, options, index); } options = DocumentEngine.checkActionAccess(ctx, ctx.GetAD_Client_ID(), ctx.GetAD_Role_ID(), C_DocType_ID, options, ref index); } for (int i = 0; i < _values.Count() && defaultV.Equals(""); i++) { if (docAction.Equals(_values[i])) { defaultV = _names[i]; } } action.Options = options.ToList(); if (indexFromModule) { action.Index = index + 1; } else { action.Index = index; } action.DefaultV = defaultV; return(action); /***For Primary thread***/ //if (!defaultV.Equals("")) //{ // //vcmbAction.SelectedValue = defaultV; // vcmbAction.SelectedItem = defaultV; //} }
/// <summary> /// Exposes the commands which can be consumed. /// </summary> public void ExposeCommands() { WorkCommand ExposedWorkCommand = null; // ========================================================================================================= SimpleElement ExposedArea = new SimpleElement("Domain", "Domain"); SimpleElement ExposedGroup = new SimpleElement("Definition", "Definition"); this.CommandAreas_.Add(ExposedArea); this.CommandGroups_.PutIntoSublist(ExposedArea.TechName, ExposedGroup); // ------------------------------------------------------------------------------------- ExposedWorkCommand = new GenericCommand("EditDomain"); ExposedWorkCommand.Apply = (par => { var Doc = (CompositionEngine)this.WorkspaceDirector.ActiveDocumentEngine; if (Doc == null) { return; } DomainServices.DomainEdit(Doc.TargetComposition.CompositeContentDomain); }); ExposedWorkCommand.CanApply = (par => (this.WorkspaceDirector.ActiveDocument != null)); this.CommandExpositors.Add(ExposedWorkCommand.Name, new WorkCommandExpositor("Edit Domain...", ExposedWorkCommand.Name, "Edit the Domain of the current Composition", "book_edit.png", EShellCommandCategory.Document, ExposedArea.TechName, ExposedGroup.TechName, ExposedWorkCommand)); // ------------------------------------------------------------------------------------- /* this would confuse the user? */ ExposedWorkCommand = new GenericCommand("NewDomain"); ExposedWorkCommand.Apply = (par => ProductDirector.CompositionDirector.CreateComposition(true)); ExposedWorkCommand.CanApply = (par => true); this.CommandExpositors.Add(ExposedWorkCommand.Name, new WorkCommandExpositor("New Domain", ExposedWorkCommand.Name, "Creates a new Domain (and its empty template Composition).", "book_star.png", EShellCommandCategory.Document, ExposedArea.TechName, ExposedGroup.TechName, ExposedWorkCommand)); ExposedWorkCommand = new GenericCommand("OpenDomain"); ExposedWorkCommand.Apply = (par => ProductDirector.CompositionDirector.OpenDomainAndCreateCompositionOfIt(true)); ExposedWorkCommand.CanApply = (par => true); this.CommandExpositors.Add(ExposedWorkCommand.Name, new WorkCommandExpositor("Open Domain", ExposedWorkCommand.Name, "Opens a Domain for editing (and creates its emtpy template Composition).", "folder_book.png", EShellCommandCategory.Document, ExposedArea.TechName, ExposedGroup.TechName, ExposedWorkCommand)); // ------------------------------------------------------------------------------------- ExposedWorkCommand = new GenericCommand("SaveDomainAs"); ExposedWorkCommand.Apply = (par => { var Engine = (CompositionEngine)this.WorkspaceDirector.ActiveDocumentEngine; if (Engine == null) { return; } var Confirmation = Display.DialogMessage("Confirmation", "Save also the current Composition as Domain's Template for create new ones?\n" + "(Note: Later, it can be used or just start empty Compositions)", EMessageType.Question, MessageBoxButton.YesNoCancel, MessageBoxResult.Yes); if (Confirmation == MessageBoxResult.Cancel || Confirmation == MessageBoxResult.None) { return; } var SaveTemplate = (Confirmation == MessageBoxResult.Yes); //T Console.WriteLine("Saving Domain as..."); var InitialRoute = (Engine.DomainLocation != null ? Engine.DomainLocation.LocalPath : (Engine.FullLocation == null ? Path.Combine(AppExec.UserDataDirectory, Engine.TargetComposition.CompositeContentDomain.TechName) : Path.Combine(Path.GetDirectoryName(Engine.FullLocation.LocalPath), Engine.TargetComposition.CompositeContentDomain.TechName))); var TargetRoute = Display.DialogGetSaveFile("Save Domain as", FileDataType.FileTypeDomain.Extension, FileDataType.FileTypeDomain.FilterForSave, InitialRoute); if (TargetRoute == null) { return; } var CurrentWindow = Display.GetCurrentWindow(); CurrentWindow.Cursor = Cursors.Wait; var TargetDomain = Engine.TargetComposition.CompositeContentDomain; Visual Snapshot = null; if (SaveTemplate && TargetDomain.OwnerComposition.ActiveView != null) { Snapshot = TargetDomain.OwnerComposition.ActiveView .ToVisualSnapshot(DocumentEngine.PART_SNAPSHOT_WIDTH, DocumentEngine.PART_SNAPSHOT_HEIGHT); } TargetDomain.SetTemplateSaving(SaveTemplate); var Result = DocumentEngine.StoreToLocation <Domain>(TargetDomain, Domain.__ClassDefinitor.Name, TargetDomain.Classification.ContentTypeCode, TargetRoute, DomainDocumentUri, true, false, TargetDomain, Snapshot); if (!Result.IsAbsent()) { CurrentWindow.Cursor = Cursors.Arrow; Display.DialogMessage("Error!", "Cannot save Domain.\n\nProblem: " + Result, EMessageType.Warning); return; } Engine.DomainLocation = TargetRoute; this.WorkspaceDirector.ShellProvider.RefreshSelection(); CurrentWindow.Cursor = Cursors.Arrow; }); ExposedWorkCommand.CanApply = (par => (this.WorkspaceDirector.ActiveDocument != null)); this.CommandExpositors.Add(ExposedWorkCommand.Name, new WorkCommandExpositor("Save Domain As", ExposedWorkCommand.Name, "Saves the current Domain to the specified file.", "book_saveas.png", EShellCommandCategory.Document, ExposedArea.TechName, ExposedGroup.TechName, ExposedWorkCommand)); // ------------------------------------------------------------------------------------- // Ordered list of quick access commands this.QuickExposedCommands.Add(this.CommandExpositors["NewDomain"]); this.QuickExposedCommands.Add(this.CommandExpositors["OpenDomain"]); this.QuickExposedCommands.Add(this.CommandExpositors["EditDomain"]); this.QuickExposedCommands.Add(this.CommandExpositors["SaveDomainAs"]); // ------------------------------------------------------------------------------------- ExposedWorkCommand = new GenericCommand("Concept Definitions..."); ExposedWorkCommand.Apply = (par => { var Doc = (CompositionEngine)this.WorkspaceDirector.ActiveDocumentEngine; if (Doc == null) { return; } DomainServices.DefineDomainConcepts(Doc.CurrentView.OwnerCompositeContainer.CompositeContentDomain); }); ExposedWorkCommand.CanApply = (par => (this.WorkspaceDirector.ActiveDocument != null)); this.CommandExpositors.Add(ExposedWorkCommand.Name, new WorkCommandExpositor("Concept Defs...", ExposedWorkCommand.Name, "Edit the Concept Definitions of the Domain", "imtc_concept.png", EShellCommandCategory.Document, ExposedArea.TechName, ExposedGroup.TechName, ExposedWorkCommand)); // ------------------------------------------------------------------------------------- ExposedWorkCommand = new GenericCommand("Relationship Definitions..."); ExposedWorkCommand.Apply = (par => { var Doc = (CompositionEngine)this.WorkspaceDirector.ActiveDocumentEngine; if (Doc == null) { return; } DomainServices.DefineDomainRelationships(Doc.CurrentView.OwnerCompositeContainer.CompositeContentDomain); }); ExposedWorkCommand.CanApply = (par => (this.WorkspaceDirector.ActiveDocument != null)); this.CommandExpositors.Add(ExposedWorkCommand.Name, new WorkCommandExpositor("Relationship Defs...", ExposedWorkCommand.Name, "Edit the Relationship Definitions of the Domain", "imtc_relationship.png", EShellCommandCategory.Document, ExposedArea.TechName, ExposedGroup.TechName, ExposedWorkCommand)); // ------------------------------------------------------------------------------------- ExposedWorkCommand = new GenericCommand("Link-Role Variant Definitions..."); ExposedWorkCommand.Apply = (par => { var Doc = (CompositionEngine)this.WorkspaceDirector.ActiveDocumentEngine; if (Doc == null) { return; } DomainServices.DefineDomainLinkRoleVariants(Doc.CurrentView.OwnerCompositeContainer.CompositeContentDomain); }); ExposedWorkCommand.CanApply = (par => (this.WorkspaceDirector.ActiveDocument != null)); this.CommandExpositors.Add(ExposedWorkCommand.Name, new WorkCommandExpositor("Link-Role Variant Defs...", ExposedWorkCommand.Name, "Edit the Link-Role Variant Definitions of the Domain", "link_role_variants.png", EShellCommandCategory.Document, ExposedArea.TechName, ExposedGroup.TechName, ExposedWorkCommand)); // ------------------------------------------------------------------------------------- ExposedWorkCommand = new GenericCommand("Marker Definitions..."); ExposedWorkCommand.Apply = (par => { var Doc = (CompositionEngine)this.WorkspaceDirector.ActiveDocumentEngine; if (Doc == null) { return; } DomainServices.DefineDomainMarkers(Doc.CurrentView.OwnerCompositeContainer.CompositeContentDomain); }); ExposedWorkCommand.CanApply = (par => (this.WorkspaceDirector.ActiveDocument != null)); this.CommandExpositors.Add(ExposedWorkCommand.Name, new WorkCommandExpositor("Marker Defs...", ExposedWorkCommand.Name, "Edit the Marker Definitions of the Domain", "award_star_edit.png", EShellCommandCategory.Document, ExposedArea.TechName, ExposedGroup.TechName, ExposedWorkCommand)); // ------------------------------------------------------------------------------------- ExposedWorkCommand = new GenericCommand("Table-Structure Definitions..."); ExposedWorkCommand.Apply = (par => { var Doc = (CompositionEngine)this.WorkspaceDirector.ActiveDocumentEngine; if (Doc == null) { return; } DomainServices.EditDomainTableDefinitions(Doc.CurrentView.OwnerCompositeContainer.CompositeContentDomain); }); ExposedWorkCommand.CanApply = (par => (this.WorkspaceDirector.ActiveDocument != null)); this.CommandExpositors.Add(ExposedWorkCommand.Name, new WorkCommandExpositor("Table-Structure Defs...", ExposedWorkCommand.Name, "Edit the Table-Structure Definitions of the Domain", "table_alter.png", EShellCommandCategory.Document, ExposedArea.TechName, ExposedGroup.TechName, ExposedWorkCommand)); ExposedWorkCommand = new GenericCommand("Base Tables..."); ExposedWorkCommand.Apply = (par => { var Doc = (CompositionEngine)this.WorkspaceDirector.ActiveDocumentEngine; if (Doc == null) { return; } DomainServices.EditDomainBaseTables(Doc.CurrentView.OwnerCompositeContainer.CompositeContentDomain); }); ExposedWorkCommand.CanApply = (par => (this.WorkspaceDirector.ActiveDocument != null)); this.CommandExpositors.Add(ExposedWorkCommand.Name, new WorkCommandExpositor("Base Tables...", ExposedWorkCommand.Name, "Edit the Base Tables of the Domain", "table_multiple.png", EShellCommandCategory.Document, ExposedArea.TechName, ExposedGroup.TechName, ExposedWorkCommand)); // ------------------------------------------------------------------------------------- ExposedWorkCommand = new GenericCommand("External Languages..."); ExposedWorkCommand.Apply = (par => { var Doc = (CompositionEngine)this.WorkspaceDirector.ActiveDocumentEngine; if (Doc == null) { return; } DomainServices.DefineDomainExternalLanguages(Doc.CurrentView.OwnerCompositeContainer.CompositeContentDomain); }); ExposedWorkCommand.CanApply = (par => (this.WorkspaceDirector.ActiveDocument != null)); this.CommandExpositors.Add(ExposedWorkCommand.Name, new WorkCommandExpositor("External Languages...", ExposedWorkCommand.Name, "Edit the External Languages declared for the Domain", "page_white_code_red.png", EShellCommandCategory.Document, ExposedArea.TechName, ExposedGroup.TechName, ExposedWorkCommand)); // ------------------------------------------------------------------------------------- ExposedWorkCommand = new GenericCommand("Idea-Def Clusters..."); ExposedWorkCommand.Apply = (par => { var Doc = (CompositionEngine)this.WorkspaceDirector.ActiveDocumentEngine; if (Doc == null) { return; } DomainServices.DefineDomainIdeaDefClusters(Doc.CurrentView.OwnerCompositeContainer.CompositeContentDomain); }); ExposedWorkCommand.CanApply = (par => (this.WorkspaceDirector.ActiveDocument != null)); this.CommandExpositors.Add(ExposedWorkCommand.Name, new WorkCommandExpositor("Idea-Def Clusters...", ExposedWorkCommand.Name, "Edit the Idea-Definition Clusters of the Domain", "def_clusters.png", EShellCommandCategory.Document, ExposedArea.TechName, ExposedGroup.TechName, ExposedWorkCommand)); // ------------------------------------------------------------------------------------- }