public static BuildResult BuildSingle() { AbstractEditorDocument ed = ed = Instance.CurrentEditor; if (ed == null) { return(null); } // Save module ed.Save(); // Select appropriate language binding string file = ed.AbsoluteFilePath; bool IsProject = false; var lang = AbstractLanguageBinding.SearchBinding(file, out IsProject); // Check if binding supports building if (lang == null || IsProject || !lang.CanBuild || !lang.BuildSupport.CanBuildFile(file)) { return(null); } // Set debug support if (lang.CanUseDebugging) { DebugManagement.CurrentDebugSupport = lang.DebugSupport; } else { DebugManagement.CurrentDebugSupport = null; } // Enable build menu IsBuilding = true; IDEManager.Instance.MainWindow.RefreshMenu(); // Clear build output Instance.MainWindow.ClearLog(); // Execute build var br = LastSingleBuildResult = lang.BuildSupport.BuildStandAlone(file); if (br.Successful && br.NoBuildNeeded) { ErrorLogger.Log("File wasn't changed -- No compilation required", ErrorType.Information, ErrorOrigin.Build); } // Update error list, Disable build menu ErrorManagement.RefreshErrorList(); IsBuilding = false; IDEManager.Instance.MainWindow.RefreshMenu(); return(br); }
public void Completed(bool cancelled) { try { ActivityBar.Stop(); } catch (Exception ex) { ErrorManagement.Log(ex); } }
public void Start() { try { while (mController.Running) { mController.Display(); Thread.Sleep(100); } } catch (Exception ex) { ErrorManagement.Log(ex); } }
public static bool Build(Project Project, bool Incrementally) { // Enable build menu IsBuilding = true; WorkbenchLogic.Instance.SaveAllFiles(); IDEManager.Instance.MainWindow.RefreshMenu(); IDEManager.Instance.MainWindow.LeftStatusText = "Build " + Project.Name; IDEManager.Instance.MainWindow.ClearLog(); // Build project with the interal method that's dedicated to build a project var r = InternalBuild(Project, Incrementally); // Disable build menu, Refresh error list IsBuilding = false; IDEManager.Instance.MainWindow.RefreshMenu(); IDEManager.Instance.MainWindow.LeftStatusText = r ? "Build successful" : "Build failed"; ErrorManagement.RefreshErrorList(); return(r); }
internal void CloseMessage() { try { if (thrMessage != null) { switch (thrMessage.ThreadState) { case ThreadState.Running: case ThreadState.WaitSleepJoin: { if (!thrMessage.Join(100)) { frmMessage.Cancel(); thrMessage.Abort(); } break; } default: { if (!frmMessage.Visible) { frmMessage.Cancel(); thrMessage.Abort(); } break; } } } } catch (ThreadAbortException ex) { ErrorManagement.Log(ex); } catch (Exception ex) { ErrorManagement.Log(ex); } }
internal WaitingMessage(string message, string title = "", int amountProgressBars = 1, bool cancelButton = false) { try { frmMessage = new F_Message(message, title, amountProgressBars, cancelButton); thrMessage = new Thread(frmMessage.ShowMe); thrMessage.Start(); } catch (ThreadAbortException ex) { ErrorManagement.Log(ex); } catch (Exception ex) { ErrorManagement.Log(ex); } }
private void F_Message_Shown(object sender, EventArgs e) { try { Cursor.Current = Cursors.WaitCursor; mController.Start(new TacheDeportee()); } catch (ThreadAbortException) { } catch (Exception ex) { ErrorManagement.Log(ex); } finally { Cursor.Current = Cursors.Default; } }
/// <summary> /// Validate the object. /// </summary> /// <exception cref="ValidationException"> /// Thrown if validation fails /// </exception> public virtual void Validate() { if (ErrorManagement == null) { throw new ValidationException(ValidationRules.CannotBeNull, "ErrorManagement"); } if (Format == null) { throw new ValidationException(ValidationRules.CannotBeNull, "Format"); } if (Availability == null) { throw new ValidationException(ValidationRules.CannotBeNull, "Availability"); } if (Structure == null) { throw new ValidationException(ValidationRules.CannotBeNull, "Structure"); } if (CompleteOperation == null) { throw new ValidationException(ValidationRules.CannotBeNull, "CompleteOperation"); } if (ErrorManagement != null) { ErrorManagement.Validate(); } if (Availability != null) { Availability.Validate(); } if (Structure != null) { foreach (var element in Structure) { if (element != null) { element.Validate(); } } } }
private void Delete(bool confirm) { WaitingMessage.WaitingMessage waitingMessage = null; try { if (confirm && MessageBox.Show("Are you sure you want to DEFINITIVELY delete the opened workbook?", "Delete a workbook", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.No) { return; } waitingMessage = new WaitingMessage.WaitingMessage("Please wait while data are being erased from the database." + Environment.NewLine + "This may take few seconds...", "Delete a workbook", 0); if (!Workbook_BLL.Delete(OpenedFile.Id)) { return; } CboFiles.DataSource = GetWorkbooks(); UnloadWorkBook(); } catch (Exception ex) { ErrorManagement.Log(ex); } finally { if (waitingMessage != null) { waitingMessage.CloseMessage(); } } }
public static bool Build(Solution sln, bool Incrementally) { //TODO: Build from most independent to most dependent project /* * TODO: How to combine D Projects? * -- e.g. Project A is a class library * -- Project B is an executable --> Interfacing? * http://digitalmars.com/d/2.0/dll.html */ bool ret = true; // Enable build menu IsBuilding = true; IDEManager.Instance.MainWindow.RefreshMenu(); IDEManager.Instance.MainWindow.LeftStatusText = "Build " + sln.Name; // Iterate through all projects // Note: see above foreach (var prj in sln) { if (!InternalBuild(prj, Incrementally)) { ret = false; break; } } IDEManager.Instance.MainWindow.LeftStatusText = ret ? "Build successful" : "Build failed"; // Disable build menu IsBuilding = false; IDEManager.Instance.MainWindow.RefreshMenu(); ErrorManagement.RefreshErrorList(); return(ret); }
private void BtnExport_Click(object sender, EventArgs e) { WaitingMessage.WaitingMessage waitingMessage = null; try { if (BtnSave.Enabled) { if (MessageBox.Show("Do you want to save changes before exporting data?" + Environment.NewLine + "All changes will otherwise be discarded!", "Usaved changes", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes) { Save(); } } string fileName = Path.Combine(new FileInfo(Application.ExecutablePath.Replace("/", "\\")).Directory.FullName, OpenedFile.Name); if (File.Exists(fileName)) { File.Delete(fileName); } using (ExcelPackage pck = new ExcelPackage(new FileInfo(fileName))) { waitingMessage = new WaitingMessage.WaitingMessage("Please wait while data are being exported." + Environment.NewLine + "This may take few seconds", "Exporting data", 2); int amountWorksheets = OpenedFile.WorkSheets.Count; int indexWs = 0; foreach (WorkSheet ws in OpenedFile.WorkSheets.Values) { pck.Workbook.Worksheets.Add(ws.Name); int amountCells = ws.Cells.Count; int indexCell = 0; waitingMessage.Controller.ReinitPercent(); ExcelWorksheet worksheet = pck.Workbook.Worksheets[ws.Name]; foreach (Cell cell in ws.Cells.Values) { worksheet.Cells[cell.Row, ColumnToInt(cell.Column)].Value = cell.CurrentValue; indexCell += 100; waitingMessage.SetPercent(indexCell / amountCells, 1); } indexWs += 100; waitingMessage.SetPercent(indexWs / amountWorksheets); } saveFileDialog.FileName = OpenedFile.Name; saveFileDialog.InitialDirectory = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments); if (saveFileDialog.ShowDialog() != DialogResult.OK) { return; } FileInfo fileInfo = new FileInfo(saveFileDialog.FileName); if (fileInfo.Exists) { fileInfo.IsReadOnly = false; fileInfo.Delete(); } pck.SaveAs(fileInfo); Process.Start(saveFileDialog.FileName); } } catch (Exception ex) { ErrorManagement.Log(ex); } finally { if (waitingMessage != null) { waitingMessage.CloseMessage(); } } }
private void CboWorkSheets_SelectedIndexChanged(object sender, EventArgs e) { WaitingMessage.WaitingMessage waitingMessage = null; LvWorksheet.Clear(); if (CboWorkSheets.SelectedIndex == -1) { return; } try { Cursor.Current = Cursors.WaitCursor; LvWorksheet.Columns.Add(string.Empty); List <string> columns = new List <string> { " " }; WorkSheet workSheet = OpenedFile.WorkSheets[((ItemData)CboWorkSheets.SelectedItem).Name]; waitingMessage = new WaitingMessage.WaitingMessage("Loading worksheet", "Please wait while the worksheet is loading." + Environment.NewLine + "This may take few seconds...", 0); // First loop to create as many columns in the ListView as there were in the Excel file foreach (KeyValuePair <int, string> kvp in workSheet.Cells.Keys) { string column = kvp.Value; if (!columns.Contains(column)) { LvWorksheet.Columns.Add(column, column, -1, HorizontalAlignment.Center, string.Empty); columns.Add(column); } } // and as many items as there were rows in the file Dictionary <int, List <Cell> > cells = workSheet.Cells.Values .GroupBy(c => c.Row) .OrderBy(cgb => cgb.Key) .ToDictionary(cgb => cgb.Key, cgb => cgb.Select(c => c) .ToList()); foreach (int row in cells.Keys) { ListViewItem lvi = new ListViewItem(row.ToString()); for (int noColumn = 1; noColumn < columns.Count; noColumn += 1) { lvi.SubItems.Add(string.Empty); } LvWorksheet.Items.Add(lvi); foreach (Cell cell in cells[row]) { cell.ListViewItem = lvi; } } // Second loop to actually fill in the ListView with the data read from the Excel file int index = 0; foreach (Cell cell in workSheet.Cells.Values) { ListViewItem lvi = cell.ListViewItem; lvi.SubItems[columns.IndexOf(cell.Column)].Text = cell.OriginalValue; lvi.SubItems[columns.IndexOf(cell.Column)].Tag = cell; lvi.Checked = cell.Included; index += 1; } // Ajust the columns width LvWorksheet.AutoResizeColumns(ColumnHeaderAutoResizeStyle.ColumnContent); LblWSNameTxt.Text = workSheet.Name; LblAmountRowsTxt.Text = LvWorksheet.Items.Count.ToString(); LblOriginalAmountRowsTxt.Text = LvWorksheet.Items[LvWorksheet.Items.Count - 1].Text; LblAmountColumnsTxt.Text = (LvWorksheet.Columns.Count - 1).ToString(); } catch (Exception ex) { ErrorManagement.Log(ex); } finally { if (waitingMessage != null) { waitingMessage.CloseMessage(); } EnableSaving(false); EnableExport(true); EnableDelete(true); Cursor.Current = Cursors.Default; } }