Esempio n. 1
0
        private void AddApplicationCommand()
        {
            var applicationViewModel = new MyApplicationViewModel();

            var applicationDialog = new ApplicationDialog(applicationViewModel)
            {
                Owner = OptionsView.CurrentInstance,
                WindowStartupLocation = WindowStartupLocation.CenterOwner
            };

            if (applicationDialog.ShowDialog() == true)
            {
                Applications.Add(applicationViewModel);
            }
        }
Esempio n. 2
0
        private void ProcessFilenameAndAddApplication(string filename, bool asAdmin = false)
        {
            var fileInfo = new FileInfo(filename);

            var fileVersionInfo = FileVersionInfo.GetVersionInfo(fileInfo.FullName);

            var applicationViewModel = new MyApplicationViewModel
            {
                ApplicationName =
                    string.IsNullOrEmpty(fileVersionInfo.FileDescription) ? fileInfo.Name : fileVersionInfo.FileDescription,
                Path            = fileInfo.FullName,
                RunAsLocalAdmin = asAdmin
            };

            Applications.Add(applicationViewModel);
        }
Esempio n. 3
0
        private void EditApplicationCommand()
        {
            var applicationViewModel = new MyApplicationViewModel
            {
                ApplicationName = SelectedApplicationViewModel.ApplicationName,
                Path            = SelectedApplicationViewModel.Path,
                RunAsLocalAdmin = SelectedApplicationViewModel.RunAsLocalAdmin
            };

            var applicationDialog = new ApplicationDialog(applicationViewModel)
            {
                Owner = OptionsView.CurrentInstance,
                WindowStartupLocation = WindowStartupLocation.CenterOwner
            };

            if (applicationDialog.ShowDialog() == true)
            {
                SelectedApplicationViewModel.Path            = applicationViewModel.Path;
                SelectedApplicationViewModel.RunAsLocalAdmin = applicationViewModel.RunAsLocalAdmin;
            }
        }