Ejemplo n.º 1
0
        private void Bind()
        {
            MailFromTextBox.Init(Context.GetAsContext(mAct.Context), mAct, nameof(ActeMail.MailFrom));
            xMailFromDisplayNameTextBox.Init(Context.GetAsContext(mAct.Context), mAct, nameof(ActeMail.MailFromDisplayName));
            MailToTextBox.Init(Context.GetAsContext(mAct.Context), mAct, nameof(ActeMail.Mailto));
            MailCCTextBox.Init(Context.GetAsContext(mAct.Context), mAct, nameof(ActeMail.Mailcc));
            SubjectTextBox.Init(Context.GetAsContext(mAct.Context), mAct, nameof(ActeMail.Subject));

            BodyTextBox.Init(Context.GetAsContext(mAct.Context), mAct, nameof(ActeMail.Body));
            BodyTextBox.AdjustHight(100);

            GingerCore.GeneralLib.BindingHandler.ObjFieldBinding(xSMTPPortTextBox, TextBox.TextProperty, mAct, nameof(ActeMail.Port));
            GingerCore.GeneralLib.BindingHandler.ObjFieldBinding(xSMTPPassTextBox, TextBox.TextProperty, mAct, nameof(ActeMail.Pass));
            xSMTPMailHostTextBox.Init(Context.GetAsContext(mAct.Context), mAct, nameof(ActeMail.Host));
            xSMTPUserTextBox.Init(Context.GetAsContext(mAct.Context), mAct, nameof(ActeMail.User));
            GingerCore.GeneralLib.BindingHandler.ActInputValueBinding(xcbEnableSSL, CheckBox.IsCheckedProperty, mAct.GetOrCreateInputParam(ActeMail.Fields.EnableSSL, "true"));
            GingerCore.GeneralLib.BindingHandler.ActInputValueBinding(xcbConfigureCredential, CheckBox.IsCheckedProperty, mAct.GetOrCreateInputParam(ActeMail.Fields.ConfigureCredential, "false"));
            GingerCore.GeneralLib.BindingHandler.ObjFieldBinding(AttachmentFilename, TextBox.TextProperty, mAct, nameof(ActeMail.AttachmentFileName));

            if (mAct.MailOption != null && mAct.MailOption == Email.eEmailMethod.OUTLOOK.ToString())
            {
                RadioOutlookMailOption.IsChecked = true;
            }
            else
            {
                RadioSMTPMailOption.IsChecked = true;
                if (string.IsNullOrEmpty(mAct.MailFromDisplayName))
                {
                    mAct.MailFromDisplayName = "_Amdocs Ginger Automation";
                }
            }
            ShowDisplayNameOption();
        }
Ejemplo n.º 2
0
        private void SaveButton_Click(object sender, EventArgs e)
        {
            notesTable.Rows.Add(TitleTextBox.Text, BodyTextBox.Text);

            TitleTextBox.Clear();
            BodyTextBox.Clear();
        }
Ejemplo n.º 3
0
 public RunSetActionSendFreeEmailEditPage(RunSetActionSendFreeEmail runSetActionSendFreeEmail)
 {
     InitializeComponent();
     if (runSetActionSendFreeEmail.Email == null)
     {
         runSetActionSendFreeEmail.Email = new Email();
     }
     MailFromTextBox.Init(runSetActionSendFreeEmail, RunSetActionHTMLReportSendEmail.Fields.MailFrom);
     MailToTextBox.Init(runSetActionSendFreeEmail, RunSetActionHTMLReportSendEmail.Fields.MailTo);
     MailCCTextBox.Init(runSetActionSendFreeEmail, RunSetActionHTMLReportSendEmail.Fields.MailCC);
     SubjectTextBox.Init(runSetActionSendFreeEmail, RunSetActionHTMLReportSendEmail.Fields.Subject);
     BodyTextBox.Init(runSetActionSendFreeEmail, RunSetActionHTMLReportSendEmail.Fields.Bodytext);
     BodyTextBox.AdjustHight(100);
     App.ObjFieldBinding(xSMTPPortTextBox, TextBox.TextProperty, runSetActionSendFreeEmail.Email, Email.Fields.SMTPPort);
     App.ObjFieldBinding(xSMTPPassTextBox, TextBox.TextProperty, runSetActionSendFreeEmail.Email, Email.Fields.SMTPPass);
     App.FillComboFromEnumVal(xEmailMethodComboBox, runSetActionSendFreeEmail.Email.EmailMethod);
     xSMTPMailHostTextBox.Init(runSetActionSendFreeEmail, RunSetActionHTMLReportSendEmail.Fields.MailHost);
     xSMTPUserTextBox.Init(runSetActionSendFreeEmail, RunSetActionHTMLReportSendEmail.Fields.MailUser);
     App.ObjFieldBinding(xEmailMethodComboBox, ComboBox.SelectedValueProperty, runSetActionSendFreeEmail.Email, Email.Fields.EmailMethod);
     App.ObjFieldBinding(xcbEnableSSL, CheckBox.IsCheckedProperty, runSetActionSendFreeEmail.Email, Email.Fields.EnableSSL);
     App.ObjFieldBinding(xcbConfigureCredential, CheckBox.IsCheckedProperty, runSetActionSendFreeEmail.Email, Email.Fields.ConfigureCredential);
     if (string.IsNullOrEmpty(runSetActionSendFreeEmail.MailTo))
     {
         runSetActionSendFreeEmail.MailFrom = App.UserProfile.UserEmail;
     }
 }
        public RunSetActionHTMLReportSendEmailEditPage(RunSetActionHTMLReportSendEmail runSetActionHTMLReportSendEmail)
        {
            InitializeComponent();
            this.runSetActionHTMLReportSendEmail = runSetActionHTMLReportSendEmail;
            if (runSetActionHTMLReportSendEmail.Email == null)
            {
                runSetActionHTMLReportSendEmail.Email = new Email();
            }
            MailFromTextBox.Init(null, runSetActionHTMLReportSendEmail, nameof(RunSetActionHTMLReportSendEmail.MailFrom));
            MailToTextBox.Init(null, runSetActionHTMLReportSendEmail, nameof(RunSetActionHTMLReportSendEmail.MailTo));
            MailCCTextBox.Init(null, runSetActionHTMLReportSendEmail, nameof(RunSetActionHTMLReportSendEmail.MailCC));
            SubjectTextBox.Init(null, runSetActionHTMLReportSendEmail, nameof(RunSetActionHTMLReportSendEmail.Subject));

            BodyTextBox.Init(null, runSetActionHTMLReportSendEmail, nameof(RunSetActionHTMLReportSendEmail.Bodytext));
            CommentTextBox.Init(null, runSetActionHTMLReportSendEmail, nameof(RunSetActionHTMLReportSendEmail.Comments));
            BodyTextBox.AdjustHight(100);
            App.ObjFieldBinding(xSMTPPortTextBox, TextBox.TextProperty, runSetActionHTMLReportSendEmail.Email, nameof(Email.SMTPPort));
            App.ObjFieldBinding(xSMTPPassTextBox, TextBox.TextProperty, runSetActionHTMLReportSendEmail.Email, nameof(Email.SMTPPass));
            App.FillComboFromEnumVal(xEmailMethodComboBox, runSetActionHTMLReportSendEmail.Email.EmailMethod);
            xSMTPMailHostTextBox.Init(null, runSetActionHTMLReportSendEmail, nameof(RunSetActionHTMLReportSendEmail.MailHost));
            xSMTPUserTextBox.Init(null, runSetActionHTMLReportSendEmail, nameof(RunSetActionHTMLReportSendEmail.MailUser));
            App.ObjFieldBinding(xEmailMethodComboBox, ComboBox.SelectedValueProperty, runSetActionHTMLReportSendEmail.Email, nameof(Email.EmailMethod));
            App.ObjFieldBinding(xcbEnableSSL, CheckBox.IsCheckedProperty, runSetActionHTMLReportSendEmail.Email, nameof(Email.EnableSSL));
            App.ObjFieldBinding(xcbConfigureCredential, CheckBox.IsCheckedProperty, runSetActionHTMLReportSendEmail.Email, nameof(Email.ConfigureCredential));
            if (string.IsNullOrEmpty(runSetActionHTMLReportSendEmail.MailTo))
            {
                runSetActionHTMLReportSendEmail.MailFrom = WorkSpace.UserProfile.UserEmail;
            }
            InitAttachmentsGrid();
            RadioButtonInit();
        }
