private void InitialiseAllViewModels()
 {
     _SplashScreenViewModel   = new SplashScreenViewModel();
     _RegistrationViewModel   = new RegistrationViewModel();
     _ModifyViewModel         = new ModifyViewModel();
     _AuthenticationViewModel = new AuthenticationViewModel();
 }
Exemple #2
0
 static object ExitFrame(object f)
 {
     Window    = Window.GetWindow(Instance);
     ViewModel = (SplashScreenViewModel)Instance.DataContext;
     ((DispatcherFrame)f).Continue = false;
     return(null);
 }
Exemple #3
0
        /// <summary>
        /// Invoked when this page is about to be displayed in a Frame.
        /// </summary>
        /// <param name="e">Event data that describes how this page was reached.  The Parameter
        /// property is typically used to configure the page.</param>
        protected override void OnNavigatedTo(NavigationEventArgs e)
        {
            ViewModelLocator.Register();
            SplashScreenViewModel vm = (this.DataContext as SplashScreenViewModel);

            if (GlobalConfig.IsOfflineMode)
            {
                vm.LoadOfflineUserInformation();
            }
            else
            {
                string accessToken;

                if (ApplicationData.Current.LocalSettings.Values.ContainsKey("Facebook_AccessToken"))
                {
                    accessToken = ApplicationData.Current.LocalSettings.Values["Facebook_AccessToken"].ToString();

                    if (!string.IsNullOrEmpty(accessToken))
                    {
                        vm.CheckIfValidUser(accessToken);
                    }
                    else
                    {
                        vm.FacebookLogin();
                    }
                }
                else
                {
                    vm.FacebookLogin();
                }
            }
        }
Exemple #4
0
 public Bootstrapper()
 {
     // Display SplashScreen
     _splashScreenVM = SplashScreenFactory.CreateSplashScreen(
         "MyCompany Deals", "Planning Grid", "Creating Repositories...", 200);
     // Overwrite GlobalInfo parameters and prepare an AuditLog to catch and log errors
     ApplicationFactory.AuditedDisplay(
         Assembly.GetExecutingAssembly().GetName(),
         () =>
         {
             // Show overwritten version numbers from GlobalInfo on SplashScreen
             _splashScreenVM.VersionString = string.Format("v{0}.{1}.{2}",
                 GlobalInfo.Version_Major, GlobalInfo.Version_Minor, GlobalInfo.Version_Build);
             // Initiate ViewModel with new repositories
             var viewModel = new PlanningGridViewModel(new MyCompany.Repositories.PlanningGridHeadersRepository(),
                 new MyCompany.Repositories.PlanningGridLinesRepository(),
                 _splashScreenVM);
             // Initiate View with ViewModel as the DataContext
             var view = new PlanningGridView(viewModel);
             // Subscribe to View's Activated event
             view.Activated += new EventHandler(Window_Activated);
             // Display View
             view.ShowDialog();
         });
 }
        public SplashScreen(SplashScreenViewModel splashScreenViewModel)
        {
            InitializeComponent();
            _splashScreenViewModel = splashScreenViewModel;
            this.DataContext       = splashScreenViewModel;

            Topmost = true;
        }
 public SplashScreenWindow(SplashScreenViewModel vm)
 {
     if (vm == null)
     {
         throw new ArgumentNullException(nameof(vm));
     }
     Topmost     = true;
     DataContext = vm;
     InitializeComponent();
     Topmost = false;
 }
Exemple #7
0
        public SplashScreenView(SplashScreenViewModel splashScreenViewModel, IEventBus eventBus)
        {
            DataContext = splashScreenViewModel;

            eventBus.Register(new ExitApplicationEventHandler(() =>
            {
                Close();
            }));

            InitializeComponent();
        }
        public SplashScreenView()
        {
            this.InitializeComponent();

            LoggingService.LogInformation("Showing splash screeen", "Views.SplashScreenView");
            _vm = new SplashScreenViewModel();
            base.DataContext = _vm;
            _vm.OnBegin     += vm_OnBegin;
            _vm.OnCompleted += vm_OnCompleted;
            _vm.Load();
        }
