This is the root view model of the sample application. Notice that it contains several child view models of its own, all of which can be bound to in the GUI. This view model primarily manages the navigation of the sample application, exposing the concept of a "current page" that the user is on and reacting to user requests to change the current page. This concept of "pages" within the sample application is not something inherent to Spinnaker - it is simply one optional way of binding things within a GUI. Actual navigation within the GUI is accomplished by binding the visibility of sections of the GUI to this view model's "CurrentPage" property.
Наследование: INotifyPropertyChanged
Пример #1
0
        public override void WindowDidLoad()
        {
            base.WindowDidLoad();

            MacSpinnakerConfiguration.Init();

            SpinnakerConfiguration.CurrentConfig.LogLevel = SpinnakerLogLevel.Debug;

            // Using log4net with Spinnaker is optional.
            log4net.Config.XmlConfigurator.Configure();
            SpinnakerLog4netAdapter.Init();

            BrowserBridge bridge = SpinnakerConfiguration.CurrentConfig.CreateBrowserBridge(webBrowser);
            splashViewModel = new SampleApplication.Core.SampleApplication().Init();
            bridge.ShowView("SplashView.html", splashViewModel);

            splashViewModel.PropertyChanged += (object sender, System.ComponentModel.PropertyChangedEventArgs e) =>
            {
                if (e.PropertyName == "CurrentPage")
                    bridge.ExecuteScriptFunction("setHeroBackground");
            };

            NSTimer.CreateRepeatingScheduledTimer(1.0 / 20.0, delegate
            {
                splashViewModel.RealtimeViewModel.HandleGUITimerTick();
            });
        }
Пример #2
0
 public SplashViewModel Init()
 {
     SplashViewModel splashViewModel = new SplashViewModel();
     splashViewModel.CustomersViewModel = new CustomersViewModel();
     splashViewModel.CustomersViewModel.LoadCustomers();
     splashViewModel.RealtimeViewModel = new RealtimeViewModel();
     splashViewModel.SimpleFormViewModel = new SimpleFormViewModel();
     return splashViewModel;
 }
Пример #3
0
        protected override void OnLoad(EventArgs loadArgs)
        {
            base.OnLoad(loadArgs);

            WinFormsSpinnakerConfiguration.Init();

            // Using log4net with Spinnaker is optional.
            log4net.Config.XmlConfigurator.Configure();
            SpinnakerLog4netAdapter.Init();

            BrowserBridge bridge = SpinnakerConfiguration.CurrentConfig.CreateBrowserBridge(webBrowser);
            splashViewModel = new SampleApplication.Core.SampleApplication().Init();
            bridge.ShowView("SplashView.html", splashViewModel);
            guiTimer.Start();
            splashViewModel.PropertyChanged += (object sender, System.ComponentModel.PropertyChangedEventArgs e) =>
            {
                if (e.PropertyName == "CurrentPage")
                    bridge.ExecuteScriptFunction("setHeroBackground");
            };
        }