Ejemplo n.º 5
0
        public RunSetActionSendFreeEmailEditPage(RunSetActionSendFreeEmail runSetActionSendFreeEmail)
        {
            InitializeComponent();
            if (runSetActionSendFreeEmail.Email == null)
            {
                runSetActionSendFreeEmail.Email = new Email();
            }

            RunsetActionDeliveryMethodConfigPageFrame.Content = new RunSetActionDeliveryMethodConfigPage(runSetActionSendFreeEmail.Email);
            Context context = new Context()
            {
                Environment = WorkSpace.Instance.RunsetExecutor.RunsetExecutionEnvironment
            };

            MailFromTextBox.Init(context, runSetActionSendFreeEmail, nameof(RunSetActionSendFreeEmail.MailFrom));
            MailToTextBox.Init(context, runSetActionSendFreeEmail, nameof(RunSetActionSendFreeEmail.MailTo));
            MailCCTextBox.Init(context, runSetActionSendFreeEmail, nameof(RunSetActionSendFreeEmail.MailCC));
            SubjectTextBox.Init(context, runSetActionSendFreeEmail, nameof(RunSetActionSendFreeEmail.Subject));
            BodyTextBox.Init(context, runSetActionSendFreeEmail, nameof(RunSetActionSendFreeEmail.Bodytext));
            BodyTextBox.AdjustHight(100);
            if (string.IsNullOrEmpty(runSetActionSendFreeEmail.MailTo))
            {
                runSetActionSendFreeEmail.MailFrom = WorkSpace.Instance.UserProfile.UserEmail;
            }
        }
Ejemplo n.º 6
0
        public RunSetActionHTMLReportSendEmailEditPage(RunSetActionHTMLReportSendEmail runSetActionHTMLReportSendEmail)
        {
            InitializeComponent();
            this.runSetActionHTMLReportSendEmail = runSetActionHTMLReportSendEmail;
            if (runSetActionHTMLReportSendEmail.Email == null)
            {
                runSetActionHTMLReportSendEmail.Email = new Email();
            }
            MailFromTextBox.Init(runSetActionHTMLReportSendEmail, RunSetActionHTMLReportSendEmail.Fields.MailFrom);
            MailToTextBox.Init(runSetActionHTMLReportSendEmail, RunSetActionHTMLReportSendEmail.Fields.MailTo);
            MailCCTextBox.Init(runSetActionHTMLReportSendEmail, RunSetActionHTMLReportSendEmail.Fields.MailCC);
            SubjectTextBox.Init(runSetActionHTMLReportSendEmail, RunSetActionHTMLReportSendEmail.Fields.Subject);

            BodyTextBox.Init(runSetActionHTMLReportSendEmail, RunSetActionHTMLReportSendEmail.Fields.Bodytext);
            CommentTextBox.Init(runSetActionHTMLReportSendEmail, RunSetActionHTMLReportSendEmail.Fields.Comments);
            BodyTextBox.AdjustHight(100);
            App.ObjFieldBinding(SMTPMailHostTextBox, TextBox.TextProperty, runSetActionHTMLReportSendEmail.Email, Email.Fields.SMTPMailHost);
            App.ObjFieldBinding(SMTPPortTextBox, TextBox.TextProperty, runSetActionHTMLReportSendEmail.Email, Email.Fields.SMTPPort);
            App.ObjFieldBinding(SMTPUserTextBox, TextBox.TextProperty, runSetActionHTMLReportSendEmail.Email, Email.Fields.SMTPUser);
            App.ObjFieldBinding(SMTPPassTextBox, TextBox.TextProperty, runSetActionHTMLReportSendEmail.Email, Email.Fields.SMTPPass);
            App.FillComboFromEnumVal(EmailMethodComboBox, runSetActionHTMLReportSendEmail.Email.EmailMethod);
            App.ObjFieldBinding(EmailMethodComboBox, ComboBox.SelectedValueProperty, runSetActionHTMLReportSendEmail.Email, Email.Fields.EmailMethod);
            App.ObjFieldBinding(cbEnableSSL, CheckBox.IsCheckedProperty, runSetActionHTMLReportSendEmail.Email, Email.Fields.EnableSSL);
            InitAttachmentsGrid();
            RadioButtonInit();
        }
