public PageActionBarViewModel(IManagerPage managerPage, IProgressManager progressManager, INuGetPackageManager projectManager,
                                      IExtensibleProjectLocator projectLocator, IPackageCommandService packageCommandService, IPackageOperationContextService packageOperationContextService, IMessageService messageService)
        {
            Argument.IsNotNull(() => managerPage);
            Argument.IsNotNull(() => projectManager);
            Argument.IsNotNull(() => progressManager);
            Argument.IsNotNull(() => projectLocator);
            Argument.IsNotNull(() => packageCommandService);
            Argument.IsNotNull(() => packageOperationContextService);
            Argument.IsNotNull(() => messageService);

            _parentManagerPage              = managerPage;
            _projectManager                 = projectManager;
            _projectLocator                 = projectLocator;
            _progressManager                = progressManager;
            _packageCommandService          = packageCommandService;
            _packageOperationContextService = packageOperationContextService;
            _messageService                 = messageService;
            BatchUpdate  = new TaskCommand(BatchUpdateExecuteAsync, BatchUpdateCanExecute);
            BatchInstall = new TaskCommand(BatchInstallExecuteAsync, BatchInstallCanExecute);
            CheckAll     = new TaskCommand(CheckAllExecuteAsync);

            CanBatchInstall = _parentManagerPage.CanBatchInstallOperations;
            CanBatchUpdate  = _parentManagerPage.CanBatchUpdateOperations;
        }
Example #2
0
 /// <summary>
 /// Initializes a new instance of the <see cref="EditCustomerStep"/> class.
 /// </summary>
 public EditCustomerStep()
 {
     this._managerPage            = AutofacContainer.AContainer.Resolve <IManagerPage>();
     this._selectEditCustomerPage = AutofacContainer.AContainer.Resolve <ISelectEditCustomerPage>();
     this._editCustomerPage       = AutofacContainer.AContainer.Resolve <IEditCustomerPage>();
     this._customerRegisteredPage = AutofacContainer.AContainer.Resolve <ICustomerRegisteredPage>();
 }
Example #3
0
    protected override void OnPreInit(EventArgs e)
    {
        // 让页面管理器先注册,因为页面管理器要控制权限
        Manager = CommonManageProvider.Provider.CreatePage(this, EntityType);
        EntityForm = CommonManageProvider.Provider.CreateForm(this, EntityType);

        base.OnPreInit(e);
    }
Example #4
0
 private void manager_callback(IManagerPage page, CancelArgs e)
 {
     if (page is ILogoutSucceededPage)
     {
         Console.Clear();
         e.Cancel = !ConsoleBinaryQuestion($"是否重新登录 {this.userName} ?");
     }
 }
        public Wlan_eduManager(string wlanAcName, string wlanUserIp, string url, Encoding encoding)
        {
            if (wlanAcName == null)
            {
                throw new ArgumentNullException(nameof(wlanAcName));
            }
            if (wlanUserIp == null)
            {
                throw new ArgumentNullException(nameof(wlanUserIp));
            }

            this.page = this.CreateLoginInfoPageInternal(wlanAcName, wlanUserIp, url, encoding);
            this.page.Initialize();
        }
        /// <summary>
        /// 使管理器切换到下一页。
        /// </summary>
        /// <param name="changePage">页面切换的方法。</param>
        /// <param name="callback">页面切换成功的回调方法。</param>
        /// <returns>一个值,指示操作是否成功。</returns>
        public virtual bool NextPage(ChangePageHandler changePage, CallbackHandler callback = null)
        {
            if (changePage == null)
            {
                throw new ArgumentNullException(nameof(changePage));
            }

            CancelArgs e = new CancelArgs();

            this.page = changePage(this.page, e);
            if (!e.Cancel)
            {
                this.page.Initialize();
                callback?.Invoke(this.page, e);

                return(!e.Cancel);
            }
            else
            {
                return(false);
            }
        }
 private void manager_Callback(IManagerPage page, CancelArgs _e)
 {
     if (page is ILogoutSucceededPage)
     {
         this.Switch(ManagerPageType.LogoutSucceeded);
     }
     else if (page is ILoginInfoPage)
     {
         this.Switch(ManagerPageType.LoginInfo);
     }
     else if (page is ILoginSucceededPage)
     {
         this.Switch(ManagerPageType.LoginSucceeded);
     }
     else if (page is ILogoutInfoPage)
     {
         this.Switch(ManagerPageType.LogoutInfo);
     }
     else
     {
         _e.Cancel = true;
     }
 }
Example #8
0
    protected override void OnPreInit(EventArgs e)
    {
        Manager = CommonManageProvider.Provider.CreatePage(this, EntityType);

        base.OnPreInit(e);
    }
 public Wlan_eduManager(IManagerPage firstPage)
 {
     this.page = firstPage ?? throw new ArgumentNullException(nameof(firstPage));
 }