Exemple #9
0
        /// <summary>
        /// 构造函数
        /// </summary>
        public MainPage()
        {
            dtstart = DateTime.Now;

            vm = new SplashScreenViewModel();
            //vm.InitCompleted += new EventHandler(vm_InitCompleted);
            vm.Run(new List<ModuleInfo>());         //伪初始化容器,加速MainPage加载,仅实际加载平台样式文件

            InitializeComponent();

            this.Loaded += new RoutedEventHandler(MainPage_Loaded);
        }
Exemple #10
0
        /// <summary>
        /// 构造函数
        /// </summary>
        public MainPage()
        {
            dtstart = DateTime.Now;

            vm = new SplashScreenViewModel();
            //vm.InitCompleted += new EventHandler(vm_InitCompleted);
            vm.Run(new List <ModuleInfo>());         //伪初始化容器,加速MainPage加载,仅实际加载平台样式文件

            InitializeComponent();

            this.Loaded += new RoutedEventHandler(MainPage_Loaded);
        }
Exemple #11
0
        internal void Initialize()
        {
            _splashData = new SplashScreenViewModel(AppInfo.GetApplicationVersion(), "Loading pages scrapers...");
            _splash     = new SplashScreen(_splashData);
            _splash.Show();

            _scrapersManager = new ScrapersManager();

            _splashData.Message = "Initializing main window...";
            _mainWindow         = new MainWindow();
            _pagesHelper        = new PagesHelper();
        }
Exemple #12
0
        /// <summary>
        /// 构造函数
        /// </summary>
        public MVCMainPage()
        {
            dtstart = DateTime.Now;

            vm = new SplashScreenViewModel();
            //vm.InitCompleted += new EventHandler(vm_InitCompleted);
            vm.Run(new List <ModuleInfo>());         //伪初始化容器,加速MainPage加载,仅实际加载平台样式文件

            dicManager.OnDictionaryLoadCompleted += dicManager_OnDictionaryLoadCompleted;
            InitializeComponent();
            HtmlPage.RegisterScriptableObject("MvcToSl", this);
            this.Loaded += new RoutedEventHandler(MainPage_Loaded);
        }
Exemple #13
0
        /// <summary>
        /// 构造函数
        /// </summary>
        public MVCMainPage()
        {
            dtstart = DateTime.Now;

            vm = new SplashScreenViewModel();
            //vm.InitCompleted += new EventHandler(vm_InitCompleted);
            vm.Run(new List<ModuleInfo>());         //伪初始化容器,加速MainPage加载,仅实际加载平台样式文件

            dicManager.OnDictionaryLoadCompleted += dicManager_OnDictionaryLoadCompleted;
            InitializeComponent();
            HtmlPage.RegisterScriptableObject("MvcToSl", this);
            this.Loaded += new RoutedEventHandler(MainPage_Loaded);
            
        }
Exemple #14
0
        /// <summary>
        /// 确定
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void BtnOk_OnClick(object sender, RoutedEventArgs e)
        {
            if (!_clsLoginModel.PermissionsFunc(_menuId, (int)PermissionsEnum.修改))
            {
                MessageBox.Show("您没有修改公司信息的权限", "友情提示", MessageBoxButton.OK, MessageBoxImage.Information);
            }
            else if (Verify())
            {
                var result = _companyManage.AddOrUpdate(new Models.SettingModels.Company
                {
                    Name      = CompanyName,
                    RegCode   = RegCode,
                    Tel       = Telephone,
                    Fax       = Fax,
                    Bank      = Bank,
                    BankCode  = BankCode,
                    TaxCode   = TaxCode,
                    Mail      = Mail,
                    Copyright = Copyright,
                    Add       = Address,
                    Remark    = Remark,
                    OperMan   = _clsLoginModel.LoginName
                });

                if (result.ResultStatus == ResultStatus.Success)
                {
                    var configDirectory = $"{AppDomain.CurrentDomain.BaseDirectory}{Config.ConfigDirectory}";
                    var path            = $"{configDirectory}{Config.SplashScreenDataFile}";
                    if (!Directory.Exists(configDirectory))
                    {
                        Directory.CreateDirectory(configDirectory);
                    }

                    var data = new SplashScreenViewModel
                    {
                        CompanyName = result.Data.Name,
                        Copyright   = result.Data.Copyright
                    };
                    File.WriteAllText(path, data.ToJson(), Encoding.UTF8);
                }
                MessageBox.Show(result.ResultStatus == ResultStatus.Success ? "公司信息修改成功" : result.Message, "友情提示", MessageBoxButton.OK, MessageBoxImage.Information);
            }
        }
