示例#1
0
        void SelectBreadcrumbCommand_Executed(object sender, Apex.MVVM.CommandEventArgs args)
        {
            var breadcrumbElement = args.Parameter as DisassembledEntity;

            if (breadcrumbElement != null)
            {
                SelectedEntity = breadcrumbElement;
            }
        }
        void UninstallAssemblyCommand_Executed(object sender, Apex.MVVM.CommandEventArgs args)
        {
            //  The parameter must be an assembly.
            var assemblyViewModel = (GACAssemblyViewModel)args.Parameter;

            //  Create an assembly cache.
            IASSEMBLYCACHE_UNINSTALL_DISPOSITION disposition = IASSEMBLYCACHE_UNINSTALL_DISPOSITION.Unknown;

            AssemblyCache.UninstallAssembly(assemblyViewModel.InternalAssemblyDescription.DisplayName,
                                            null, out disposition);

            //  Depending on the result, show the appropriate message.
            string message = string.Empty;

            switch (disposition)
            {
            case IASSEMBLYCACHE_UNINSTALL_DISPOSITION.Unknown:
                message = "Failed to uninstall assembly.";
                break;

            case IASSEMBLYCACHE_UNINSTALL_DISPOSITION.IASSEMBLYCACHE_UNINSTALL_DISPOSITION_UNINSTALLED:
                message = "The assembly was uninstalled successfully!";
                break;

            case IASSEMBLYCACHE_UNINSTALL_DISPOSITION.IASSEMBLYCACHE_UNINSTALL_DISPOSITION_STILL_IN_USE:
                message = "Cannot uninstall this assembly - it is in use.";
                break;

            case IASSEMBLYCACHE_UNINSTALL_DISPOSITION.IASSEMBLYCACHE_UNINSTALL_DISPOSITION_ALREADY_UNINSTALLED:
                message = "Cannot uninstall this assembly - it has already been uninstalled.";
                break;

            case IASSEMBLYCACHE_UNINSTALL_DISPOSITION.IASSEMBLYCACHE_UNINSTALL_DISPOSITION_DELETE_PENDING:
                message = "Cannot uninstall this assembly - it has has a delete pending.";
                break;

            case IASSEMBLYCACHE_UNINSTALL_DISPOSITION.IASSEMBLYCACHE_UNINSTALL_DISPOSITION_HAS_INSTALL_REFERENCES:
                message = "Cannot uninstall this assembly - it was installed as part of another product.";
                break;

            case IASSEMBLYCACHE_UNINSTALL_DISPOSITION.IASSEMBLYCACHE_UNINSTALL_DISPOSITION_REFERENCE_NOT_FOUND:
                message = "Cannot uninstall this assembly - cannot find the assembly.";
                break;

            default:
                break;
            }

            //  Remove the assembly from the vm.
            ViewModel.Assemblies.Remove(assemblyViewModel);
            ViewModel.AssembliesCollectionView.Refresh();

            //  Show the message box.
            MessageBox.Show(message, "Uninstall");
        }
        /// <summary>
        /// Handles the Executed event of the OpenAssemblyLocationCommand control.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="args">The <see cref="Apex.MVVM.CommandEventArgs"/> instance containing the event data.</param>
        void OpenAssemblyLocationCommand_Executed(object sender, Apex.MVVM.CommandEventArgs args)
        {
            //  Get the assembly.
            var assemblyViewModel = (GACAssemblyViewModel)args.Parameter;

            //  Try and open it's path.
            try
            {
                Process.Start(System.IO.Path.GetDirectoryName(assemblyViewModel.Path));
            }
            catch (Exception exception)
            {
                Trace.WriteLine("Failed to open directory: " + exception);
            }
        }
        void ShowAssemblyDetailsCommand_Executed(object sender, Apex.MVVM.CommandEventArgs args)
        {
            //  Get the assembly view model.
            var assemblyViewModel = args.Parameter as GACAssemblyViewModel;

            //  If we don't have one, bail.
            if (assemblyViewModel == null)
            {
                return;
            }

            //  Create a new assembly details window.
            var assemblyDetailsWindow = new AssemblyDetails.AssemblyDetailsWindow();

            assemblyDetailsWindow.AssemblyViewModel = assemblyViewModel;

            //  Show the window.
            assemblyDetailsWindow.ShowDialog();
        }
        void InstallAssemblyCommand_Executed(object sender, Apex.MVVM.CommandEventArgs args)
        {
            //  Create an open file dialog.
            var openFileDialog = new OpenFileDialog();

            openFileDialog.Title  = "Select Assembly to Install";
            openFileDialog.Filter = "Assemblies (*.dll)|*.dll";
            if (openFileDialog.ShowDialog() == true)
            {
                //  Get the assembly path.
                var assemblyPath = openFileDialog.FileName;

                //  Install the assembly.
                try
                {
                    AssemblyCache.InstallAssembly(assemblyPath, null, GACManagerApi.Fusion.AssemblyCommitFlags.Force);
                }
                catch (AssemblyMustBeStronglyNamedException)
                {
                    MessageBox.Show("Failed to install the assembly - it is not strongly named.", "Install");
                }
                catch
                {
                    MessageBox.Show("Failed to install the assembly.", "Install");
                }

                //  Load the assembly.


                //var enumerator =
                //    new AssemblyCacheEnumerator(System.IO.Path.GetFileNameWithoutExtension(openFileDialog.FileName));
                //var assembly = enumerator.GetNextAssembly();
                //var vm = new GACAssemblyViewModel();
                //vm.FromModel(new AssemblyDescription(assembly));
                //ViewModel.Assemblies.Add(vm);
                //ViewModel.AssembliesCollectionView.
            }
        }