Ejemplo n.º 7
0
        private void ReadSlide(object sender, EventArgs e)
        {
            if (NoPowerPoint())
            {
                ofd = new OpenFileDialog {
                    Filter = powerpointformat
                };
                try
                { if (ofd.ShowDialog() == DialogResult.OK)
                  {
                      file_path = ofd.FileName;
                  }
                  else
                  {
                      return;
                  } } catch (SystemException exc)
                { MessageBox.Show(open_err_msg + ofd.FileName + ":\n\n" + exc);
                  return; } finally { ofd.Dispose(); }

                PowerPoint_App      = new Ppt.Application();
                multi_presentations = PowerPoint_App.Presentations;
                presentation        = multi_presentations.Open(file_path, MsoTriState.msoFalse, MsoTriState.msoFalse, MsoTriState.msoTrue);
            }

            TitleBox.Text    = string.Empty;
            BodyTextBox.Text = string.Empty;
            layout           = Active_slide.Layout;

            if (layout == Ppt.PpSlideLayout.ppLayoutText)
            {
                TitleBox.Text    = Active_slide.Shapes[1].TextFrame.TextRange.Text;
                BodyTextBox.Text = Active_slide.Shapes[2].TextFrame.TextRange.Text;
            }
            else
            {
                foreach (var item in presentation.Slides[1].Shapes)
                {
                    var shape = (Ppt.Shape)item;
                    if (shape.HasTextFrame != MsoTriState.msoTrue)
                    {
                        continue;
                    }

                    if (shape.Name.Contains("Title"))
                    {
                        TitleBox.Text += shape.TextFrame.TextRange.Text + ' ';
                        box_list.Insert(0, shape.Name);
                    }

                    else if (shape.TextFrame.HasText == MsoTriState.msoTrue)
                    {
                        IDataObject clipped = Clipboard.GetDataObject();
                        shape.TextFrame.TextRange.Copy();
                        BodyTextBox.Paste();
                        Clipboard.SetDataObject(clipped, true);
                        box_list.Add(shape.Name);
                    }
                }
            }
        }
Ejemplo n.º 8
0
 private void ProductsGrid_SelectionChanged(object sender, SelectionChangedEventArgs e)
 {
     currentProduct           = (Product)e.AddedItems[0];
     TitleTextBox.DataContext = currentProduct.ProductDescriptors[0];
     TitleTextBox.SetBinding(TextBox.TextProperty, "Title");
     BodyTextBox.DataContext = currentProduct.ProductDescriptors[0];
     BodyTextBox.SetBinding(TextBox.TextProperty, "Body");
     relateds = WrapRelateds(currentProduct, from p in catalog.Products select p);
     RelatedGrid.ItemsSource = relateds;
 }
Ejemplo n.º 9
0
        private void Save(object sender, EventArgs e)
        {
            try
            { if (NoPowerPoint())
              {
                  SaveFileDialog sfd = new SaveFileDialog {
                      Filter = powerpointformat
                  };
                  try
                  { if (sfd.ShowDialog() == DialogResult.OK)
                                {
                                    file_path = sfd.FileName;
                                }
                                else
                                {
                                    return;
                                } } catch (SystemException exc)
                  { MessageBox.Show(save_err_msg + sfd.FileName + ":\n\n" + exc);
                                return; } finally { sfd.Dispose(); }

                  CreateNewPresentation();
              }
              else
              {
                  foreach (var item in presentation.Slides[1].Shapes)
                  {
                      var shape = (Ppt.Shape)item;
                      if (shape.HasTextFrame != MsoTriState.msoTrue)
                      {
                          continue;
                      }

                      if (shape.Name == box_list[0])
                      {
                          shape.TextFrame.TextRange.Text = TitleBox.Text;
                      }

                      else if (box_list.Contains(shape.Name))
                      {
                          IDataObject clipped = Clipboard.GetDataObject();
                          BodyTextBox.SelectAll();
                          BodyTextBox.Copy();
                          shape.TextFrame.TextRange.Paste();
                          Clipboard.SetDataObject(clipped, true);
                      }
                  }
              }

              presentation.SaveAs(file_path); } catch (ArgumentException exc)
            { MessageBox.Show(save_err_msg + file_path + ":\n\n" + exc); }
        }
        // Method to add textspeak meaning. Searches textword csv file, and returns expanded abbreviation
        private string Textspeak()
        {
            var rows = File.ReadAllLines("Data/textwords.csv").Select(l => l.Split(',').ToArray()).ToArray(); // Split csv file by delimiter and add to string array

            // Loop iterates through string array, and checks if the textbox contains abbreviation contained
            // in the array. If it does, adds abbreviation and its meaning to string variable
            for (int i = 0; i < rows.GetLength(0); i++)
            {
                if (BodyTextBox.Contains(rows[i][0]))
                {
                    newMessage  = BodyTextBox.Replace(rows[i][0].ToString(), rows[i][0].ToString() + "<" + rows[i][1].ToString() + ">"); // Add abbreviation and meaning to string
                    saveRegular = true;
                }
            }

            return(newMessage); // return string
        }
