public int CreatePresentations() { int namesProcessed = 0; ProcessTextBox.Text = string.Empty; // this is also the trust ID List <string> names = GetNamesList(); ProcessTextBox.AppendText("Processing: "); if (BuildPowerPointFile(names)) { ProcessTextBox.AppendText(" - done"); namesProcessed++; } ProcessTextBox.AppendText(Environment.NewLine); ProcessTextBox.ScrollToEnd(); //ProcessedCount.Text = namesProcessed.ToString(); ScreenEvents.DoEvents(); return(namesProcessed); }
void StopButton_Click(Object sender, EventArgs e) { Arny = null; network_version = 0; total_action_number = 0; StopButton.Enabled = false; ProcessTextBox.AppendText(" ----- Конец ----- " + Environment.NewLine); StartButton.Text = "Start"; }
public void Process_text(int result, int param, string action) { ProcessTextBox.Text += Convert.ToString(network_version) + "." + Convert.ToString(action_number) + ") "; Show_network_version(); Show_action_number(); switch (action) { case "Add": { ProcessTextBox.AppendText(String.Format("{0} + {1} = {2}{3}", result - param, param, result, Environment.NewLine)); break; } case "Multiply": { ProcessTextBox.AppendText(String.Format("{0} * {1} = {2}{3}", param == 0 ? 0 : result / param, param, result, Environment.NewLine)); break; } default: { throw new Exception("В Process_text очепятка: " + action); } } }
void ClearButton_Click(Object sender, EventArgs e) { ProcessTextBox.ResetText(); }
private bool BuildPowerPointFile(List <string> names) { // open the base presentation // create the animations // save as ... to the destination folder PowerPoint.Application ppApplication = null; PowerPoint.Presentations ppPresentations = null; PowerPoint.Presentation ppPresentation = null; try { ppApplication = new PowerPoint.Application(); ppPresentations = ppApplication.Presentations; // to create a new presentation ppPresentation = ppPresentations.Add(MsoTriState.msoTrue); ppApplication.Activate(); SlideWidthCentre = (int)ppPresentation.PageSetup.SlideWidth / 2; SlideHeightCentre = (int)ppPresentation.PageSetup.SlideHeight / 2; ppPresentation.ApplyTemplate(Path.Combine(BaseSettingsFolder, TemplateFile)); AddTitleSlide(ppPresentation, "My trust", "2015"); AddAnimationNames(ppPresentation, names); //CentrePictures(ppPresentation); ppPresentation.SaveAs(Path.Combine(DestinationFolder, "AnimatedNames"), PowerPoint.PpSaveAsFileType.ppSaveAsDefault, MsoTriState.msoTrue); } catch (Exception e) { ProcessTextBox.AppendText(Environment.NewLine); ProcessTextBox.AppendText("Error: " + e.Message); return(false); } finally { try { if (ppPresentation != null) { ppPresentation.Close(); ppApplication.Quit(); ppApplication = null; } GC.Collect(); GC.WaitForPendingFinalizers(); GC.Collect(); GC.WaitForPendingFinalizers(); } catch (Exception e) { } } return(true); }