public MainWindow()
        {
            InitializeComponent();
            VM = TryFindResource("VM") as S7_ViewModel;
            VM.InitFromCommandLineArguments(App.StartupArgs);

            // Set title of window to current assembly version number
            Version myVersion = System.Reflection.Assembly.GetExecutingAssembly().GetName().Version;
            if (ApplicationDeployment.IsNetworkDeployed)
            {
                // Override version if deployed via ClickOnce
                myVersion = ApplicationDeployment.CurrentDeployment.CurrentVersion;
            }

            this.Title = this.Title + " v" + myVersion.Major + "." + myVersion.Minor + "." + myVersion.Build;
            Closing += VM.OnClosing;
        }
        public MainWindow()
        {
            InitializeComponent();
            VM = TryFindResource("VM") as S7_ViewModel;
            VM.InitFromCommandLineArguments(App.StartupArgs);

            // Set title of window to current assembly version number
            Version myVersion = System.Reflection.Assembly.GetExecutingAssembly().GetName().Version;

            if (ApplicationDeployment.IsNetworkDeployed)
            {
                // Override version if deployed via ClickOnce
                myVersion = ApplicationDeployment.CurrentDeployment.CurrentVersion;
            }

            this.Title = this.Title + " v" + myVersion.Major + "." + myVersion.Minor + "." + myVersion.Build;
            Closing   += VM.OnClosing;
        }