Наследование: EditorWindow
Пример #1
0
        public async Task TestWithUserStupiditiy()
        {
            var mockIOManager           = new Mock <IIOManager>();
            var mockConsole             = new Mock <IConsole>();
            var mockHostingEnvironment  = new Mock <IHostingEnvironment>();
            var mockApplication         = new Mock <IApplication>();
            var mockDBConnectionFactory = new Mock <IDBConnectionFactory>();
            var mockLogger = new Mock <ILogger <SetupWizard> >();
            var mockGeneralConfigurationOptions = new Mock <IOptions <GeneralConfiguration> >();
            var mockPlatformIdentifier          = new Mock <IPlatformIdentifier>();
            var mockAsyncDelayer = new Mock <IAsyncDelayer>();

            var testGeneralConfig = new GeneralConfiguration
            {
                SetupWizardMode = SetupWizardMode.Never
            };

            mockGeneralConfigurationOptions.SetupGet(x => x.Value).Returns(testGeneralConfig).Verifiable();

            var wizard = new SetupWizard(mockIOManager.Object, mockConsole.Object, mockHostingEnvironment.Object, mockApplication.Object, mockDBConnectionFactory.Object, mockPlatformIdentifier.Object, mockAsyncDelayer.Object, mockLogger.Object, mockGeneralConfigurationOptions.Object);

            mockPlatformIdentifier.SetupGet(x => x.IsWindows).Returns(true).Verifiable();
            mockAsyncDelayer.Setup(x => x.Delay(It.IsAny <TimeSpan>(), It.IsAny <CancellationToken>())).Returns(Task.CompletedTask).Verifiable();

            Assert.IsFalse(await wizard.CheckRunWizard(default).ConfigureAwait(false));
        private void SubmitPersonalPin()
        {
            Commands cmd = new Backend.Commands();
            var      pinVerificationResult = cmd.SetPin(PersonalPin);

            PersonalPin             = null;
            PersonalPinErrorMessage = null;
            if (pinVerificationResult == 1)
            {
                HIOStaticValues.tmain.IsPinRequired = false;
                ShowResetPersonalPin = false;
                if (SetupWizard != null)
                {
                    SetupWizard.MoveNextPage();
                }
                OnSubmit?.Invoke(this, EventArgs.Empty);
            }
            else
            {
                HIOStaticValues.tmain.IsPinRequired = true;
                PersonalPinErrorMessage             = "Wrong pincode";
                switch (pinVerificationResult)
                {
                case 0:
                    PinLockEnd = null;
                    break;

                case -1:
                    PinLockEnd = DateTime.Now.AddMinutes(1);
                    break;

                case -2:
                    PinLockEnd = DateTime.Now.AddMinutes(5);
                    break;

                case -3:
                    PinLockEnd = DateTime.Now.AddMinutes(10);
                    break;

                case -4:
                    PinLockEnd = DateTime.Now.AddHours(1);
                    break;

                default:
                    PersonalPinErrorMessage = null;
                    SetPersonalPinFooterErrorMessage("Something went wrong!");
                    HIOStaticValues.PinInputDashboardVM?.OnPropertyChanged(nameof(PersonalPinFooterErrorMessage));
                    HIOStaticValues.PinInputExtensionVM?.OnPropertyChanged(nameof(PersonalPinFooterErrorMessage));
                    PinLockEnd = null;
                    break;
                }
            }
        }
Пример #3
0
 static void Update()
 {
     if (EditorApplication.timeSinceStartup > 3.0f && !hasChecked)
     {
         hasChecked = true;
         var settings = (NobleConnectSettings)Resources.Load("NobleConnectSettings", typeof(NobleConnectSettings));
         if (!settings || (settings.gameID == ""))
         {
             SetupWizard window = (SetupWizard)GetWindow(typeof(SetupWizard));
             window.Show();
         }
     }
 }
Пример #4
0
        static void Main(string[] args)
        {
            SemiodeskDiscovery.Discover();

            Options options = new Options();

            if (!CommandLine.Parser.Default.ParseArguments(args, options))
            {
                return;
            }

            if (options.SingleUser)
            {
                Models.Agents        = new Uri("http://localhost:8890/artivity/1.0/agents");
                Models.Activities    = new Uri("http://localhost:8890/artivity/1.0/activities");
                Models.WebActivities = new Uri("http://localhost:8890/artivity/1.0/activities/web");
                Models.Monitoring    = new Uri("http://localhost:8890/artivity/1.0/monitoring");
            }

            if (!Setup.HasModels() && !Setup.InstallModels())
            {
                throw new Exception("Failed to setup the database.");
            }

            try
            {
                Application app = new Application();

                using (MainWindow window = new MainWindow())
                {
                    if (!Setup.CheckEnvironment())
                    {
                        using (SetupWizard setup = new SetupWizard())
                        {
                            setup.ShowModal();

                            if (setup.Result != DialogResult.Ok)
                            {
                                return;
                            }
                        }
                    }

                    app.Run(window);
                }
            }
            catch (Exception e)
            {
                Console.WriteLine(e);
            }
        }
Пример #5
0
        static void Main(string[] args)
        {
            Console.WriteLine("__________              __           __   _______  ______________________");
            Console.WriteLine(@"\______   \____   ____ |  | __ _____/  |_ \      \ \_   _____/\__    ___/");
            Console.WriteLine(@" |     ___/  _ \_/ ___\|  |/ // __ \   __\/   |   \ |    __)_   |    |   ");
            Console.WriteLine(@" |    |  (  <_> )  \___|    <\  ___/|  | /    |    \|        \  |    |  ");
            Console.WriteLine(@" |____|   \____/ \___  >__|_ \\___  >__| \____|__  /_______  /  |____|  ");
            Console.WriteLine(@"                     \/     \/    \/             \/        \/            ");

            new BinaryTest();

            string dataPath = Directory.GetCurrentDirectory().Replace(@"PocketNET\PocketNET\bin\Debug\netcoreapp3.1", "") + "server/"; //In case of compiling from the idea remove the extra folders

            if (!Directory.Exists(dataPath))
            {
                Directory.CreateDirectory(dataPath);
            }

            SetupWizard wizard = new SetupWizard(dataPath);

            if (!wizard.Check())
            {
                wizard.Run();
            }

            Logger.Info("Starting PocketNET services...");

            foreach (string path in new string[] { "plugins", "plugin_data", "worlds", "crashdumps", "texturepacks" })
            {
                try
                {
                    if (!Directory.Exists(dataPath + path))
                    {
                        Directory.CreateDirectory(dataPath + path);
                    }
                }
                catch (IOException e)
                {
                    Logger.Error(e.Message);
                }
            }

            do
            {
                new Server(dataPath);

                Logger.Info("PocketNET services stopped");
            }while (false);

            Environment.Exit(0);
        }
Пример #6
0
        public async Task TestWithUserStupiditiy()
        {
            var mockIOManager                   = new Mock <IIOManager>();
            var mockConsole                     = new Mock <IConsole>();
            var mockHostingEnvironment          = new Mock <IWebHostEnvironment>();
            var mockAssemblyInfoProvider        = new Mock <IAssemblyInformationProvider>();
            var mockDBConnectionFactory         = new Mock <IDatabaseConnectionFactory>();
            var mockLifetime                    = new Mock <IHostApplicationLifetime>();
            var mockGeneralConfigurationOptions = new Mock <IOptions <GeneralConfiguration> >();
            var mockPlatformIdentifier          = new Mock <IPlatformIdentifier>();
            var mockAsyncDelayer                = new Mock <IAsyncDelayer>();
            var mockConfiguration               = new Mock <IConfiguration>();
            var mockChangeToken                 = new Mock <IChangeToken>();

            object          configReloadCallbackState = null;
            Action <object> configReloadCallback      = null;

            mockChangeToken
            .Setup(x => x.RegisterChangeCallback(It.IsNotNull <Action <object> >(), null))
            .Callback <Action <object>, object>((callback, state) =>
            {
                configReloadCallback      = callback;
                configReloadCallbackState = state;
            });

            mockConfiguration
            .Setup(x => x.GetReloadToken())
            .Returns(mockChangeToken.Object)
            .Verifiable();

            var testGeneralConfig = new GeneralConfiguration
            {
                SetupWizardMode = SetupWizardMode.Never
            };

            mockGeneralConfigurationOptions.SetupGet(x => x.Value).Returns(testGeneralConfig).Verifiable();

            var wizard = new SetupWizard(mockIOManager.Object, mockConsole.Object, mockHostingEnvironment.Object, mockAssemblyInfoProvider.Object, mockDBConnectionFactory.Object, mockPlatformIdentifier.Object, mockAsyncDelayer.Object, mockLifetime.Object, mockConfiguration.Object, mockGeneralConfigurationOptions.Object);


            mockPlatformIdentifier.SetupGet(x => x.IsWindows).Returns(true).Verifiable();
            mockAsyncDelayer.Setup(x => x.Delay(It.IsAny <TimeSpan>(), It.IsAny <CancellationToken>())).Returns(Task.CompletedTask).Verifiable();

            await wizard.StartAsync(default).ConfigureAwait(false);
Пример #7
0
        public async Task TestWithUserStupiditiy()
        {
            var mockIOManager           = new Mock <IIOManager>();
            var mockConsole             = new Mock <IConsole>();
            var mockHostingEnvironment  = new Mock <IHostingEnvironment>();
            var mockApplication         = new Mock <IApplication>();
            var mockDBConnectionFactory = new Mock <IDBConnectionFactory>();
            var mockLogger = new Mock <ILogger <SetupWizard> >();
            var mockGeneralConfigurationOptions = new Mock <IOptions <GeneralConfiguration> >();

            var testGeneralConfig = new GeneralConfiguration
            {
                SetupWizardMode = SetupWizardMode.Never
            };

            mockGeneralConfigurationOptions.SetupGet(x => x.Value).Returns(testGeneralConfig).Verifiable();

            var wizard = new SetupWizard(mockIOManager.Object, mockConsole.Object, mockHostingEnvironment.Object, mockApplication.Object, mockDBConnectionFactory.Object, mockLogger.Object, mockGeneralConfigurationOptions.Object);

            Assert.IsFalse(await wizard.CheckRunWizard(default).ConfigureAwait(false));
Пример #8
0
        /// <summary>
        ///
        /// </summary>
        protected override void Run()
        {
            // To get the command line arguments

            /*foreach (var commandLineArgs in this.Command.GetCommandLineArgs())
             * {
             *
             * }*/

            MessageBox.Show(BundleName);

            try
            {
                this.Engine.CloseSplashScreen();

                BootstrapperDispatcher = Dispatcher.CurrentDispatcher;

                BootstrapperDispatcher.UnhandledException +=
                    (sender, args) =>
                {
                    this.Engine.Log(LogLevel.Error, $"Critical bootstrapper exception: {args.Exception}");
                };

                RootView         = new SetupWizard(this);
                RootView.Closed += (sender, args) => BootstrapperDispatcher.InvokeShutdown();
                this.Engine.Detect();

                RootView.Show();
                Dispatcher.Run();
            }
            catch (Exception e)
            {
                this.Engine.Log(LogLevel.Error, $"Critical bootstrapper exception: {e}");
                throw e;
            }
        }
Пример #9
0
 public override IEnumerable <Page> SetupWizardConclusionPages(SetupWizard wizard)
 {
     yield return(new PeekSetupCompletePage(this, wizard));
 }
Пример #10
0
 private static void HookSetupWizard()
 {
     SetupWizard.Show(instance);
 }
Пример #11
0
 public override IEnumerable <Page> SetupWizardPages(SetupWizard wizard)
 {
     yield break;
 }