private async void InstallModuleButton_Click(object sender, RoutedEventArgs e)
        {
            if (ModuleFile != null)
            {
                PackageVerificationCode CodeResult = await VerifyAssistant.VerifyPackageAsync();

                if (CodeResult == PackageVerificationCode.Passed)
                {
                    if (await ModulesWriteManager.AddModuleAsync(ModuleFile))
                    {
                        ResultText.Text = "Module has been installed without any problem !";
                    }
                    else
                    {
                        ResultText.Text = "Module was not installed :(";
                    }
                }
                else
                {
                    ResultText.Text = "Error with the module: " + CodeResult.ToString();
                }

                VerifyModuleGrid.Visibility   = Visibility.Collapsed;
                ResultInstallation.Visibility = Visibility.Visible;
            }
        }
Exemplo n.º 2
0
        public async void installModule(string zip_path)
        {
            await Windows.ApplicationModel.Core.CoreApplication.MainView.CoreWindow.Dispatcher.RunAsync(CoreDispatcherPriority.Normal,
                                                                                                        async() =>
            {
                MessageDialog dialog_warning = new MessageDialog("");
                dialog_warning.Title         = "An module want to install a new module on the editor";
                dialog_warning.Content       = "Are you sure to accept the module to install a new module on the editor ?";

                dialog_warning.Commands.Add(new UICommand {
                    Label = "Yes", Invoked = async(e) =>
                    {
                        StorageFile file  = await StorageFile.GetFileFromPathAsync(zip_path);
                        var result_verify = await new ModulesVerifyAssistant(file).VerifyPackageAsync();

                        if (result_verify == PackageVerificationCode.Passed)
                        {
                            await ModulesWriteManager.AddModuleAsync(file);
                        }
                    }
                });

                dialog_warning.Commands.Add(new UICommand {
                    Label = "No", Invoked = (e) =>
                    {}
                });

                await dialog_warning.ShowAsync();
            });
        }