Ejemplo n.º 11
0
 private void UnHideMainComp()
 {
     dataGridView1.Show();
     LoggedInfLabel.Show();
     LoggedEmailInf.Show();
     LogoutButton.Show();
     UpdateLabel.Show();
     SubjectLabel.Show();
     SubjectTextB.Show();
     RecipientLabel.Show();
     RecipientTextBox.Show();
     BodyLabel.Show();
     BodyTextBox.Show();
     SendButton.Show();
     MailSaveButton.Show();
     DeserializeButton.Show();
     RefreshButton.Show();
 }
        // This method splits up the information held in the bodt textbox depending on wether it
        // is a URL or not. If it finds a URL, it removes the URL and replaces it with a quarantined message
        #region Quarantine Method
        private string QuarantineURL()
        {
            string swap = "";

            var links = BodyTextBox.Split("\t\n ".ToCharArray(), StringSplitOptions.RemoveEmptyEntries).Where(s => s.StartsWith("http://") || s.StartsWith("www.") || s.StartsWith("https://") ||
                                                                                                              s.StartsWith("HTTP://") || s.StartsWith("WWW.") || s.StartsWith("HTTPS://"));

            foreach (string s in links)
            {
                if (BodyTextBox.Contains(s))
                {
                    swap = BodyTextBox.Replace(s, "<URL Quarantined>");

                    saveRegular = true;
                }
            }
            //MessageBox.Show(swap);
            return(swap);
        }