Example #10
0
 /// <summary>
 /// Initializes a new instance of the <see cref="NewAccountStep"/> class.
 /// </summary>
 public NewAccountStep()
 {
     this._managerPage    = AutofacContainer.AContainer.Resolve <IManagerPage>();
     this._newAccountPage = AutofacContainer.AContainer.Resolve <INewAccountPage>();
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="NewCustomerStep"/> class.
 /// </summary>
 public NewCustomerStep()
 {
     this._managerPage            = AutofacContainer.AContainer.Resolve <IManagerPage>();
     this._newCustomerPage        = AutofacContainer.AContainer.Resolve <INewCustomerPage>();
     this._customerRegisteredPage = AutofacContainer.AContainer.Resolve <ICustomerRegisteredPage>();
 }
Example #12
0
 public Wlan_eduManagerComponent(IManagerPage firstPage) : base(firstPage)
 {
 }
Example #13
0
        private IManagerPage manager_ChangePage(IManagerPage page, CancelArgs e)
        {
            if (page is ILoginInfoPage)
            {
                return(((ILoginInfoPage)page).Login(this.userName, this.userPwd, this.isAutoLogin));
            }
            else if (page is ILoginForcedPage)
            {
                if (ConsoleBinaryQuestion("您好,您当前登录的用户已在线,是否继续操作?"))
                {
                    return(((ILoginForcedPage)page).ForceLogin());
                }
                else
                {
                    return(((ILoginForcedPage)page).Cancel());
                }
            }
            else if (page is ILoginingPage)
            {
                Console.WriteLine("登录成功!");
                return(((ILoginingPage)page).Success());
            }
            else if (page is ILoginFailedPage)
            {
                ConsoleForeColoredWriteLine(ConsoleColor.Red, $"登录认证失败,用户( {userName} )当前处于非正常状态!");
                return(((ILoginFailedPage)page).Ignore());
            }
            else if (page is ILoginSucceededPage)
            {
                using (var timer = new System.Timers.Timer()
                {
                    Enabled = false, Interval = 1000
                })
                {
                    string maskedUserName = this.MaskedUserName;
                    timer.Elapsed += (sender, _e) =>
                    {
                        Console.Clear();
                        ConsoleForeColoredWrite(ConsoleColor.White, "尊敬的用户:");
                        ConsoleForeColoredWrite(ConsoleColor.Blue, maskedUserName);
                        ConsoleForeColoredWriteLine(ConsoleColor.White, ",您已登录成功");
                        Console.WriteLine();
                        ConsoleForeColoredWriteLine(ConsoleColor.Gray, "上网过程中不要关闭该窗口。如需下线,请按 Esc 键。");
                        Console.WriteLine();
                        ConsoleForeColoredWrite(ConsoleColor.White, "本次登录时长:\t");
                        TimeSpan timeSpan = DateTime.Now - ((ILoginSucceededPage)page).SucceededTime;
                        ConsoleForeColoredWriteLine(ConsoleColor.Yellow, "{0:D2} : {1:D2} : {2:D2}",
                                                    (int)Math.Floor(timeSpan.TotalHours),
                                                    timeSpan.Minutes,
                                                    timeSpan.Seconds
                                                    );

                        foreach (var pair in ((ILoginSucceededPage)page).WlanInfos)
                        {
                            ConsoleForeColoredWrite(ConsoleColor.White, "{0}:\t", pair.Key);
                            ConsoleForeColoredWriteLine(ConsoleColor.Yellow, "{0}", pair.Value);
                        }

                        Console.WriteLine();
                        ConsoleForeColoredWrite(ConsoleColor.White, "按 Esc 键下线……");
                        ;
                    };
                    timer.Start();

                    while (true)
                    {
                        if (Console.ReadKey(true).Key == ConsoleKey.Escape)
                        {
                            timer.Stop();

                            Thread.Sleep(1000); // 等待计时器停止。

                            Console.WriteLine();
                            if (ConsoleBinaryQuestion("请确认下线!"))
                            {
                                return(((ILoginSucceededPage)page).Logout(this.userName, this.cancelAutoLogin));
                            }
                            else
                            {
                                timer.Start();
                            }
                        }
                    }
                }
            }
            else if (page is ILogoutingPage)
            {
                return(((ILogoutingPage)page).Success());
            }
            else if (page is ILogoutSucceededPage)
            {
                if (ConsoleBinaryQuestion("下线成功!是否关闭窗口?"))
                {
                    e.Cancel = true;
                    ((ILogoutSucceededPage)page).Exit();
                    return(null);
                }
                else
                {
                    return(((ILogoutSucceededPage)page).Login(this.userName, this.userPwd, this.isAutoLogin));
                }
            }
            else
            {
                IManagerPage mp = page;
                ;
                e.Cancel = true;
                return(null);
            }
        }
 /// <summary>
 /// Initializes a new instance of the <see cref="LoginSteps"/> class.
 /// </summary>
 public LoginSteps()
 {
     this._homePage    = AutofacContainer.AContainer.Resolve <IHomePage>(new NamedParameter("currentScenario", ScenarioContext.Current.ScenarioInfo.Title));
     this._managerPage = AutofacContainer.AContainer.Resolve <IManagerPage>();
 }