示例#6
0
 /// <summary>
 /// Handles the Executed event of the SettingsCommand control.
 /// </summary>
 /// <param name="sender">The source of the event.</param>
 /// <param name="args">The <see cref="Apex.MVVM.CommandEventArgs"/> instance containing the event data.</param>
 private void SettingsCommand_Executed(object sender, Apex.MVVM.CommandEventArgs args)
 {
     mainPivot.SelectedPivotItem = mainPivot.PivotItems[3];
 }
示例#7
0
 /// <summary>
 /// Handles the Executed event of the GoToCasinoCommand control.
 /// </summary>
 /// <param name="sender">The source of the event.</param>
 /// <param name="args">The <see cref="Apex.MVVM.CommandEventArgs"/> instance containing the event data.</param>
 void GoToCasinoCommand_Executed(object sender, Apex.MVVM.CommandEventArgs args)
 {
     mainPivot.SelectedPivotItem = mainPivot.PivotItems[1];
 }
示例#8
0
 /// <summary>
 /// Handles the Executed event of the CancelCommand control.
 /// </summary>
 /// <param name="sender">The source of the event.</param>
 /// <param name="args">The <see cref="Apex.MVVM.CommandEventArgs"/> instance containing the event data.</param>
 void CancelCommand_Executed(object sender, Apex.MVVM.CommandEventArgs args)
 {
     DialogResult = false;
     Close();
 }
示例#9
0
 /// <summary>
 /// Handles the Executed event of the GoToKlondikeSolitaireCommand control.
 /// </summary>
 /// <param name="sender">The source of the event.</param>
 /// <param name="args">The <see cref="Apex.MVVM.CommandEventArgs"/> instance containing the event data.</param>
 void GoToKlondikeSolitaireCommand_Executed(object sender, Apex.MVVM.CommandEventArgs args)
 {
     mainPivot.SelectedPivotItem = mainPivot.PivotItems[0];
 }
示例#10
0
 /// <summary>
 /// Handles the Executed event of the ClearOutputCommand control.
 /// </summary>
 /// <param name="sender">The source of the event.</param>
 /// <param name="args">The <see cref="Apex.MVVM.CommandEventArgs"/> instance containing the event data.</param>
 void ClearOutputCommand_Executed(object sender, Apex.MVVM.CommandEventArgs args)
 {
     consoleControl.ClearOutput();
 }
示例#11
0
 /// <summary>
 /// Handles the Executed event of the StopProcessCommand control.
 /// </summary>
 /// <param name="sender">The source of the event.</param>
 /// <param name="args">The <see cref="Apex.MVVM.CommandEventArgs"/> instance containing the event data.</param>
 void StopProcessCommand_Executed(object sender, Apex.MVVM.CommandEventArgs args)
 {
     consoleControl.StopProcess();
     UpdateProcessState();
 }
示例#12
0
 /// <summary>
 /// Handles the Executed event of the StartNewProcessCommand control.
 /// </summary>
 /// <param name="sender">The source of the event.</param>
 /// <param name="args">The <see cref="Apex.MVVM.CommandEventArgs"/> instance containing the event data.</param>
 void StartNewProcessCommand_Executed(object sender, Apex.MVVM.CommandEventArgs args)
 {
 }
示例#13
0
 /// <summary>
 /// Handles the Executed event of the StartCommandPromptCommand control.
 /// </summary>
 /// <param name="sender">The source of the event.</param>
 /// <param name="args">The <see cref="Apex.MVVM.CommandEventArgs"/> instance containing the event data.</param>
 void StartCommandPromptCommand_Executed(object sender, Apex.MVVM.CommandEventArgs args)
 {
     consoleControl.StartProcess("cmd.exe", string.Empty);
     UpdateProcessState();
 }
示例#14
0
 void OKCommand_Executed(object sender, Apex.MVVM.CommandEventArgs args)
 {
     DialogResult = true;
     Close();
 }
 void HelpCommand_Executed(object sender, Apex.MVVM.CommandEventArgs args)
 {
     System.Diagnostics.Process.Start(Properties.Resources.ProjectHomePageUrl);
 }
示例#16
0
 /// <summary>
 /// Handles the Executed event of the GoToSpiderSolitaireCommsand control.
 /// </summary>
 /// <param name="sender">The source of the event.</param>
 /// <param name="args">The <see cref="Apex.MVVM.CommandEventArgs"/> instance containing the event data.</param>
 void GoToSpiderSolitaireCommsand_Executed(object sender, Apex.MVVM.CommandEventArgs args)
 {
     mainPivot.SelectedPivotItem = mainPivot.PivotItems[2];
 }
示例#17
0
 /// <summary>
 /// Handles the Executed event of the ClearOutputCommand control.
 /// </summary>
 /// <param name="sender">The source of the event.</param>
 /// <param name="args">The <see cref="Apex.MVVM.CommandEventArgs"/> instance containing the event data.</param>
 void ClearOutputCommand_Executed(object sender, Apex.MVVM.CommandEventArgs args)
 {
 }