private void BtnSave_Click(object sender, EventArgs e) { if (CheckValues()) { Document doc = new Document() { Title = TxtTitle.Text.Trim(), SerialNumber = TxtSerialNum.Text.Trim(), Quantity = Convert.ToInt32(NumQuantity.Value), DistributionScope = TxtDistributionScope.Text.Trim(), Remark = TxtRemark.Text.Trim(), DocumentType = DocumentControl.AddOrGetType(CboDocumentType.Text.Trim()), SecretLevel = (SecretLevel)Enum.Parse(typeof(SecretLevel), CboSecretLevel.SelectedIndex.ToString()), CheckTime = DtpCheckTime.Value, ISN = TxtISN.Text.Trim() }; if (_id == 0) { //新增模式 DocumentControl.AddNewDocument(doc); } else { //编辑模式 doc.ID = _id; DocumentControl.UpdateDocument(doc); } Close(); } }
void InitializeComponent() { Title = "My Eto Form"; ClientSize = new Size(400, 350); Padding = 10; var docPage = new DocumentPage { Text = "My tab is shy" }; var docControl = new DocumentControl { Pages = { docPage } }; Content = docControl; var quitCommand = new Command { MenuText = "Quit", Shortcut = Application.Instance.CommonModifier | Keys.Q }; quitCommand.Executed += (sender, e) => Application.Instance.Quit(); Menu = new MenuBar { Items = { new ButtonMenuItem { Text = "&File" }, }, QuitItem = quitCommand }; }
public virtual Control Create() { tabControl = DefaultTabs(); var allowReorder = new CheckBox { Text = "AllowReordering" }; allowReorder.CheckedBinding.Bind(tabControl, c => c.AllowReordering); var enabled = new CheckBox { Text = "Enabled" }; enabled.CheckedBinding.Bind(tabControl, c => c.Enabled); return(new StackLayout { Spacing = 5, HorizontalContentAlignment = HorizontalAlignment.Stretch, Items = { new StackLayout { Orientation = Orientation.Horizontal, Items ={ AddPage(), RemovePage(), SelectPage(), allowReorder, enabled, null } }, new StackLayoutItem(tabControl, expand: true) } }); }
public static void MergeFiles(string[] sources, string destination, int vers = 2012) { // Initialize the API Program.ConsoleLog("Initializing NavisWorks..."); ApplicationControl.ApplicationType = ApplicationType.SingleDocument; ApplicationControl.Initialize(); // Create a document control using (var nwDocControl = new DocumentControl()) { // Set the control as the primary document nwDocControl.SetAsMainDocument(); var nwDoc = nwDocControl.Document; // Merge Program.ConsoleLog("Merging files..."); if (nwDoc.TryMergeFiles(sources)) { Program.ConsoleLog("Merge Successful!"); // Save Program.ConsoleLog("Saving {0}...", destination); if (nwDoc.TrySaveFile(destination, GetVersion(vers))) { Program.ConsoleLog("{0} Saved successfully!", destination); } } } // Terminate the API Program.ConsoleLog("Closing NavisWorks..."); ApplicationControl.Terminate(); }
private void btnStart_Click(object sender, EventArgs e) { try { if (_service == null) { StartService(); DocumentControl.SetIcon(_document, "NetService_Started", Properties.Resources.Network_Map_Started); btnStart.Text = "Stop"; comboBoxNetgraph.Enabled = false; EnableControl(false); } else { StopService(); } } catch (NetServiceException ex) { Exception dispEx = ex; _service = null; if (ex.InnerException != null) { dispEx = ex.InnerException; } MessageBox.Show(this, dispEx.Message, CANAPE.Properties.Resources.MessageBox_ErrorString, MessageBoxButtons.OK, MessageBoxIcon.Error); } catch (Exception ex) { MessageBox.Show(this, ex.Message, CANAPE.Properties.Resources.MessageBox_ErrorString, MessageBoxButtons.OK, MessageBoxIcon.Error); } }
public static void MergeFiles(string[] sources, string destination, int vers = 2012) { // Initialize the API Program.ConsoleLog("Initializing NavisWorks..."); ApplicationControl.ApplicationType = ApplicationType.SingleDocument; ApplicationControl.Initialize(); // Create a document control using (var nwDocControl = new DocumentControl()) { // Set the control as the primary document nwDocControl.SetAsMainDocument(); var nwDoc = nwDocControl.Document; // Merge Program.ConsoleLog("Merging files..."); if (nwDoc.TryMergeFiles(sources)) { Program.ConsoleLog("Merge Successful!"); // Save Program.ConsoleLog("Saving {0}...", destination); if (nwDoc.TrySaveFile(destination, GetVersion(vers))) { Program.ConsoleLog("{0} Saved successfully!", destination); } } } // Terminate the API Program.ConsoleLog("Closing NavisWorks..."); ApplicationControl.Terminate(); }
public FrmNavisWorkAddProp() { InitializeComponent(); viewControl = new ViewControl(); documentControl = new DocumentControl(); viewControl.Dock = DockStyle.Fill; viewControl.DocumentControl = this.documentControl; viewControl.Location = new Point(0, 24); viewControl.Name = "viewControl"; viewControl.Size = new Size(745, 496); viewControl.TabIndex = 1; this.viewControl.Text = "viewControl"; viewControl.BringToFront(); viewControl.BackColor = SysColor.Color.Red; viewControl.CreateControl(); splitContainerMain.Panel2.Controls.Add(viewControl); /********************/ documentControl.SetAsMainDocument(); /********************/ GrdNavisModelFile.AutoGenerateColumns = false; dtListOfFiles.Columns.AddRange(new[] { new DataColumn("cFileName", typeof(string)), new DataColumn("cFileLocation", typeof(string)), new DataColumn("cPropertyName", typeof(string)), new DataColumn("cPropertyValue", typeof(string)), new DataColumn("cPropertyValueCombo", typeof(string)), }); GrdNavisModelFile.DataSource = dtListOfFiles; AddComboBoxValue(); }
private void FrmEditDoc_Load(object sender, EventArgs e) { //IME设定 TxtTitle.ImeMode = ImeMode.OnHalf; TxtSerialNum.ImeMode = ImeMode.OnHalf; CboDocumentType.ImeMode = ImeMode.OnHalf; TxtDistributionScope.ImeMode = ImeMode.OnHalf; TxtRemark.ImeMode = ImeMode.OnHalf; //初始化文件类型下拉框 SetupTypeList(); //编辑模式填充数据 if (_id != 0) { Document doc = DocumentControl.GetDocumentById(_id); TxtTitle.Text = doc.Title; TxtSerialNum.Text = doc.SerialNumber; CboSecretLevel.SelectedIndex = (int)doc.SecretLevel; NumQuantity.Value = doc.Quantity; TxtDistributionScope.Text = doc.DistributionScope; TxtRemark.Text = doc.Remark; CboDocumentType.SelectedItem = doc.DocumentType; DtpCheckTime.Value = doc.CheckTime; TxtISN.Text = doc.ISN; } }
/// <summary> /// Kthe ne shqip te gjitha deklarimet qe jane ne anglisht te crystalReportViewer1 /// </summary> private void RifreskoRaportin() { foreach (Control child in this.crystalReportViewer1.Controls) { if (child is CrystalDecisions.Windows.Forms.PageView) { PageView child1 = child as PageView; foreach (Control child2 in child1.Controls) { if (child2 is System.Windows.Forms.TabControl) { foreach (Control child3 in child2.Controls) { DocumentControl child4 = child3 as DocumentControl; if (child4 != null) { child4.Text = "Raporti Kryesor"; } } } } } else if (child is System.Windows.Forms.StatusBar) { StatusBar status = child as StatusBar; status.Panels[0].Text = status.Panels[0].Text.Replace("Current Page No:", "Numri i faqes korrente"); status.Panels[1].Text = status.Panels[1].Text.Replace("Total Page No:", "Numri total i faqeve:"); status.Panels[2].Text = status.Panels[2].Text.Replace("Zoom Factor:", "Shkalla e zmadhimit:"); } } }
void LogEvents(DocumentControl control) { control.SelectedIndexChanged += (sender, e) => Log.Write(control, $"SelectedIndexChanged, Index: {control.SelectedIndex}"); control.PageClosed += (sender, e) => Log.Write(control, $"PageClosed, Title: {e.Page.Text}"); control.PageReordered += (sender, e) => Log.Write(control, $"PageReordered, Title: {e.Page.Text}, OldIndex: {e.OldIndex}, NewIndex: {e.NewIndex}"); }
private void SetupList() { List <DocumentType> types = DocumentControl.GetDocTypeList(); LstTypes.DataSource = types; LstTypes.DisplayMember = "Name"; LstTypes.ValueMember = "ID"; }
public void Execute(MainForm mainForm, ToolStripMenuItem menu) { try { ConsoleControl control = new ConsoleControl(); DocumentControl.ShowControl("IronPython Shell", control); } catch { } }
private void ShowViews(int docID, int slcSubID, int slcOperID) { var doc = DocumentControl.GetDocumentWithDetails(docID); var viewList = ViewFactory.DocToViews(doc); DgvSubDoc.Rows.Clear(); if (viewList != null && viewList.Count > 0) { viewList.ForEach(view => { int rowID = DgvSubDoc.Rows.Add( view.ID, view.LastOperTime, view.HandmanName, view.OperationType, view.TargetName ); switch (view.OperationType) { case Common.OperationType.出至: DgvSubDoc.Rows[rowID].Cells["colViewID"].Style.BackColor = Color.Yellow; DgvSubDoc.Rows[rowID].Cells["colViewID"].Style.SelectionBackColor = Color.Yellow; DgvSubDoc.Rows[rowID].Cells["colViewID"].Style.SelectionForeColor = Color.Black; break; case Common.OperationType.收回自: DgvSubDoc.Rows[rowID].Cells["colViewID"].Style.BackColor = Color.LightPink; DgvSubDoc.Rows[rowID].Cells["colViewID"].Style.SelectionForeColor = Color.Black; DgvSubDoc.Rows[rowID].Cells["colViewID"].Style.SelectionBackColor = Color.LightPink; break; case Common.OperationType.已归档: DgvSubDoc.Rows[rowID].Cells["colViewID"].Style.BackColor = Color.LightGreen; DgvSubDoc.Rows[rowID].Cells["colViewID"].Style.SelectionForeColor = Color.Black; DgvSubDoc.Rows[rowID].Cells["colViewID"].Style.SelectionBackColor = Color.LightGreen; break; case Common.OperationType.未开始: break; default: break; } }); DgvSubDoc.Rows[slcSubID].Selected = true; int viewID = Convert.ToInt32(DgvSubDoc.SelectedRows[0].Cells["colViewID"].Value); ShowOpers(viewID, slcOperID); } else { ShowOpers(0, slcOperID); } }
private void createScriptDocumentToolStripMenuItem_Click(object sender, EventArgs e) { string script = _document.Script; if (script != null) { ScriptDocument doc = CANAPEProject.CurrentProject.CreateDocument <ScriptDocument>("csharp"); doc.Script = script; DocumentControl.Show(doc); } }
protected override void OnLoad(EventArgs e) { base.OnLoad(e); Archivio.GetInstance().Changed += DocumentiChanged; Archivio.GetInstance().Load(new TipologiePersister("../../Tipologie.xml"), new RequisitiPersister("../../Requisiti.xml")); new RequisitiViewPresenter(new RequisitiViewControl(), _splitContainer.Panel2, _visualizzaRequisiti, new Selezione()); DocumentControl _documentControl = new DocumentControl(); new DocumentoViewPresenter(_documentControl, _splitContainer.Panel2, _listOfferte); new DocumentoViewPresenter(_documentControl, _splitContainer.Panel2, _listRichieste); new GraduatoriaViewPresenter(new DataGridView(), _splitContainer.Panel2, _graduatoria); new GraduatoriaFittiziaViewPresenter(new GraduatoriaFittiziaControl(), _splitContainer.Panel2, _graduatoriaFittizia); }
static void newDiffLog_Click(object sender, Func <IEnumerable <LogPacket> > createPackets, bool left) { LogPacket[] packets = createPackets().ToArray(); if (packets.Length > 0) { PacketLogDiffDocument doc = CANAPEProject.CurrentProject.CreateDocument <PacketLogDiffDocument>(); AddToExistingDifflog(left ? doc.Left : doc.Right, packets); DocumentControl.Show(doc); } }
private void 新增流转ToolStripMenuItem_Click(object sender, EventArgs e) { //新增流转的逻辑是创建一个新的oper对象及其对应的一个sub对象到数据库 //添加完成后刷新界面,即可获得想要的结果 if (DgvDocument.SelectedRows.Count == 0) { return; } int docID = Convert.ToInt32(DgvDocument.SelectedRows[0].Cells["colID"].Value); DocumentControl.CreateNewSubDoc(docID); ShowDocs("", DgvDocument.SelectedRows[0].Index, DgvSubDoc.RowCount, 0); }
static void newLog_Click(object sender, Func <IEnumerable <LogPacket> > createPackets) { LogPacket[] packets = createPackets().ToArray(); if (packets.Length > 0) { PacketLogDocument doc = CANAPEProject.CurrentProject.CreateDocument <PacketLogDocument>(); AddPacketsToDocument(doc, packets); DocumentControl.Show(doc); } }
private void BtnDelete_Click(object sender, EventArgs e) { int id = (int)LstTypes.SelectedValue; if (!DocumentControl.CheckTypeUsing(id)) { //没被使用可以删除 DocumentControl.DeleteDocType(id); SetupList(); } else { MessageBox.Show($"{LstTypes.Text}已被使用,全部修改后才可以删除."); } }
//pop菜单项 private void 除公文ToolStripMenuItem_Click(object sender, EventArgs e) { if (DgvDocument.SelectedRows.Count == 0) { return; } string title = DgvDocument.SelectedRows[0].Cells["colTitle"].Value.ToString(); int docID = Convert.ToInt32(DgvDocument.SelectedRows[0].Cells["colID"].Value); if (MessageBox.Show($"确定删除《{title}》吗?", "删除确认", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes) { DocumentControl.DeleteDocument(docID); } PopulateDataGridView(); }
private void BtnSave_Click(object sender, EventArgs e) { if (CheckValues()) { CirculationOperation oper = new CirculationOperation { HappenTime = DtpHappenTime.Value, HandmanName = TxtHandman.Text.Trim(), TargetName = TxtTarget.Text.Trim(), OperationType = (OperationType)Enum.Parse(typeof(OperationType), CboOperationType.SelectedIndex.ToString()), Remark = TxtRemark.Text.Trim() }; DocumentControl.AddNewOperation(_id, oper); Close(); } }
void OnServiceStop() { CloseLogFiles(); DocumentControl.SetIcon(_document, null, null); if (!IsDisposed) { netGraphNodesControl.Service = null; listViewConns.Items.Clear(); btnStart.Text = "Start"; comboBoxNetgraph.Enabled = true; EnableControl(true); _service = null; } }
private void 除流转ToolStripMenuItem_Click(object sender, EventArgs e) { //Todo:这里先实现功能,不考虑删除的前提条件 //viewID是一个view的唯一识别,无视其所属的doc if (DgvDocument.SelectedRows.Count == 0 || DgvSubDoc.SelectedRows.Count == 0) { return; } int docID = Convert.ToInt32(DgvDocument.SelectedRows[0].Cells["colID"].Value); int viewID = Convert.ToInt32(DgvSubDoc.SelectedRows[0].Cells["colViewID"].Value); if (MessageBox.Show($"确定删除流转{viewID}吗?", "删除确认", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes) { DocumentControl.DeleteSubDocById(viewID); } ShowViews(docID, 0, 0); }
private void btnOk_Click(object sender, EventArgs e) { DialogResult = System.Windows.Forms.DialogResult.OK; Properties.Settings.Default.ProxyClient = GeneralUtils.ObjectToString(proxyClientControl.Client); foreach (ScriptEngineConfig config in comboBoxScriptType.Items) { DocumentControl.SetConfigItem(ScriptDocumentControl.GetConfigForEngine(config.EngineName), config.Config); } Properties.Settings.Default.Compressed = checkBoxCompress.Checked; Properties.Settings.Default.MakeBackup = checkBoxBackup.Checked; Properties.Settings.Default.DontShowSplash = !checkBoxShowSplash.Checked; Properties.Settings.Default.CheckForUpdates = checkBoxCheckUpdates.Checked; Properties.Settings.Default.ShowStartupForm = checkBoxShowStartupForm.Checked; Properties.Settings.Default.NetServicePacketLogMutable = checkBoxPacketLogMutable.Checked; Properties.Settings.Default.ConfirmOnExit = checkBoxConfirmClose.Checked; Properties.Settings.Default.EventLogClearConfirm = checkBoxRequireEventLogClearConfirm.Checked; Properties.Settings.Default.PacketLogClearConfirm = checkBoxRequirePacketLogClearConfirm.Checked; Properties.Settings.Default.NewStyleLogViewer = checkBoxNewStyle.Checked; Properties.Settings.Default.PacketLogConfirmMode = (PacketLogConfirmMode)comboBoxLogConfirm.SelectedIndex; Properties.Settings.Default.OpenFindWindowsInDialog = checkBoxOpenFindInDialog.Checked; Properties.Settings.Default.AutoSaveEnabled = checkBoxAutoSave.Checked; Properties.Settings.Default.AutoSaveTimerMins = (int)numericUpDownAutoSaveTimer.Value; Properties.Settings.Default.ScriptEditorFont = _scriptFont; CultureInfo culture = comboBoxLanguage.SelectedItem as CultureInfo; if (culture != null) { string currentLanguage = Properties.Settings.Default.CurrentLanguage ?? String.Empty; if (currentLanguage != culture.Name) { Properties.Settings.Default.CurrentLanguage = culture.Name; MessageBox.Show(this, Properties.Resources.ConfigurationForm_MustRestartToChangeLanguage, Properties.Resources.ConfigurationForm_MustRestartToChangeLanguageCaption, MessageBoxButtons.OK, MessageBoxIcon.Information); } } Program.SaveSettings(); Close(); }
public void LogicalParentShouldChangeWhenAddedOrRemoved() { Invoke(() => { var ctl = new DocumentControl(); var child = new Panel { Size = new Size(100, 100) }; var page = new DocumentPage(child); Assert.AreEqual(page, child.Parent, "#1"); ctl.Pages.Add(page); Assert.AreEqual(page.Parent, ctl, "#2"); ctl.Pages.RemoveAt(0); Assert.IsNull(page.Parent, "#3"); page.Content = null; Assert.IsNull(child.Parent, "#4"); }); }
public override void Execute(object parameter) { DocumentControl document = (DocumentControl)parameter; if (Workspace.Instance.ViewModel.Documents.Any(x => x.GetModel() == document)) { DocumentControl model = Workspace.Instance.ViewModel.Documents.FirstOrDefault(x => x.GetModel() == document).GetModel(); //TODO: Fix functionality for focusing document //IDEWindow.Instance.ViewModel.FocusDocument(model); return; } DocumentControlViewModel newViewModel = document.CreateViewModel(); //Workspace.Instance.ViewModel.Documents.Add(newViewModel); //MainWindow.FocusDocument(newViewModel.GetModel()); }
private void Button_Add_Click(object sender, RoutedEventArgs e) { OpenFileDialog openFileDialog = new OpenFileDialog(); openFileDialog.Filter = "PDF files (*.pdf)|*.pdf"; openFileDialog.Multiselect = true; if (openFileDialog.ShowDialog() == true) { foreach (string filepath in openFileDialog.FileNames) { var docControl = new DocumentControl(); docControl.FilePath = filepath; docControl.FilenameText = System.IO.Path.GetFileName(filepath); this.WrapPanel_FileBrowser.Children.Add(docControl); } } }
private void ShowOpers(int viewID, int slcOperID) { var operList = DocumentControl.GetOperBySubID(viewID); DgvOper.Rows.Clear(); if (operList != null && operList.Count > 0) { int i = 1; operList.ForEach(oper => { DgvOper.Rows.Add(oper.ID, i, oper.HappenTime, oper.HandmanName, oper.OperationType, oper.TargetName, oper.Remark); i++; }); if (slcOperID < DgvOper.RowCount) { DgvOper.Rows[slcOperID].Selected = true; } } }
// TODO: Fix this :) public ScriptDocumentControl(IDocumentObject document, bool forParserDocument) { _document = (ScriptDocument)document; _currText = _document.Script; InitializeComponent(); Text = _document.Name; ScriptDocumentControlConfig config = _document.GetProperty <ScriptDocumentControlConfig>(DOCUMENT_CONFIG_NAME, false); UpdateConfig(config ?? DocumentControl.GetConfigItem <ScriptDocumentControlConfig>(GetConfigForEngine(_document.Container.Engine), true)); LoadFile(_document.Script); _forParserDocument = forParserDocument; if (!forParserDocument) { if (this.ParentForm != null) { this.ParentForm.FormClosing += new FormClosingEventHandler(ParentForm_FormClosing); } } textEditorControl.ActiveTextAreaControl.Document.UndoStack.OperationPushed += new OperationEventHandler(UndoStack_OperationPushed); textEditorControl.ActiveTextAreaControl.Document.UndoStack.ActionUndone += new EventHandler(UndoStack_ActionUndone); textEditorControl.ActiveTextAreaControl.Document.UndoStack.ActionRedone += new EventHandler(UndoStack_ActionUndone); if (GlobalControlConfig.ScriptEditorFont != null) { textEditorControl.Font = GlobalControlConfig.ScriptEditorFont; } if (forParserDocument) { toolStripButtonSave.Visible = false; toolStripButtonOptions.Visible = false; toolStripButtonOpenTest.Visible = false; } }
public void LoadedEventsShouldPropegate() { Panel child1 = null; Panel child2 = null; DocumentPage page1 = null; DocumentPage page2 = null; Shown(form => { var ctl = new DocumentControl(); child1 = new Panel { Size = new Size(100, 100) }; ctl.Pages.Add(page1 = new DocumentPage(child1) { Text = "Page 1" }); Assert.IsFalse(child1.Loaded, "#1"); child2 = new Panel { Size = new Size(100, 100) }; ctl.Pages.Add(page2 = new DocumentPage(child2)); Assert.IsFalse(child2.Loaded, "#2"); return(ctl); }, ctl => { Assert.IsTrue(child1.Loaded, "#3"); page1.Content = new Panel(); Assert.IsFalse(child1.Loaded, "#4"); ctl.SelectedIndex = 1; Assert.IsTrue(child2.Loaded, "#5"); ctl.Pages.RemoveAt(1); Assert.IsFalse(child2.Loaded, "#6"); Assert.IsFalse(page2.Loaded, "#7"); }); }
private void ShowDocs(string filter, int slcDocID, int slcSubID, int slcOperID) { var docList = string.IsNullOrEmpty(filter) ? DocumentControl.GetDocuments() : DocumentControl.GetDocuments(filter); DgvDocument.Rows.Clear(); if (docList != null && docList.Count > 0) { int i = 1; docList.ForEach(doc => { DgvDocument.Rows.Add(doc.ID, i, doc.Title, doc.ISN, doc.SerialNumber, doc.CheckTime, doc.DocumentType.Name, doc.SecretLevel, doc.Quantity, doc.DistributionScope, doc.Remark); i++; }); if (slcDocID < DgvDocument.RowCount) { DgvDocument.Rows[slcDocID].Selected = true; } int docID = Convert.ToInt32(DgvDocument.SelectedRows[0].Cells["colID"].Value); ShowViews(docID, slcSubID, slcOperID); } }
public static void NwdPublish(string input, string output, int vers = 2012) { // Set the job variables var startDir = Directory.GetParent(input); var jobName = Path.GetFileName(input); var jobTitle = Path.GetFileNameWithoutExtension(input); var jobDate = new FileInfo(input).CreationTime.ToString("yyyy-MM-dd"); var tempDir = Path.Combine(Environment.GetEnvironmentVariable("TEMP"), jobTitle); var tempOutput = Path.Combine(tempDir, Path.GetFileName(output)); if (jobName == null) { Program.ConsoleLog("Error setting job variables"); return; } // Clear the temp directory if (Directory.Exists(tempDir)) Directory.Delete(tempDir, true); Directory.CreateDirectory(tempDir); // Get all the working files var workingFiles = startDir.EnumerateFiles(jobTitle + "*", SearchOption.TopDirectoryOnly).ToList(); // Remove NWC and NWD files for (var i = workingFiles.Count - 1; i >= 0; i--) { if (!workingFiles[i].Extension.Equals(".nwc", StringComparison.CurrentCultureIgnoreCase) && !workingFiles[i].Extension.Equals(".nwd", StringComparison.CurrentCultureIgnoreCase)) continue; workingFiles.RemoveAt(i); } // Copy the work files to the temp directory Program.ConsoleLog("Copying working files..."); workingFiles.ForEach(x => x.CopyTo(Path.Combine(tempDir, x.Name))); // Initialize the API Program.ConsoleLog("Initializing NavisWorks..."); Program.ConsoleFreeze("Loading Navisworks modules..."); ApplicationControl.ApplicationType = ApplicationType.SingleDocument; ApplicationControl.Initialize(); if (!ApplicationControl.IsInitialized) { Program.ConsoleLog("Unable to initialize Navisworks!"); return; } Program.ConsoleThaw(); // Get the publish properties from the provided dictionary var publishProps = GetPublishProperties(string.Format("{0}_{1}", jobName, jobDate)); if (publishProps == null) { Program.ConsoleLog("Failed to create publish properties!"); goto Terminate; } // Create a document control using (var docControl = new DocumentControl()) { // Set the control as the primary document docControl.SetAsMainDocument(); var nwDoc = docControl.Document; // Try opening the document Program.ConsoleLog("Opening {0}...", jobName); try { nwDoc.OpenFile(Path.Combine(tempDir, jobName)); } catch (DocumentFileException ex) { Program.ConsoleLog(ex.Message); goto Terminate; } // Try publishing the document Program.ConsoleLog("Publishing {0}...", Path.GetFileName(output)); try { nwDoc.PublishFile(tempOutput, publishProps); } catch (DocumentFileException ex) { Program.ConsoleLog(ex.Message); goto Terminate; } // Convert to a lower format if necessary if (vers < 2012) { Program.ConsoleLog("Converting {0} to {1} format...", Path.GetFileName(output), vers); try { nwDoc.OpenFile(tempOutput); nwDoc.SaveFile(tempOutput, GetVersion(vers)); } catch (DocumentFileException ex) { Program.ConsoleLog(ex.Message); } } } // Terminate the API Terminate: Program.ConsoleLog("Closing NavisWorks..."); Program.ConsoleFreeze("Unloading Navisworks modules..."); ApplicationControl.Terminate(); Program.ConsoleThaw(); // Copy the file to the final location //Program.ConsoleLog("Copying {0} to {1}", Path.GetFileName(output), Path.GetDirectoryName(output)); try { File.Copy(tempOutput, output, true); } catch (IOException ex) { Program.ConsoleLog(ex.Message); } }