Exemple #15
0
 public MainViewModel()
 {
     Caption        = "MainViewModel";
     RightViewModel = new RightViewModel()
     {
         Caption = "RightViewModel"
     };
     ((ISupportParentViewModel)RightViewModel).ParentViewModel = this;
     LeftViewModel = new LeftViewModel()
     {
         Caption = "LeftViewModel"
     };
     ((ISupportParentViewModel)LeftViewModel).ParentViewModel = this;
     SplashScreenViewModel = new SplashScreenViewModel()
     {
         Caption = "SplashScreenViewModel"
     };
     ((ISupportParentViewModel)SplashScreenViewModel).ParentViewModel = this;
 }
Exemple #16
0
        protected override void OnStartup(StartupEventArgs e)
        {
            AppDomain.CurrentDomain.UnhandledException += CurrentDomainUnhandledException;
            DispatcherUnhandledException += ApplicationDispatcherUnhandledException;
            string softwareRenderMode = ConfigurationManager.AppSettings["SoftwareRenderMode"];

            if (string.Compare(softwareRenderMode, "TRUE", true) == 0)
            {
                Lib.SoftwareRenderMode = true;
            }

            base.OnStartup(e);

            MainWindow mainWindow;

#if !DEBUG
            SplashScreenViewModel splashScreen = SplashScreenFactory.CreateOrGetSplashScreen();
            splashScreen.SourceUri    = new Uri("pack://application:,,,/Resources/Splash.jpg");
            splashScreen.ShowProgress = false;
            splashScreen.Info         = "Loading ...";
            SplashScreenWindow splashScreenWindow = new SplashScreenWindow(splashScreen);

            try
            {
                splashScreenWindow.Show();
#endif
            MagicDatabaseManager.Initialise(MultiPartCardManager.Instance);
            mainWindow = new MainWindow();
#if !DEBUG
        }

        finally
        {
            splashScreenWindow.Close();
        }
#endif
            _started = true;
            mainWindow.Show();
        }
        public static void ShowSplashScreen <TView>(Assembly actualAssembly) where TView : IView, new()
        {
            viewModel = new SplashScreenViewModel(actualAssembly);

            splashScreenThread = new Thread(() =>
            {
                splashScreen                       = new SplashScreenWindow();
                splashScreen.DataContext           = viewModel;
                splashScreen.WindowStartupLocation = WindowStartupLocation.CenterScreen;
                splashScreen.WindowStyle           = WindowStyle.None;
                splashScreen.AllowsTransparency    = true;
                splashScreen.ResizeMode            = ResizeMode.NoResize;
                splashScreen.ShowInTaskbar         = true;
                splashScreen.SizeToContent         = SizeToContent.WidthAndHeight;
                splashScreen.Background            = Brushes.Transparent;
                splashScreen.Content               = new TView();

                if (splashScreen != null)
                {
                    splashScreen.Show();

                    EventHandler closedEventHandler = null;

                    closedEventHandler = (o, s) =>
                    {
                        splashScreen.Closed -= closedEventHandler;
                        splashScreen.Dispatcher.InvokeShutdown();
                    };

                    splashScreen.Closed += closedEventHandler;

                    System.Windows.Threading.Dispatcher.Run();
                }
            });

            splashScreenThread.SetApartmentState(ApartmentState.STA);
            splashScreenThread.Start();
        }
Exemple #18
0
        public static SplashScreenViewModel CreateSplashScreen(
            string header, string title, string initialLoadingMessage, int minimumMessageDuration)
        {
            var viewModel = new SplashScreenViewModel(initialLoadingMessage, minimumMessageDuration)
            {
                Header = header,
                Title  = title
            };
            Thread thread = new Thread(() =>
            {
                var splashScreen     = new SplashScreenView(viewModel);
                splashScreen.Topmost = true;
                splashScreen.Show();
                splashScreen.Closed += (x, y) => splashScreen.Dispatcher.InvokeShutdown();
                System.Windows.Threading.Dispatcher.Run();
            });

            thread.SetApartmentState(ApartmentState.STA);
            thread.IsBackground = true;
            thread.Start();

            return(viewModel);
        }
