//public TemperatureController(Model.TemperatureControlDataModel model, ControlRelays controlRelays, TemperatureProbe temperatureProbe)
        //{
        //    theModel = model;
        //    this.controlRelays = controlRelays;
        //    this.temperatureProbe = temperatureProbe;
        //}

        public TemperatureController(Window mainWindow, ControlRelays controlRelays, TemperatureProbe temperatureProbe)
        {
            this.controlRelays    = controlRelays;
            this.temperatureProbe = temperatureProbe;
            this.mainWindow       = mainWindow;

            // Create Model
            theModel = new Model.TemperatureControlDataModel();

            // Create Views
            splashView    = new View.SplashView(theModel);
            dashboardView = new View.DashboardView(theModel);
            idleView      = new View.IdleView(theModel);
            settingsView  = new View.SettingsView(theModel);
        }
예제 #2
0
        public ContextMenuActionsVM(WpfApplication application)
        {
            _application = application;

            ShowInstances = new DelegateCommand(_ =>
            {
                var wnd = new View.InstancesList
                {
                    DataContext = new { Items = _application.AllInstances }
                };
                wnd.Show();
            });

            ShowMessages = new DelegateCommand(_ =>
            {
                _application.ShowMessagesList();
            });

            ClearMessages = new DelegateCommand(_ =>
            {
                _application.ClearMessagesList();
            });

            OpenSettings = new DelegateCommand(_ =>
            {
                var wnd = new View.SettingsView
                {
                    DataContext = new ViewModel.SettingsVM(_application)
                };
                wnd.Show();
            });

            OpenAbout = new DelegateCommand(_ =>
            {
                var wnd = new View.AboutView
                {
                    Title = "About cgb_post_build_helper"
                };
                wnd.Show();
            });

            ExitApplicationCommand = new DelegateCommand(_ =>
            {
                _application.EndAllWatchesAndExitApplication();
            });
        }
        //public TemperatureController(Model.TemperatureControlDataModel model, ControlRelays controlRelays, TemperatureProbe temperatureProbe)
        //{
        //    theModel = model;
        //    this.controlRelays = controlRelays;
        //    this.temperatureProbe = temperatureProbe;
        //}
        public TemperatureController(Window mainWindow, ControlRelays controlRelays, TemperatureProbe temperatureProbe)
        {
            this.controlRelays = controlRelays;
            this.temperatureProbe = temperatureProbe;
            this.mainWindow = mainWindow;

            // Create Model
            theModel = new Model.TemperatureControlDataModel();

            // Create Views
            splashView = new View.SplashView(theModel);
            dashboardView = new View.DashboardView(theModel);
            idleView = new View.IdleView(theModel);
            settingsView = new View.SettingsView(theModel);
        }
        /// <summary>
        /// Saves references to views and attaches event handlers
        /// </summary>
        /// <param name="settingsView"></param>
        /// <param name="dashboardView"></param>
        /// <param name="splashView"></param>
        /// <param name="idleView"></param>
        /// <param name="mainWindow"></param>
        public void AttachViews(View.SettingsView settingsView, View.DashboardView dashboardView, View.SplashView splashView, View.IdleView idleView, Window mainWindow)
        {
            this.settingsView = settingsView;
            this.dashboardView = dashboardView;
            this.splashView = splashView;
            this.idleView = idleView;
            this.mainWindow = mainWindow;

            startupTimer.Tick += new GT.Timer.TickEventHandler(startupTimer_Tick);
            controllerTimer.Tick += new GT.Timer.TickEventHandler(controlerTimer_Tick);
            controllerTimer.Tick += dashboardView.timerDisplayUpdate_Tick;
            controllerTimer.Tick += idleView.timerDisplayUpdate_Tick;

            idleTimer.Interval = TimeSpan.FromTicks(theModel.IdleScreenTimeout * TimeSpan.TicksPerSecond);
            idleTimer.Tick += new EventHandler(idleTimer_Tick);
            mainWindow.TouchDown += new TouchEventHandler(mainWindow_TouchDown);
            idleView.TouchDown += new TouchEventHandler(idleView_TouchDown);
        }