private void NewFileButton_Click(object sender, EventArgs e)
 {
     sapi5engine.SpeakAsyncCancelAll();
     sapi5engine.Resume();
     playButton.Enabled             = true;
     pauseButton.Enabled            = false;
     stopButton.Enabled             = false;
     playToolStripMenuItem.Enabled  = true;
     pauseToolStripMenuItem.Enabled = false;
     stopToolStripMenuItem.Enabled  = false;
     if (changesMade)
     {
         DialogResult r = MessageBox.Show("Changes were made. Do you wish to save your changes before starting a new file?", "OutLoud Text Reader", MessageBoxButtons.YesNoCancel, MessageBoxIcon.Question);
         if (r != DialogResult.Cancel)
         {
             if (r == DialogResult.Yes)
             {
                 AttemptSave(false);
             }
         }
         else
         {
             return;
         }
     }
     MainTextBox.Clear();
     MainTextBox.ClearUndo();
     changesMade = false;
     fileName    = "";
 }
Exemplo n.º 2
0
        private void AsciiButton_Checked(object sender, RoutedEventArgs e)
        {
            Dispatcher.Invoke(DispatcherPriority.Normal, new Action(delegate
            {
                if (MainTextBox != null)
                {
                    MainTextBox.Clear();

                    foreach (var packet in packets)
                    {
                        if (packet.type == true && RecieveStringNoti.IsChecked == true)      // receive
                        {
                            MainTextBox.Text += " <<< " + packet.message;
                        }
                        else if (packet.type == false && SendStringNoti.IsChecked == true)   // send
                        {
                            MainTextBox.Text += " >>> " + packet.message;
                        }
                        MainTextBox.Text += Environment.NewLine;
                    }
                }
                if (Transmit_box != null)
                {
                    string prev_string = Transmit_box.Text;
                    Transmit_box.Clear();
                    Transmit_box.Text = ConvertHexToCharString(prev_string);
                }
            }));
        }
 /// <summary>
 /// Open a new text file in Noteplaid.
 /// </summary>
 /// <param name="sender">Sender object</param>
 /// <param name="e">Arguments passed</param>
 private void NewCommand_Executed(object sender, System.Windows.Input.ExecutedRoutedEventArgs e)
 {
     // Should check for saving...
     MainTextBox.Clear();
     this.currOpenFile = null;
     this.UpdateTitle(null);
 }
        private void OpenButton_Click(object sender, EventArgs e)
        {
            sapi5engine.SpeakAsyncCancelAll();
            sapi5engine.Resume();
            playButton.Enabled             = true;
            pauseButton.Enabled            = false;
            stopButton.Enabled             = false;
            playToolStripMenuItem.Enabled  = true;
            pauseToolStripMenuItem.Enabled = false;
            stopToolStripMenuItem.Enabled  = false;
            if (changesMade)
            {
                DialogResult r = MessageBox.Show("Changes were made. Do you wish to save your changes before opening another file?", "OutLoud Text Reader", MessageBoxButtons.YesNoCancel, MessageBoxIcon.Question);
                if (r != DialogResult.Cancel)
                {
                    if (r == DialogResult.Yes)
                    {
                        AttemptSave(false);
                    }
                }
                else
                {
                    return;
                }
            }
            if (openFileDialog1.ShowDialog() == DialogResult.OK)
            {
                try
                {
                    MainTextBox.Clear();

                    fileName         = openFileDialog1.FileName;
                    MainTextBox.Text = File.ReadAllText(fileName);
                    MainTextBox.ClearUndo();
                    changesMade = false;
                }
                catch (FileLoadException x)
                {
                    MessageBox.Show($"There was an error loading the file: {x.Message}", "OutLoud Text Reader", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    MainTextBox.Clear();
                    MainTextBox.ClearUndo();
                    changesMade = false;
                    return;
                }
                catch (Exception x)
                {
                    MessageBox.Show($"PLEASE REPORT THIS PROBLEM!\nException message: {x.Message}\nSource: {x.Source}\n--Stack Trace--\n{x.StackTrace}", "OutLoud Text Reader", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    MainTextBox.Clear();
                    MainTextBox.ClearUndo();
                    changesMade = false;
                }
            }
        }
 private void CancelButton_Click(object sender, EventArgs e)
 {
     try
     {
         MainTextBox.Clear();
         this.DialogResult = DialogResult.No;
     }
     catch (Exception ex)
     {
         CommonItem.ErrManger.ErrorManagement(ex, false, this);
     }
 }
Exemplo n.º 6
0
        public void FillInAdditionalInformationDummyData(string input)
        {
            input = "Lorem ipsum dolor sit amet, consectetur adipiscing elit, " +
                    "sed do eiusmod tempor incididunt ut labore et dolore magna aliqua." +
                    " Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi" +
                    " ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit " +
                    "in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur " +
                    "sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit" +
                    " anim id est laborum.";

            MainTextBox.Clear();
            MainTextBox.SendKeys(input);
        }
 private void newToolStripMenuItem_Click(object sender, EventArgs e)
 {
     if(MainTextBox.Text != null)
     {
         DialogResult result =  MessageBox.Show("You do want to save before opening a new file", "", MessageBoxButtons.YesNo);
         if(result == DialogResult.Yes)
         {
             saveToolStripMenuItem_Click(sender, e);
         }
         if(result == DialogResult.No)
         {
             MainTextBox.Clear();
         }
     }    
 }
Exemplo n.º 8
0
        }// function end

        /// <summary>
        /// (Abrir) Open Text file
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void abrirToolStripMenuItem_Click(object sender, EventArgs e)
        {
            OpenFileDialog File = new OpenFileDialog();

            File.Filter = "Text Files |*.txt";
            if (File.ShowDialog() == DialogResult.OK)
            {
                MainTextBox.Clear();
                StreamReader Reader = new StreamReader(File.OpenFile());
                MainTextBox.Text = Reader.ReadToEnd();
            }
            else
            {
                MessageBox.Show("Error Opening file ", "unknown Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }// function end
Exemplo n.º 9
0
        private void buttonLoadSchemaTest_Click(object sender, EventArgs e)
        {
            string filePath = "C:\\GitHub\\XMLConfigurationEditor\\Resource\\XMLSchema.xsd";

            string xsdResult = "";

            // try to load the file
            try
            {
                xsdResult = xmlHandler.LoadSchemaFromFile(filePath);
            }
            catch (System.Exception ex)
            {
                string exString = "Error: " + ex.Message;
                MessageBox.Show(exString);
                return;
            }

            MainTextBox.Clear();
            MainTextBox.Text = xsdResult;
        }
Exemplo n.º 10
0
        private void LoadFileButton_Click(object sender, EventArgs e)
        {
            // create an OpenFileDialog
            OpenFileDialog dialog = new OpenFileDialog();

            // set it's filter to only look at xml files
            dialog.Filter = "XML files (*.xml)|*.xml";

            // show it
            DialogResult dialogResult = dialog.ShowDialog();

            if (dialogResult != DialogResult.OK)
            {
                return;
            }

            // get the path from the dialog
            string filePath = dialog.FileName;

            // create a cXmlHandler
            cXMLHandler xmlHandler = new cXMLHandler();
            string      xmlResult  = "";

            // try to load the file
            try
            {
                xmlResult = xmlHandler.LoadXMLFileToString(filePath);
            }
            catch (System.Exception ex)
            {
                string exString = "Error: " + ex.Message;
                MessageBox.Show(exString);
                return;
            }

            MainTextBox.Clear();
            MainTextBox.Text = xmlResult;
        }
Exemplo n.º 11
0
        /// <summary>
        /// Checking if date is saved or will ask you to save
        /// </summary>
        /// <param name="menu"></param>
        public void AskForSaving(MenuItem menu)
        {
            MessageBoxResult answer;

            switch (menu.Header)
            {
            case "New":
                answer = MessageBox.Show("You don´t have saved your work! Do you want to save your work?", "Exit", MessageBoxButton.YesNo, MessageBoxImage.Warning);
                if (answer == MessageBoxResult.No)
                {
                    MainTextBox.Clear();
                }
                break;

            case "Exit":
                answer = MessageBox.Show("You don´t have saved your work! Do you want to exit anyway", "Exit", MessageBoxButton.YesNo, MessageBoxImage.Warning);
                if (answer == MessageBoxResult.Yes)
                {
                    Application.Current.Shutdown();
                }
                break;
            }
        }
Exemplo n.º 12
0
        private void buttonTestLoad_Click(object sender, EventArgs e)
        {
            string filePath = "C:\\GitHub\\XMLConfigurationEditor\\Resource\\books.xml";

            string xmlResult = "";

            // try to load the file
            try
            {
                xmlResult = xmlHandler.LoadXMLFileToString(filePath);
            }
            catch (System.Exception ex)
            {
                string exString = "Error: " + ex.Message;
                MessageBox.Show(exString);
                return;
            }

            MainTextBox.Clear();
            MainTextBox.Text = xmlResult;

            List <string> schemaWarnings = xmlHandler.GetWarnings();

            if (schemaWarnings.Count != 0)
            {
                for (int idxWarning = 0; idxWarning < schemaWarnings.Count; idxWarning++)
                {
                    string       warning      = schemaWarnings[idxWarning] + " Show Next Warning?";
                    string       caption      = "Warning " + Convert.ToString(idxWarning) + " of " + Convert.ToString(schemaWarnings.Count);
                    DialogResult dialogResult = MessageBox.Show(warning, caption, MessageBoxButtons.YesNo);
                    if (dialogResult == DialogResult.No)
                    {
                        break;
                    }
                }
            }
        }
 private void frmAddText_Load(object sender, EventArgs e)
 {
     MainTextBox.Clear();
 }
Exemplo n.º 14
0
 private void button1_Click(object sender, EventArgs e)
 {
     MainTextBox.Clear();
     MainTextBox.Refresh();
 }
Exemplo n.º 15
0
        private void Menu_Click(object sender, RoutedEventArgs e)
        {
            if (sender is MenuItem menu)
            {
                switch (menu.Header)
                {
                // ---Under File
                case "New": CheckIfStringIsEmpty(); if (didYouSave == true)
                    {
                        MainTextBox.Clear();
                    }
                    else
                    {
                        AskForSaving(menu);
                    } break;

                case "Exit": CheckIfStringIsEmpty(); if (didYouSave == true)
                    {
                        Application.Current.Shutdown();
                    }
                    else
                    {
                        AskForSaving(menu);
                    } break;

                case "Print": print = new Print(MainTextBox); break;

                case "New Window": MainWindow mainExtra = new MainWindow(); mainExtra.Show(); break;

                case "Save": sal.SaveFile(); break;

                case "Save As": sal.SaveFileAs(); break;

                case "Open": sal.LoadFile(); break;

                // ---Under Edit
                case "Undo": ur = new UndoAndRedo(MainTextBox); ur.UndoMethod(); break;

                case "Redo": ur = new UndoAndRedo(MainTextBox); ur.RedoMethod(); break;

                case "Cut": editTools = new EditTools(MainTextBox); editTools.CutMethod(); break;

                case "Copy": editTools = new EditTools(MainTextBox); editTools.CopyMethod(); break;

                case "Paste": editTools = new EditTools(MainTextBox); editTools.PasteMethod(); break;

                case "Select all": editTools = new EditTools(MainTextBox); editTools.SelectAllMethod(); break;

                case "Search": Search search = new Search(MainTextBox); search.Show(); break;

                case "Search web": if (MainTextBox.SelectionLength > 0)
                    {
                        SearchWebb SWebb = new SearchWebb(MainTextBox); SWebb.SearchWebbMethod();
                    }
                    else
                    {
                        return;
                    } break;

                case "Set read only": if (menu.IsChecked == true)
                    {
                        MainTextBox.IsReadOnly = true;
                    }
                    else
                    {
                        MainTextBox.IsReadOnly = false;
                    } break;
                }
            }
        }
Exemplo n.º 16
0
 private void newToolStripMenuItem_Click(object sender, EventArgs e)
 {
     path = string.Empty;
     MainTextBox.Clear();
 }