Beispiel #1
0
        private void _NewFile_Click(object sender, RoutedEventArgs e)
        {
            int index = TabItemManipulate.GetIndex;

            RichTextBox richTextBox = RichTExtBoxCreatetor.CreateRichTextBox(item_Click_Close,
                                                                             RichTextBox_DragOver,
                                                                             RichTextBox_Drop,
                                                                             RichTextBox_TextChanged
                                                                             );

            TabItemManipulate.NewTabItem("Новый файл " + index, richTextBox, _ControlBox);
        }
Beispiel #2
0
        //private void ClrPcker_Background_OnSelectedColorChanged(object sender, RoutedPropertyChangedEventArgs<Color?> e)
        //{
        //    if (_ControlBox != null)
        //    {
        //        TabItem tab = _ControlBox.SelectedItem as TabItem;
        //        RichTextBox RtextBox = tab.Content as RichTextBox;
        //        Color? C = ClrPcker_Background.SelectedColor.Value as Color?;
        //        RtextBox.Selection.ApplyPropertyValue(Inline.ForegroundProperty, Brush.C);
        //    }
        //}
        private void CommandBinding_Open(object sender, ExecutedRoutedEventArgs e)
        {
            OpenFileDialog openFileDialog = new OpenFileDialog();

            openFileDialog.Filter = "Text file| *.txt";
            openFileDialog.Title  = "Open text file";

            RichTextBox richTextBox = RichTExtBoxCreatetor.CreateRichTextBox(item_Click_Close,
                                                                             RichTextBox_DragOver,
                                                                             RichTextBox_Drop,
                                                                             RichTextBox_TextChanged
                                                                             );

            if (openFileDialog.ShowDialog() == true)
            {
                TabItemManipulate.NewTabItem(openFileDialog.FileName, richTextBox, _ControlBox);

                RichTextBox currentRichTextBox = TabItemManipulate.GetCurrentRichTextBox(_ControlBox);

                currentRichTextBox.Selection.Text = File.ReadAllText(openFileDialog.FileName);

                LastFileSaver.AddFilePath(openFileDialog.FileName);
            }
        }