Exemple #19
0
        public MainViewModel()
        {
            PrimaryViewModel = new SplashScreenViewModel {
                DisposeOfAfterUse = true
            };

            if (this.IsInDesignMode)
            {
                _bottomBarModel    = new BottomBarModelSimulator();
                _displayController = new DisplayControllerSimulator();
            }
            else
            {
                _displayController = ClassLocator.GetInstance <IDisplayController>();
                Debug.Assert(_displayController != null, nameof(IDisplayController) + " not found for " + GetType().Name);
                _displayController.ChangeDisplayEvent += DisplayChangeEventHandler;
                _bottomBarModel = ClassLocator.GetInstance <IBottomBarModel>();
                Debug.Assert(_bottomBarModel != null, nameof(IBottomBarModel) + " not found for " + GetType().Name);
                _bottomBarModel.UpdateEvent += UpdateUserMessageEventHandler;
            }
            UserMessage = _bottomBarModel.UserMessage;
            MessageType = _bottomBarModel.MessageType;
        }
 private void SplashScreen_OnUnloaded(object sender, RoutedEventArgs e)
 {
     SplashScreenViewModel.CleanUp();
 }
Exemple #21
0
 public SplashScreen(SplashScreenViewModel viewModel)
 {
     InitializeComponent();
     this.DataContext = viewModel;
 }
Exemple #22
0
 public void TestInit()
 {
     model               = new SplashScreenViewModel();
     fileOperations      = new Mock <IFileOperation>();
     model.FileOperation = fileOperations.Object;
 }
        public SplashScreenWindow(SplashScreenViewModel viewModel)
        {
            InitializeComponent();

            viewModel.Bind(this);
        }
Exemple #24
0
 public SplashScreen()
 {
     InitializeComponent();
     vm = new SplashScreenViewModel();
     base.DataContext = vm;
 }
Exemple #25
0
 public SplashScreenView()
 {
     InitializeComponent();
     viewModel   = new SplashScreenViewModel(this);
     DataContext = viewModel;
 }
Exemple #26
0
        public static void Show <T>() where T : Window, new()
        {
            var thread = new Thread(() =>
            {
                try
                {
                    var screenViewModel = new SplashScreenViewModel();
                    Task.Factory.StartNew(() =>
                    {
                        var data = GetSplashScreenData();
                        screenViewModel.CompanyName = data.CompanyName;
                        screenViewModel.Copyright   = data.Copyright;
                    });

                    Task.Factory.StartNew(() =>
                    {
                        try
                        {
                            while (true)
                            {
                                if (Cancellation.IsCancellationRequested)
                                {
                                    break;
                                }
                                if (LoadingValueList.Count > 6)
                                {
                                    LoadingValueList.Clear();
                                }
                                screenViewModel.LoadingValue = string.Join("", LoadingValueList);
                                LoadingValueList.Add(".");

                                Thread.Sleep(350);
                            }
                        }
                        catch (Exception ex)
                        {
                            SplashScreenWindow.Dispatcher.Invoke((Action)(() => { throw ex; }));
                        }
                    });

                    SplashScreenWindow = new T
                    {
                        WindowStyle           = WindowStyle.None,
                        ResizeMode            = ResizeMode.NoResize,
                        AllowsTransparency    = true,
                        Background            = new SolidColorBrush(Colors.Transparent),
                        ShowInTaskbar         = false,
                        Topmost               = true,
                        SizeToContent         = SizeToContent.WidthAndHeight,
                        WindowStartupLocation = WindowStartupLocation.CenterScreen,
                        DataContext           = screenViewModel
                    };
                    SplashScreenWindow.ShowDialog();
                }
                catch (Exception ex)
                {
                    SplashScreenWindow.Dispatcher.Invoke((Action)(() => { throw ex; }));
                }
            })
            {
                IsBackground = true
            };

            thread.SetApartmentState(ApartmentState.STA);
            thread.Start();
        }
Exemple #27
0
 private void SplashScreen_OnClosing(object sender, CancelEventArgs e)
 {
     SplashScreenViewModel.CleanUp();
 }
Exemple #28
0
 public SplashScreenPage()
 {
     this.InitializeComponent();
     DataContext  = new SplashScreenViewModel();
     this.Loaded += SplashScreenView_Loaded;
 }
        public StartGame()
        {
            InitializeComponent();

            BindingContext = new SplashScreenViewModel();
        }
 public SplashScreen()
 {
     InitializeComponent();
     DataContext = new SplashScreenViewModel();
 }