Esempio n. 1
0
        public Task <PasswordGeneratedEventArgs> GeneratePasswordAsTask()
        {
            Trace.WriteLine("Ran");
            var tcs = RegisterAsTask <PasswordGeneratedEventArgs>(ref OnNewPasswordGenerated);

            var childTask = Task <PasswordGeneratedEventArgs> .Factory.StartNew(() =>
            {
                Provider.ServerMachine.Identity     = MachineIdentity.GetCurrentIdentity();
                Provider.ServerMachine.Password     = AlphaNumericGenerator.Generate(2, GeneratorOptions.Numeric);
                Provider.ServerMachine.PasswordHash = HashUtil.ComputeHash(Provider.ServerMachine.Password, HashType.SHA512);

                var newPasswordEventArgs = new PasswordGeneratedEventArgs {
                    NewPassword = Provider.ServerMachine.Password
                };

                if (OnNewPasswordGenerated != null)
                {
                    OnNewPasswordGenerated(this, newPasswordEventArgs);
                }

                return(newPasswordEventArgs);
            }, TaskCreationOptions.AttachedToParent);

            return(tcs.Task);
        }
Esempio n. 2
0
        private async void FormMain_Shown(object sender, EventArgs e)
        {
            PasswordGeneratedEventArgs passArgs = await NovaManager.GeneratePassword();

            LabelPassword.Text = passArgs.NewPassword;
            IntroducerRegistrationResponsedEventArgs regArgs = await NovaManager.RegisterWithIntroducerAsTask();

            LabelNovaId.Text = regArgs.NovaId;

            CheckMirrorDriverExists();
        }
Esempio n. 3
0
        public async Task InitNetworkManagerServer()
        {
            NovaManagerServer        = Managers.NovaServer.Instance.NovaManager;
            LiveControlManagerServer = Managers.NovaServer.Instance.LiveControlManager;

            NovaManagerServer.OnIntroducerRegistrationResponded += NovaManager_OnIntroducerRegistrationResponded;
            NovaManagerServer.OnNewPasswordGenerated            += new EventHandler <PasswordGeneratedEventArgs>(ServerManager_OnNewPasswordGenerated);
            NovaManagerServer.Network.OnConnected += new EventHandler <Network.ConnectedEventArgs>(Network_OnConnected);

            PasswordGeneratedEventArgs passArgs = await NovaManagerServer.GeneratePassword();

            //LabelPassword.Content = passArgs.NewPassword;
            IntroducerRegistrationResponsedEventArgs regArgs = await NovaManagerServer.RegisterWithIntroducerAsTask();

            //LabelNovaId.Content = regArgs.NovaId;
            Status.Content = "Host is live";
        }
Esempio n. 4
0
 void ServerManager_OnNewPasswordGenerated(object sender, PasswordGeneratedEventArgs e)
 {
     LabelPassword.Set(() => LabelPassword.Text, e.NewPassword);
 }