Example #1
0
        public void Export()
        {
            try
            {
                var ap = Appraisals.Where(a => a.IsSelected && File.Exists(a.FileName)).Select(a => a).ToList();
                if (!ap.Any())
                {
                    AppStateSettings.Instance.TriggerNotification(string.Format("No appraisals created or selected", "export"));
                    return;
                }

                var imagePaths = ap.Select(a => a.FileName).ToList();



                var titles = ap.Select(a => a.Title).ToList();

                var at = Path.ChangeExtension(Path.Combine(Path.GetDirectoryName(imagePaths[0]), "export - " + DateTime.Now.Ticks.ToString()), "pptx");
                var pptFactory = new PowerPointFactory(at);
                pptFactory.CreateTitleAndImageSlides(imagePaths, titles);

                var ne = new NotificationEventArgs()
                {
                    Header = "Export",
                    Text = "Finished creating PowerPoint"
                };
                ne.Foreground = Brushes.Black;
                ne.Background = Brushes.LightBlue;
                ne.Options = new List<string> { "Open" };
                ne.OptionClicked += (f, b) =>
                {
                    Process.Start(at);
                };
                AppStateSettings.Instance.TriggerNotification(ne);
            }
            catch (Exception)
            {
                AppStateSettings.Instance.TriggerNotification(string.Format("Error creating PowerPoint, check if folder exist", "export"));
            }

        }
Example #2
0
 public void CreatePowerPoint()
 {
     if (!CanCreatePowerPoint)
     {
         Logger.Log("NotebookPlugin", string.Format("Error creating PowerPoint of {0} Notebook", ActiveNotebook.Name), "Please select some images!", Logger.Level.Error, true);
         return;
     }
     var imagePaths = ActiveNotebook.Items.Where(notebookItem => notebookItem.IsSelected).Select(notebookItem => notebookItem.FileName).ToList();
     var pptFactory = new PowerPointFactory(Path.ChangeExtension(Path.Combine(Path.GetDirectoryName(imagePaths[0]), ActiveNotebook.Name), "pptx"));
     pptFactory.CreateTitleAndImageSlides(imagePaths);
     AppStateSettings.Instance.TriggerNotification(string.Format("Finished creating PowerPoint of {0} Notebook", ActiveNotebook.Name));
 }