Пример #1
0
        protected override void OnStartup(StartupEventArgs e)
        {
            base.OnStartup(e);
            //very important line for dialog before startup
            ShutdownMode = ShutdownMode.OnExplicitShutdown;

            StartupInit();
            bool startApplication = true;

            if (LoginWndVm.IsPasswordDefined())
            {
                LoginWnd dlg    = new LoginWnd();
                bool?    result = dlg.ShowDialog();
                startApplication = result.HasValue && result.Value;
            }

            if (startApplication)
            {
                StartupUri = new Uri("Views/MainWindow.xaml", UriKind.Relative);
            }
            else
            {
                _log.Error("Wrong password");
                // wrong password
                Shutdown(1);
            }
        }
Пример #2
0
        protected override void OnStartup(StartupEventArgs e)
        {
            base.OnStartup(e);



            LoginWnd.getInstance().ShowDialog();


            // The boostrapper will create the Shell instance, so the App.xaml does not have a StartupUri.
            //程序启动执行bootstrapper.Run(),在ShellBootstrapper里面会加载ShellWindows,后加载MainWindows
            ShellBootstrapper bootstrapper = new ShellBootstrapper();

            bootstrapper.Run();
        }
Пример #3
0
    private void Init()
    {
        #region  所有UI界面的获取, 本项目暂时没有做资源加载的框架
        mUIRootTr       = transform.Find("UIRoot");
        mLoadingWnd     = transform.Find("UIRoot/LoadingWnd").GetComponent <LoadingWnd>();
        mLoginWnd       = transform.Find("UIRoot/LoginWnd").GetComponent <LoginWnd>();
        mDynamicTipsWnd = transform.Find("UIRoot/DynamicTips").GetComponent <DynamicTipsWnd>();
        mCreateWnd      = transform.Find("UIRoot/CreateWnd").GetComponent <CreateWnd>();
        mMainWnd        = transform.Find("UIRoot/MainWnd").GetComponent <MainWnd>();
        mActorInfoWnd   = transform.Find("UIRoot/ActorInfoWnd").GetComponent <ActorInfoWnd>();
        mGuideWnd       = transform.Find("UIRoot/GuideWnd").GetComponent <GuideWnd>();
        mStrongWnd      = transform.Find("UIRoot/StrongWnd").GetComponent <StrongWnd>();
        mChatWnd        = transform.Find("UIRoot/ChatWnd").GetComponent <ChatWnd>();
        mCommonBuyWnd   = transform.Find("UIRoot/CommonBuyWnd").GetComponent <CommonBuyWnd>();
        mFuBenWnd       = transform.Find("UIRoot/FuBenWnd").GetComponent <FuBenWnd>();
        mPlayerCtrlWnd  = transform.Find("UIRoot/PlayerCtrlWnd").GetComponent <PlayerCtrlWnd>();

        #endregion

        #region   务层初始化
        mCfgSvc = GetComponent <CfgSvc>();
        mCfgSvc.Init();
        mResSvc = GetComponent <ResSvc>();
        mResSvc.Init();
        mAudioSvc = GetComponent <AudioSvc>();
        mAudioSvc.Init();
        mNetSvc = GetComponent <NetSvc>();
        mNetSvc.Init();
        mTimerSvc = GetComponent <TimerSvc>();
        mTimerSvc.Init();
        #endregion

        #region  业务层初始化
        mLoginSys = GetComponent <LoginSys>();
        mLoginSys.Init();
        mMainCitySys = GetComponent <MainCitySys>();
        mMainCitySys.Init();
        mFuBenSys = GetComponent <FuBenSys>();
        mFuBenSys.Init();
        mBattleSys = GetComponent <BattleSys>();
        mBattleSys.Init();
        #endregion

        InitUIRoot();
        mLoginSys.EnterLogin();
    }
Пример #4
0
        public MainWindow()
        {
            InitializeComponent();

            double x = SystemParameters.WorkArea.Width;  //得到屏幕工作区域宽度

            double y = SystemParameters.WorkArea.Height; //得到屏幕工作区域高度

            this.Width = x;                              //设置窗体宽度

            this.Height = y;                             //设置窗体高度

            LoginWnd loginwnd = new LoginWnd();

            this.stackpanl.Children.Add(loginwnd);
            this.AddHandler(Button.ClickEvent, new RoutedEventHandler(PageChange));

            AnimationUtil.ScaleEasingAnimation(loginwnd);
        }
Пример #5
0
        async void doLogin()
        {//TODO:屏蔽登录界面
         //_currentUser = await handleLogin("admin", "");
         //         if (_currentUser != null)
         //             _tracer = new UserActionTracer();
         //         _publisher.NotifyUserLogin();
         //         updatePermission();
            string aa   = "admin";
            string str1 = LocalEncryptor.Instance.Encrypt(aa);
            string str2 = LocalEncryptor.Instance.Decrypt(str1);

            Console.WriteLine(str1);
            Console.WriteLine(str2);
            var a   = UserManager.Instance.CurrentUser;
            var dlg = new LoginWnd();
            var dr  = DialogDispatcher.ShowDialog(dlg);

            if (dr == true)
            {
                _currentUser = await handleLogin(dlg.UserName, dlg.Password);

                if (_currentUser != null)
                {
                    _tracer = new UserActionTracer();
                }
                else
                {
                    return;
                }

                _publisher.NotifyUserLogin();
                updatePermission();
            }
            else
            {
                DialogDispatcher.CloseMainWindow();
            }
        }