public void CreateMessage(string subject, string attachmentPath)
 {
     try
     {
         var handle      = IntPtr.Zero;
         var processList = Process.GetProcesses();
         foreach (var process in processList.Where(x => x.ProcessName.ToLower().Contains("outlook")).Where(process => process.MainWindowHandle.ToInt32() != 0))
         {
             handle = process.MainWindowHandle;
             break;
         }
         Utilities.ActivateForm(handle, true, false);
         var mi = (MailItem)_outlookObject.CreateItem(OlItemType.olMailItem);
         mi.Attachments.Add(attachmentPath, OlAttachmentType.olByValue, 1, Path.GetFileNameWithoutExtension(attachmentPath));
         mi.Subject = subject;
         mi.Display(false);
         var count = 100000;
         handle = IntPtr.Zero;
         while (handle == IntPtr.Zero && count > 0)
         {
             handle = WinAPIHelper.FindWindow(string.Empty, subject + "- Message (HTML)");
             count--;
             System.Windows.Forms.Application.DoEvents();
         }
         if (handle != IntPtr.Zero)
         {
             Utilities.ActivateForm(handle, true, false);
         }
     }
     catch (Exception e)
     {
         PopupMessageHelper.Instance.ShowWarning(e.Message);
     }
 }
Esempio n. 2
0
        public void LoadPreviewControl(PreviewItemControl previewControl)
        {
            if (!(previewControl.IsLoaded || previewControl.OutputItem.PreviewGeneratingAction == null))
            {
                Utilities.ActivateForm(_parentForm.Handle, _parentForm.WindowState == FormWindowState.Maximized, true);
                Utilities.ActivateForm(_previewForm.Handle, _previewForm.WindowState == FormWindowState.Maximized, true);
                FormProgress.ShowProgress("Loading Slide Preview...", () =>
                {
                    previewControl.OutputItem.PreviewGeneratingAction(_mainPowerPointProcessor,
                                                                      previewControl.OutputItem.PresentationSourcePath);
                    if (_previewForm.InvokeRequired)
                    {
                        _previewForm.BeginInvoke(new MethodInvoker(previewControl.Load));
                    }
                    else
                    {
                        previewControl.Load();
                    }
                }, false);
                Utilities.ActivateForm(_parentForm.Handle, _parentForm.WindowState == FormWindowState.Maximized, false);
                Utilities.ActivateForm(_previewForm.Handle, _previewForm.WindowState == FormWindowState.Maximized, false);
                _previewForm.Opacity = 1;

                _previewForm.CalculateSlides();
            }

            PreviewItemChanged?.Invoke(
                this,
                new PreviewItemChangedEventArgs
            {
                OutputItem = previewControl.OutputItem
            });
        }
Esempio n. 3
0
        public void ShowFloater(IFloaterSupportedForm sender, FloaterRequestedEventArgs e)
        {
            var afterBack = new Action <bool>(b =>
            {
                e.AfterBack?.Invoke();
                Utilities.ActivateForm(FormMain.Instance.Handle, b, false);
                Utilities.ActivateTaskbar();
            });

            _floater.ShowFloater(sender ?? FormMain.Instance, FormMain.Instance.Text, e.Logo ?? Resources.FloaterLogo, e.AfterShow, null, afterBack);
        }
        public void ActivateMainForm()
        {
            IntPtr mainFormHandle = IntPtr.Zero;
            var    processList    = Process.GetProcesses();

            foreach (var process in processList.Where(x => x.ProcessName.ToLower().Contains("6ms")).Where(process => process.MainWindowHandle.ToInt32() != 0))
            {
                mainFormHandle = process.MainWindowHandle;
                break;
            }
            Utilities.ActivateForm(mainFormHandle, false, false);
        }
Esempio n. 5
0
        public void ActivateMainForm(bool maximize = true)
        {
            var processList = Process.GetProcesses();

            foreach (var process in processList.Where(x => x.ProcessName.ToLower().Contains(String.Format("{0}seller", MediaMetaData.Instance.DataTypeString.ToLower()))))
            {
                if (process.MainWindowHandle.ToInt32() != 0)
                {
                    Utilities.ActivateForm(process.MainWindowHandle, maximize, false);
                    break;
                }
            }
        }
Esempio n. 6
0
        public void Print(FileInfo file)
        {
            var workBook = ExcelObject.Workbooks.Open(file.FullName);

            ExcelObject.Visible = true;
            var processList = Process.GetProcesses();

            foreach (var process in processList.Where(x => x.ProcessName.ToLower().Contains("excel")))
            {
                if (process.MainWindowHandle.ToInt32() != 0)
                {
                    Utilities.ActivateForm(process.MainWindowHandle, true, false);
                }
            }
            workBook.Application.Dialogs[XlBuiltInDialog.xlDialogPrint].Show();
        }
Esempio n. 7
0
        protected override IList <OutputGroup> GeneratePreviewData(IList <CaledarMonthOutputItem> monthItems)
        {
            var previewGroups = new List <OutputGroup>();

            FormProgress.SetTitle("Chill-Out for a few seconds...\nPreparing Calendar for Preview...");
            FormProgress.ShowProgress(FormMain);
            Enabled = false;
            foreach (var monthOutputItem in monthItems)
            {
                var tempPresentationPath = Path.Combine(Common.Core.Configuration.ResourceManager.Instance.TempFolder.LocalPath,
                                                        Path.GetFileName(Path.GetTempFileName()));
                var previewGroup = new OutputGroup
                {
                    Name      = monthOutputItem.DisplayName,
                    IsCurrent = monthOutputItem.IsCurrent,
                    Items     = new List <OutputItem>(new[]
                    {
                        new OutputItem
                        {
                            Name = monthOutputItem.DisplayName,
                            PresentationSourcePath = tempPresentationPath,
                            SlidesCount            = 1,
                            IsCurrent             = true,
                            SlideGeneratingAction = (processor, destinationPresentation) =>
                            {
                                processor.AppendCalendar(monthOutputItem.CalendarMonth.OutputData, destinationPresentation);
                            },
                            PreviewGeneratingAction = (processor, filePath) =>
                            {
                                processor.PrepareCalendarPreview(filePath, monthOutputItem.CalendarMonth.OutputData);
                            }
                        }
                    })
                };
                previewGroups.Add(previewGroup);
            }
            FormProgress.CloseProgress();
            Utilities.ActivateForm(Controller.Instance.FormMain.Handle, Controller.Instance.FormMain.WindowState == FormWindowState.Maximized, false);

            return(previewGroups);
        }