private void SaveTemplateCommand_Executed(object parameter)
        {
            if ((TabVMs.Count > SelectedTabIndex) && TabVMs[SelectedTabIndex] is BinaryTemplateTabViewModel templateTabViewModel)
            {
                FileDialogEventArgs fileDialogEventArgs = new FileDialogEventArgs()
                {
                    Title  = TranslationManager.Instance.GetResourceText("SaveTemplate"),
                    Filter = TranslationManager.Instance.GetResourceText("FileDialogFilter_Templates") + " (*.xml)|*.xml"
                };

                FileDialogRequested?.Invoke(this, fileDialogEventArgs);

                string templateFile = fileDialogEventArgs.File;
                if (!string.IsNullOrWhiteSpace(templateFile))
                {
                    if (templateTabViewModel.SaveTemplateToFile(templateFile))
                    {
                        // TODO
                    }
                    else
                    {
                        // TODO
                    }
                }
            }
        }
        private void LoadTemplateCommand_Executed(object parameter)
        {
            FileDialogEventArgs fileDialogEventArgs = new FileDialogEventArgs()
            {
                Title  = TranslationManager.Instance.GetResourceText("SelectTemplate"),
                Filter = TranslationManager.Instance.GetResourceText("FileDialogFilter_Templates") + " (*.xml)|*.xml"
            };

            FileDialogRequested?.Invoke(this, fileDialogEventArgs);

            string templateFile = fileDialogEventArgs.File;

            if (!string.IsNullOrWhiteSpace(templateFile))
            {
                BinaryTemplateTabViewModel loadedTemplate = new BinaryTemplateTabViewModel(templateFile);

                if (loadedTemplate.LoadTemplateFromFile(templateFile))
                {
                    AddNewTab(loadedTemplate);
                }
                else
                {
                    // TODO!
                }
            }
        }
 protected void OnFileDialogRequested(FileDialogEventArgs e)
 {
     FileDialogRequested?.Invoke(this, e);
 }
        private void OpenBinaryFileCommand_Executed(object parameter)
        {
            // check for list of files in command parameter:
            string binaryFile = null;

            if (parameter != null)
            {
                binaryFile = parameter as string;
            }

            // if no file in parameters -> select binary file via dialog:
            if (string.IsNullOrWhiteSpace(binaryFile))
            {
                FileDialogEventArgs fileDialogBinaryEventArgs = new FileDialogEventArgs()
                {
                    Title  = TranslationManager.Instance.GetResourceText("SelectBinaryFile"),
                    Filter = TranslationManager.Instance.GetResourceText("FileDialogFilter_Binary") + " (*.*)|*.*"
                };

                FileDialogRequested?.Invoke(this, fileDialogBinaryEventArgs);

                binaryFile = fileDialogBinaryEventArgs.File;
            }

            if (!string.IsNullOrWhiteSpace(binaryFile))
            {
                // first check if there is any matching template in default template directory:
                BinaryDataTemplate template = templateManager.GetMatchingTemplate(binaryFile);

                if (template == null)
                {
                    // otherwise -> select template file via dialog:
                    FileDialogEventArgs fileDialogTemplateEventArgs = new FileDialogEventArgs()
                    {
                        Title  = TranslationManager.Instance.GetResourceText("SelectTemplate"),
                        Filter = TranslationManager.Instance.GetResourceText("FileDialogFilter_Templates") + " (*.xml)|*.xml"
                    };

                    FileDialogRequested?.Invoke(this, fileDialogTemplateEventArgs);

                    string templateFile = fileDialogTemplateEventArgs.File;
                    if (!string.IsNullOrWhiteSpace(templateFile))
                    {
                        template = templateManager.GetTemplate(templateFile);
                    }
                }

                if (template != null)
                {
                    string tabHeader = "";
                    try
                    {
                        tabHeader = Path.GetFileName(binaryFile);
                    }
                    catch
                    {
                        tabHeader = binaryFile;
                    }

                    var newTab = new BinaryDataTabViewModel(tabHeader, binaryFile, template);
                    AddNewTab(newTab);
                }
            }

            // TODO: stattdessen eigener Dialog zur Auswahl von Binärdatei und Template!

            // OpenBinaryFileWindowEventArgs eventArgs = new OpenBinaryFileWindowEventArgs()
            // OpenBinaryFileWindowRequested?.Invoke(this, eventArgs);

            // if (eventArgs.DialogResult)
            // {
            //     string binaryFile = eventArgs.BinaryFilePath;
            //  string templateFile = eventArgs.TemplatePath;
            //     var newTab = new BinaryDataTabViewModel("binary file", binaryFile, templateFile);
            //     AddNewTab(newTab);
            // }
        }