Ejemplo n.º 13
0
        private void Write(object sender, EventArgs e)
        {
            bool new_presentation = NoPowerPoint();

            try
            { if (new_presentation)
              {
                  if (!CreateNewPresentation())
                  {
                      return;                                                                //If there is no presentation open create one, but return if the user cancels.
                  }
              }
              foreach (var item in presentation.Slides[1].Shapes)
              {
                  var shape = (Ppt.Shape)item;
                  if (shape.HasTextFrame != msoTrue)
                  {
                      continue;
                  }

                  if (shape.Name.Contains("Title"))
                  {
                      shape.TextFrame.TextRange.Text = TitleBox.Text;
                  }

                  else
                  {
                      IDataObject clipped = Clipboard.GetDataObject();
                      BodyTextBox.SelectAll();
                      BodyTextBox.Copy();
                      shape.TextFrame.TextRange.Paste();
                      Clipboard.SetDataObject(clipped, true);
                  }
              }

              if (new_presentation)
              {
                  try { presentation.SaveAs(file_path); }
                  catch (FileNotFoundException)
                  { MessageBox.Show(save_err_msg + file_path + " (invalid name)."); }
              }
              catch (System.Runtime.InteropServices.COMException exc)
              { MessageBox.Show(save_err_msg + file_path + ":\n\n" + exc); } } catch (System.Runtime.InteropServices.COMException exc)
Ejemplo n.º 14
0
        private void ReadSlide(object sender, EventArgs e)
        {
            if (NoPowerPoint())
            {
                if (!LoadPresentation())
                {
                    return;                                                  //If there is no presentation open load one, but return if the user cancels.
                }
            }
            TitleBox.Clear();
            BodyTextBox.Clear();
            BodyTextBox.ZoomFactor = 1f;            //This line is to alleviate a bug in the RichTextBox class that
            //^prevents display of the proper ZoomFactor after clearing it.

            foreach (var item in presentation.Slides[1].Shapes)
            {
                var shape = (Ppt.Shape)item;
                if (shape.HasTextFrame != msoTrue)
                {
                    continue;
                }

                if (shape.Name.Contains("Title"))
                {
                    TitleBox.Text += shape.TextFrame.TextRange.Text + ' ';
                }

                else if (shape.TextFrame.HasText == msoTrue)
                {
                    IDataObject clipped = Clipboard.GetDataObject();
                    shape.TextFrame.TextRange.Copy();
                    BodyTextBox.Paste();
                    //if (BodyTextBox.Font.SizeInPoints > 17f) BodyTextBox.ZoomFactor = 0.5f;
                    if (shape.TextFrame.TextRange.Font.Size > 17f)
                    {
                        BodyTextBox.ZoomFactor = 0.5f;
                    }
                    Clipboard.SetDataObject(clipped, true);
                }
            }
        }
Ejemplo n.º 15
0
        public RunSetActionSendSMSEditPage(RunSetActionSendSMS runSetActionSendSMS)
        {
            InitializeComponent();

            if (runSetActionSendSMS.SMSEmail == null)
            {
                runSetActionSendSMS.SMSEmail = new Email();
            }

            RunsetActionDeliveryMethodConfigPageFrame.Content = new RunSetActionDeliveryMethodConfigPage(runSetActionSendSMS.SMSEmail);
            Context context = new Context()
            {
                Environment = WorkSpace.Instance.RunsetExecutor.RunsetExecutionEnvironment
            };

            MailFromTextBox.Init(context, runSetActionSendSMS.SMSEmail, nameof(Email.MailFrom));
            MailToTextBox.Init(context, runSetActionSendSMS.SMSEmail, nameof(Email.MailTo));
            SubjectTextBox.Init(context, runSetActionSendSMS.SMSEmail, nameof(Email.Subject));
            BodyTextBox.Init(context, runSetActionSendSMS.SMSEmail, nameof(Email.Body));
            BodyTextBox.AdjustHight(100);
        }
Ejemplo n.º 16
0
        public RunSetActionHTMLReportSendEmailEditPage(RunSetActionHTMLReportSendEmail runSetActionHTMLReportSendEmail)
        {
            InitializeComponent();
            this.runSetActionHTMLReportSendEmail = runSetActionHTMLReportSendEmail;
            if (runSetActionHTMLReportSendEmail.Email == null)
            {
                runSetActionHTMLReportSendEmail.Email = new Email();
            }

            RunsetActionDeliveryMethodConfigPageFrame.Content = new RunSetActionDeliveryMethodConfigPage(runSetActionHTMLReportSendEmail.Email);
            Context context = new Context()
            {
                Environment = WorkSpace.Instance.RunsetExecutor.RunsetExecutionEnvironment
            };

            MailFromTextBox.Init(context, runSetActionHTMLReportSendEmail, nameof(RunSetActionHTMLReportSendEmail.MailFrom));
            MailToTextBox.Init(context, runSetActionHTMLReportSendEmail, nameof(RunSetActionHTMLReportSendEmail.MailTo));
            MailCCTextBox.Init(context, runSetActionHTMLReportSendEmail, nameof(RunSetActionHTMLReportSendEmail.MailCC));
            SubjectTextBox.Init(context, runSetActionHTMLReportSendEmail, nameof(RunSetActionHTMLReportSendEmail.Subject));
            BodyTextBox.Init(context, runSetActionHTMLReportSendEmail, nameof(RunSetActionHTMLReportSendEmail.Bodytext));
            CommentTextBox.Init(context, runSetActionHTMLReportSendEmail, nameof(RunSetActionHTMLReportSendEmail.Comments));

            xMailFromDisplayNameTextBox.Init(context, runSetActionHTMLReportSendEmail, nameof(RunSetActionHTMLReportSendEmail.MailFromDisplayName));

            BodyTextBox.AdjustHight(100);

            if (string.IsNullOrEmpty(runSetActionHTMLReportSendEmail.MailTo))
            {
                runSetActionHTMLReportSendEmail.MailFrom = WorkSpace.Instance.UserProfile.UserEmail;
            }
            if (string.IsNullOrEmpty(runSetActionHTMLReportSendEmail.MailFromDisplayName))
            {
                runSetActionHTMLReportSendEmail.MailFromDisplayName = "_Amdocs Ginger Automation";
            }
            InitAttachmentsGrid();
            RadioButtonInit();
            ShowDisplayNameOption();
        }
Ejemplo n.º 17
0
 private void Bind()
 {
     MailFromTextBox.Init(Context.GetAsContext(mAct.Context), mAct, nameof(ActeMail.MailFrom));
     MailToTextBox.Init(Context.GetAsContext(mAct.Context), mAct, nameof(ActeMail.Mailto));
     MailCCTextBox.Init(Context.GetAsContext(mAct.Context), mAct, nameof(ActeMail.Mailcc));
     SubjectTextBox.Init(Context.GetAsContext(mAct.Context), mAct, nameof(ActeMail.Subject));
     BodyTextBox.Init(Context.GetAsContext(mAct.Context), mAct, nameof(ActeMail.Body));
     App.ObjFieldBinding(xSMTPPortTextBox, TextBox.TextProperty, mAct, nameof(ActeMail.Port));
     App.ObjFieldBinding(xSMTPPassTextBox, TextBox.TextProperty, mAct, nameof(ActeMail.Pass));
     xSMTPMailHostTextBox.Init(Context.GetAsContext(mAct.Context), mAct, nameof(ActeMail.Host));
     xSMTPUserTextBox.Init(Context.GetAsContext(mAct.Context), mAct, nameof(ActeMail.User));
     GingerCore.General.ActInputValueBinding(xcbEnableSSL, CheckBox.IsCheckedProperty, mAct.GetOrCreateInputParam(ActeMail.Fields.EnableSSL, "true"));
     GingerCore.General.ActInputValueBinding(xcbConfigureCredential, CheckBox.IsCheckedProperty, mAct.GetOrCreateInputParam(ActeMail.Fields.ConfigureCredential, "false"));
     App.ObjFieldBinding(AttachmentFilename, TextBox.TextProperty, mAct, nameof(ActeMail.AttachmentFileName));
     if (mAct.MailOption != null && mAct.MailOption == Email.eEmailMethod.OUTLOOK.ToString())
     {
         RadioOutlookMailOption.IsChecked = true;
     }
     else
     {
         RadioSMTPMailOption.IsChecked = true;
     }
 }
Ejemplo n.º 18
0
        public RunSetActionSendFreeEmailEditPage(RunSetActionSendFreeEmail runSetActionSendFreeEmail)
        {
            mRunSetActionSendFreeEmail = runSetActionSendFreeEmail;
            InitializeComponent();
            if (mRunSetActionSendFreeEmail.Email == null)
            {
                mRunSetActionSendFreeEmail.Email = new Email();
            }

            RunsetActionDeliveryMethodConfigPageFrame.Content = new RunSetActionDeliveryMethodConfigPage(mRunSetActionSendFreeEmail.Email);
            Context context = new Context()
            {
                Environment = WorkSpace.Instance.RunsetExecutor.RunsetExecutionEnvironment
            };

            MailFromTextBox.Init(context, mRunSetActionSendFreeEmail, nameof(RunSetActionSendFreeEmail.MailFrom));
            xMailFromDisplayNameTextBox.Init(context, mRunSetActionSendFreeEmail, nameof(RunSetActionSendFreeEmail.MailFromDisplayName));
            MailToTextBox.Init(context, mRunSetActionSendFreeEmail, nameof(RunSetActionSendFreeEmail.MailTo));
            MailCCTextBox.Init(context, mRunSetActionSendFreeEmail, nameof(RunSetActionSendFreeEmail.MailCC));
            SubjectTextBox.Init(context, mRunSetActionSendFreeEmail, nameof(RunSetActionSendFreeEmail.Subject));
            BodyTextBox.Init(context, mRunSetActionSendFreeEmail, nameof(RunSetActionSendFreeEmail.Bodytext));
            BodyTextBox.AdjustHight(100);

            if (string.IsNullOrEmpty(mRunSetActionSendFreeEmail.MailTo))
            {
                mRunSetActionSendFreeEmail.MailFrom = WorkSpace.Instance.UserProfile.UserEmail;
            }

            if (mRunSetActionSendFreeEmail.Email.EmailMethod == Email.eEmailMethod.SMTP)
            {
                if (string.IsNullOrEmpty(mRunSetActionSendFreeEmail.MailFromDisplayName))
                {
                    mRunSetActionSendFreeEmail.MailFromDisplayName = "_Amdocs Ginger Automation";
                }
            }
            ShowDisplayNameOption();
        }
Ejemplo n.º 19
0
        //sends messages, checks validation and writes messages on a .csv file
        private void SendButtonClick()
        {
            //lists that hold text found in the text
            List <string> hashtags      = new List <string>();
            List <string> mentions      = new List <string>();
            List <string> quarantined   = new List <string>();
            List <string> sirs          = new List <string>();
            Abbreviations abbreviations = new Abbreviations();

            //Check if textboxes are empty
            if (string.IsNullOrWhiteSpace(HeaderTextBox) || (string.IsNullOrWhiteSpace(BodyTextBox)))
            {
                MessageBox.Show("Please fill in the header and body textboxes appropriately", "Error", MessageBoxButton.OK, MessageBoxImage.Error);
                return;
            }
            //Check if the message is an Sms with validations
            else if ((HeaderTextBox[0] == 'S') && (HeaderTextBox.Length == 10))
            {
                for (int id = 1; id < HeaderTextBox.Length; id++)
                {
                    if (!char.IsDigit(HeaderTextBox[id]))
                    {
                        MessageBox.Show("Message Id should contain only numbers.", "Error", MessageBoxButton.OK, MessageBoxImage.Error);
                        return;
                    }
                }
                int    findspace = BodyTextBox.IndexOf(" ");
                string stopAt;
                //space found then write twitter sender id and continue with message
                if (findspace > 0)
                {
                    stopAt = BodyTextBox.Substring(0, findspace);

                    string sms_sender = stopAt;
                    //check for a valid mobile phone number
                    string phoneNumber = @"^(\+[0-9]{15})$";

                    if (!Regex.IsMatch(sms_sender, phoneNumber) && (sms_sender.Length < 15))
                    {
                        MessageBox.Show("SMS message body must begin with the senders international phone number.", "Error", MessageBoxButton.OK, MessageBoxImage.Error);
                        return;
                    }

                    //Assign sms sender and body to strings
                    string sms_body = BodyTextBox.Substring(16);
                    //check text length
                    if ((sms_body.Length <= 140) && (sms_body.Length > 0))
                    {
                        sms_body = abbreviations.ExpandSMS(sms_body);

                        // create new sms message
                        Sms message = new Sms()
                        {
                            Header = HeaderTextBox,
                            Sender = sms_sender,
                            Body   = sms_body,
                            MType  = "Sms"
                        };
                        //Save sms message to Json format
                        SaveToFile save    = new SaveToFile();
                        var        smslist = save.LoadJsonSms();
                        smslist.Add(message);
                        string resultJson = JsonConvert.SerializeObject(smslist);
                        File.WriteAllText("sms.json", resultJson);

                        //check if json file exists
                        if (!File.Exists("sms.json"))
                        {
                            MessageBox.Show("Error while saving\n" + save.ErrorCode);
                        }
                        else
                        {
                            MessageBox.Show("Sms Message Send and saved", "Success", MessageBoxButton.OK);
                            save = null;
                        }
                        //prints message
                        MessageBox.Show($"Message type: {message.MType}" +
                                        $"\nMessageID: {message.Header}" +
                                        $"\nSender: {message.Sender}" +
                                        $"\nText: {message.Body}", "Your" + message.MType + "message have been send", MessageBoxButton.OK);
                    }
                    else
                    {
                        MessageBox.Show("Sms text must be up to 140 characters long or empty!", "Error", MessageBoxButton.OK, MessageBoxImage.Error);
                    }
                }
                else
                {
                    MessageBox.Show("Sms body should start with a valid international phone number", "Error", MessageBoxButton.OK, MessageBoxImage.Error);
                }
            }
            //check if it is a Twitter message with validations
            else if ((HeaderTextBox[0] == 'T') && (HeaderTextBox.Length == 10))
            {
                for (int id = 1; id < HeaderTextBox.Length; id++)
                {
                    //valid messageID?
                    if (!char.IsDigit(HeaderTextBox[id]))
                    {
                        MessageBox.Show("Message Id type letter must be followed by 9 numberic characters. Please try again!", "Error", MessageBoxButton.OK, MessageBoxImage.Error);
                        return;
                    }
                }
                //checks if the sender twitterID is typed first in body
                if (BodyTextBox[0] == '@')
                {
                    int    findspace = BodyTextBox.IndexOf(" ");
                    string stopAt;
                    //space found then write twitter sender id and continue with message
                    if (findspace > 0)
                    {
                        stopAt = BodyTextBox.Substring(0, findspace);

                        string tweet_sender_id = stopAt;
                        string tweetid         = @"^@?(\w){1,15}$";

                        if (Regex.IsMatch(tweet_sender_id, tweetid))
                        {
                            int space = BodyTextBox.IndexOf(" ");

                            string tweet_body = BodyTextBox.Substring(space + 1);
                            if ((tweet_body.Length <= 140) && (tweet_body.Length > 0))
                            {
                                tweet_body = abbreviations.ExpandTweet(tweet_body);
                                //save any mentions found in tweet body to a list
                                foreach (Match match in Regex.Matches(input: tweet_body, pattern: @"(?<!\w)@\w+"))
                                {
                                    mentions.Add(match.Value);
                                    File.AppendAllText("mentions.csv", match.Value + Environment.NewLine);
                                }
                                //save any hashtags found in tweet body to a list
                                foreach (Match match in Regex.Matches(input: tweet_body, pattern: @"(?<!\w)#\w+"))
                                {
                                    hashtags.Add(match.Value);
                                    File.AppendAllText("hashtags.csv", match.Value + Environment.NewLine);
                                }

                                //add new twitter message
                                Tweet message = new Tweet()
                                {
                                    Header = HeaderTextBox,
                                    Sender = tweet_sender_id,
                                    Body   = tweet_body,
                                    MType  = "Tweet"
                                };
                                //Save file to Json format
                                SaveToFile save      = new SaveToFile();
                                var        tweetlist = save.LoadJsonTweet();
                                tweetlist.Add(message);
                                string resultJson = JsonConvert.SerializeObject(tweetlist);
                                File.WriteAllText("tweet.json", resultJson);

                                //check if json file exists
                                if (!File.Exists("tweet.json"))
                                {
                                    MessageBox.Show("Error while saving\n" + save.ErrorCode);
                                }
                                else
                                {
                                    MessageBox.Show("Tweet Message Send and saved", "Success", MessageBoxButton.OK);
                                    save = null;
                                }
                                //print message
                                MessageBox.Show($"Message type: {message.MType}" +
                                                $"\nMessageID: {message.Header}" +
                                                $"\nSender: {message.Sender}" +
                                                $"\nText: {message.Body}", "Your" + message.MType + "message have been send", MessageBoxButton.OK);

                                //print hashtag list and mention list
                                var hashtagslist = string.Join(Environment.NewLine, hashtags);
                                MessageBox.Show("Trending List:" + Environment.NewLine + hashtagslist, "Hashtag List", MessageBoxButton.OK, MessageBoxImage.Asterisk);
                                var mentionslist = string.Join(Environment.NewLine, mentions);
                                MessageBox.Show("Mention List:" + Environment.NewLine + mentionslist, "Mention List", MessageBoxButton.OK, MessageBoxImage.Asterisk);
                            }
                            else
                            {
                                MessageBox.Show("Tweet text must be no longer than 140 characters and cant be empty!", "Error", MessageBoxButton.OK, MessageBoxImage.Error);
                            }
                        }
                        else
                        {
                            MessageBox.Show("Tweet Body must begin with your Twitter ID. @ followed by maximum 15 characters", "Error", MessageBoxButton.OK, MessageBoxImage.Error);
                        }
                    }
                    else
                    {
                        MessageBox.Show("Please allow a space after your TwitterID!", "Error", MessageBoxButton.OK, MessageBoxImage.Error);
                    }
                }
                else
                {
                    MessageBox.Show("Tweet Body must begin with senders TwitterID. (ex. @AlexAn) ", "Error", MessageBoxButton.OK, MessageBoxImage.Error);
                }
            }
            //check for email validations
            else if ((HeaderTextBox[0] == 'E') && (HeaderTextBox.Length == 10))
            {
                for (int id = 1; id < HeaderTextBox.Length; id++)
                {
                    //check if the 9 characters are digits
                    if (!char.IsDigit(HeaderTextBox[id]))
                    {
                        MessageBox.Show("Message Id should contain only numbers.", "Error", MessageBoxButton.OK, MessageBoxImage.Error);
                        return;
                    }
                }
                int    findspace    = BodyTextBox.IndexOf(" ");
                int    findFullStop = BodyTextBox.IndexOf(". ");
                string stopAtFullStop;
                string stopAt;
                //space found then write email address and continue with subject
                if (findspace > 0)
                {
                    stopAt = BodyTextBox.Substring(0, findspace);
                    string sender_email = stopAt;

                    if (IsValidEmail(sender_email))
                    {
                        if (findFullStop > 0)
                        {
                            stopAtFullStop = BodyTextBox.Substring(findspace, findFullStop - findspace);
                            string email_subject = stopAtFullStop;
                            string SIRPattern    = "^ +[S|s]+[I|i]+[R|r]+ \\d{2}/\\d{2}/\\d{2}$";

                            if ((Regex.IsMatch(email_subject, SIRPattern)) && (email_subject.Length <= 20))
                            {
                                string bodyStartAtFullStop = BodyTextBox.Substring(findFullStop + 1);
                                string email_body          = bodyStartAtFullStop;

                                if ((email_body.Length <= 1029) && (email_body.Length > 0))
                                {
                                    foreach (Match match in Regex.Matches(input: email_body, pattern: @"\b\d\d-\d\d-\d\d\b|\bTheft\b"))
                                    {
                                        sirs.Add(match.Value);
                                        File.AppendAllText("sir.csv", match.Value + Environment.NewLine);
                                    }
                                    // add links found to a list
                                    foreach (Match match in Regex.Matches(input: email_body, pattern: @"\b(?:https?://|www\.)\S+\b"))
                                    {
                                        quarantined.Add(match.Value);
                                        File.AppendAllText("quarantined.csv", match.Value + Environment.NewLine);
                                    }
                                    //replace links found within email body
                                    email_body = Regex.Replace(email_body, @"\b(?:https?://|www\.)\S+\b", "<URL Quarantined>");

                                    //creates new email message
                                    SIR message = new SIR()
                                    {
                                        Header  = HeaderTextBox,
                                        Sender  = sender_email,
                                        Subject = email_subject,
                                        Body    = email_body,
                                        MType   = "SIR"
                                    };

                                    //Save email message to json
                                    SaveToFile save    = new SaveToFile();
                                    var        sirlist = save.LoadJsonSir();
                                    sirlist.Add(message);
                                    string resultJson = JsonConvert.SerializeObject(sirlist);
                                    File.WriteAllText("sir.json", resultJson);

                                    //check if file exists
                                    if (!File.Exists("sir.json"))
                                    {
                                        MessageBox.Show("Error while saving\n" + save.ErrorCode);
                                    }
                                    else
                                    {
                                        MessageBox.Show("SIR Message Send and saved", "Success", MessageBoxButton.OK);
                                        save = null;
                                    }
                                    //print message
                                    MessageBox.Show($"Message type: {message.MType}" +
                                                    $"\nMessageID: {message.Header}" +
                                                    $"\nSender: {message.Sender}" +
                                                    $"\nMessage Subject:{message.Subject}" +
                                                    $"\nText:{message.Body}", "Your" + message.MType + "message have been send", MessageBoxButton.OK);
                                    //print quarantined URLs
                                    var quarantinedlist = string.Join(Environment.NewLine, quarantined);
                                    MessageBox.Show("Quarantined urls List:" + Environment.NewLine + quarantinedlist, "Quarantined URL(s) added to the List", MessageBoxButton.OK, MessageBoxImage.Asterisk);
                                    var sirs_list = string.Join(Environment.NewLine, sirs);
                                    MessageBox.Show("Sir List:" + Environment.NewLine + sirs_list, "Sir List", MessageBoxButton.OK, MessageBoxImage.Asterisk);
                                }
                                else
                                {
                                    MessageBox.Show("SIR Body text must be no longer than 1028 characters!", "Error", MessageBoxButton.OK, MessageBoxImage.Error);
                                }
                            }
                            else if (email_subject.Length <= 20)
                            {
                                string bodyStartAtFullStop = BodyTextBox.Substring(findFullStop + 1);
                                string email_body          = bodyStartAtFullStop;
                                if (email_body.Length <= 1029)
                                {
                                    // add links found to a list
                                    foreach (Match match in Regex.Matches(input: email_body, pattern: @"\b(?:https?://|www\.)\S+\b"))
                                    {
                                        quarantined.Add(match.Value);
                                        File.AppendAllText("quarantined.csv", match.Value + Environment.NewLine);
                                    }
                                    //replace links found within email body
                                    email_body = Regex.Replace(email_body, @"\b(?:https?://|www\.)\S+\b", "<URL Quarantined>");
                                    //creates new email message
                                    Email message = new Email()
                                    {
                                        Header  = HeaderTextBox,
                                        Sender  = sender_email,
                                        Subject = email_subject,
                                        Body    = email_body,
                                        MType   = "Email"
                                    };

                                    //Save file to Json format
                                    SaveToFile save      = new SaveToFile();
                                    var        emaillist = save.LoadJsonEmail();
                                    emaillist.Add(message);
                                    string resultJson = JsonConvert.SerializeObject(emaillist);
                                    File.WriteAllText("email.json", resultJson);
                                    //check if file exists
                                    if (!File.Exists("email.json"))
                                    {
                                        MessageBox.Show("Error while saving\n" + save.ErrorCode);
                                    }
                                    else
                                    {
                                        MessageBox.Show("Email Message Send and saved", "Success", MessageBoxButton.OK);
                                        save = null;
                                    }
                                    //print message
                                    MessageBox.Show($"Message type: {message.MType}" +
                                                    $"\nMessageID: {message.Header}" +
                                                    $"\nSender: {message.Sender}" +
                                                    $"\nMessage Subject:{message.Subject}" +
                                                    $"\nText:{message.Body}", "Your" + message.MType + "message have been send", MessageBoxButton.OK);
                                    //print quarantined URLs
                                    var quarantinedlist = string.Join(Environment.NewLine, quarantined);
                                    MessageBox.Show("Quarantined urls List:" + Environment.NewLine + quarantinedlist, "Quarantined URLs List", MessageBoxButton.OK, MessageBoxImage.Asterisk);
                                }
                                else
                                {
                                    MessageBox.Show("Email Body text must be no longer than 1028 characters!", "Error", MessageBoxButton.OK, MessageBoxImage.Error);
                                }
                            }
                            else
                            {
                                MessageBox.Show("Email Subject must be no longer than 20 characters!", "Error", MessageBoxButton.OK, MessageBoxImage.Error);
                            }
                        }
                        else
                        {
                            MessageBox.Show("Please mind that subject should be less than 20 characters long, and remember to seperate subject and message with a full stop and a space!", "Error", MessageBoxButton.OK, MessageBoxImage.Error);
                        }
                    }
                    else
                    {
                        MessageBox.Show("Email Body must begin with a valid Email address.", "Error", MessageBoxButton.OK, MessageBoxImage.Error);
                    }
                }
                else
                {
                    MessageBox.Show("Email Body must begin with a valid Email address followed by a space.", "Error", MessageBoxButton.OK, MessageBoxImage.Error);
                }
            }
            else
            {
                MessageBox.Show("MessageID is not valid. Please enter a valid messageID maximum 10 characters long.\n" +
                                "First character will indicate the message type and the rest must be numeric characters.\n" +
                                "ex. S123456789 for SMS, T876543210 for Tweets, E147258360 for Emails!", "Error", MessageBoxButton.OK, MessageBoxImage.Error);
                return;
            }
        }
Ejemplo n.º 20
0
 private void QuickMailSender_Loaded(object sender, RoutedEventArgs e)
 {
     BodyTextBox.SelectAll();
     BodyTextBox.Focus();
 }
Ejemplo n.º 21
0
 private void QuickMailSender_Activated(object sender, EventArgs e)
 {
     BodyTextBox.Focus();
 }
Ejemplo n.º 22
0
        // This method contains the functionality to be executed when button is pressed.
        // It ensures all fileds are filled before sending, creates and saves an tweet object,
        // and provides expanded form of any abbreviations. It also takes mentions and hashtags
        // from body and saves them to trends file
        private void SendButtonClick()
        {
            List <string> CsvLines = new List <String>(); // list to hold information to be sent to trends file

            Textspeak();                                  // Call Textspeak method

            // If statement prompts user to fill in all fields before message can be sent, by checking if the
            // component is empty
            if (string.IsNullOrWhiteSpace(HeaderTextBox) || string.IsNullOrWhiteSpace(SenderTextBox) || string.IsNullOrWhiteSpace(BodyTextBox))
            {
                MessageBox.Show("Please Enter All Values");
                return;
            }

            // Split body text and save strings that begin with an '@' or '#' to trnds file
            var links = BodyTextBox.Split("\t\n ".ToCharArray(), StringSplitOptions.RemoveEmptyEntries).Where(s => s.StartsWith("@") || s.StartsWith("#"));

            foreach (string s in links)
            {
                CsvLines.Add(s);
                File.AppendAllLines("Data/trends.csv", CsvLines);
            }

            // If statement checks if body contains textspeak abbreviation, if true creates new object and adds
            // textspeak, then saves to json file
            if (saveRegular == true)
            {
                Tweet tweetMessage = new Tweet()
                {
                    Header = HeaderTextBox,
                    Sender = SenderTextBox,
                    Body   = newMessage
                };

                SaveToFile save = new SaveToFile();

                // If cannot be saved display error message, otherwise save file
                if (!save.ToJsonTweet(tweetMessage))
                {
                    MessageBox.Show("Error While Saving\n" + save.ErrorCode);
                }
                else
                {
                    MessageBox.Show("Order Saved");
                    save = null;
                }
            }

            // If statement checks if body contains textspeak abbreviation, if false creates new object and saves standard body,
            // then saves to json file
            if (saveRegular == false)
            {
                Tweet tweetMessage = new Tweet()
                {
                    Header = HeaderTextBox,
                    Sender = SenderTextBox,
                    Body   = BodyTextBox
                };

                SaveToFile save = new SaveToFile();

                // If cannot be saved display error message, otherwise save file
                if (!save.ToJsonTweet(tweetMessage))
                {
                    MessageBox.Show("Error While Saving\n" + save.ErrorCode);
                }
                else
                {
                    MessageBox.Show("Order Saved");
                    save = null;
                }
            }
        }
Ejemplo n.º 23
0
 private void NewButton_Click(object sender, EventArgs e)
 {
     TitleTextBox.Clear();
     BodyTextBox.Clear();
 }