private void Button_DeleteWidget_Click(object sender, RoutedEventArgs e)
        {
            if (ListBoxFiles.SelectedItem != null)
            {
                string fileName     = ((CustomWidget)ListBoxFiles.SelectedItem).FileName;
                string filePathInfo = ((CustomWidget)ListBoxFiles.SelectedItem).FilePathInfo;

                List <FileItem> fileItemsList = JsonWorker.DeserializationFileItemsJson(JsonWorker.JsonFileItems);
                FileItem        fileItem      = fileItemsList.First(x => x.Name == fileName && x.Path == filePathInfo);
                fileItemsList.Remove(fileItem);

                JsonWorker.JsonFileItems = JsonWorker.SerializationFileItemsJson(fileItemsList);

                File.WriteAllText(JsonWorker.JsonFilePath, JsonWorker.JsonFileItems);

                ListBoxFiles.Items.Remove(ListBoxFiles.SelectedItem);
            }
        }
        private void Button_CreateNewWidget_Click(object sender, RoutedEventArgs e)
        {
            OpenFileDialog fileDialog = new OpenFileDialog()
            {
                Filter = "Текстовые файлы (*.txt)|*.txt",
            };

            if (fileDialog.ShowDialog() == true)
            {
                FileInfo fileInfo = new FileInfo(fileDialog.FileName);

                FileItem fileItem = new FileItem()
                {
                    Name = fileInfo.Name,
                    Path = fileInfo.DirectoryName
                };

                List <FileItem> fileItemsList = JsonWorker.DeserializationFileItemsJson(JsonWorker.JsonFileItems);
                fileItemsList.Add(fileItem);

                JsonWorker.JsonFileItems = JsonWorker.SerializationFileItemsJson(fileItemsList);

                using (FileStream stream = new FileStream(JsonWorker.JsonFilePath, FileMode.OpenOrCreate))
                {
                    byte[] array = Encoding.Default.GetBytes(JsonWorker.JsonFileItems);
                    stream.Write(array, 0, array.Length);
                }

                CustomWidget newWidget = new CustomWidget()
                {
                    FileName     = fileItem.Name,
                    FilePathInfo = fileItem.Path,
                    Width        = 400
                };

                ListBoxFiles.Items.Add(newWidget);

                newWidget.IsEnabledTextBoxFileName     = false;
                newWidget.IsEnabledTextBoxFilePathInfo = false;
                newWidget.VisibilityButtonCloseFile    = true;
                newWidget.OpenFileStatus = true;

                Process process = new Process
                {
                    StartInfo           = new ProcessStartInfo("notepad", Path.Combine(fileItem.Path, fileItem.Name)),
                    EnableRaisingEvents = true
                };

                process.Exited += (x, y) =>
                {
                    Dispatcher.Invoke(() =>
                    {
                        newWidget.IsEnabledTextBoxFileName     = true;
                        newWidget.IsEnabledTextBoxFilePathInfo = true;
                        newWidget.VisibilityButtonCloseFile    = false;
                        newWidget.OpenFileStatus = false;
                    });
                };

                newWidget.OpenedFile = process;
                process.Start();
            }
        }