public SpectrumView()
        {
            InitializeComponent();

            viewModel = new ControlPanelViewModel(this.waveForm, this.analyzer);
            this.controlPanel.DataContext = viewModel;
        }
Beispiel #2
0
        public ActionResult Index()
        {
            TemperatureChartViewModel temperatureChartViewModel = _presentationService.GetTemperatureChartModel(Period, true);

            temperatureChartViewModel.RemoveLastButtons(2);
            temperatureChartViewModel.SelectedButtonIndex = 2;

            DeviceStateLogViewModel deviceStateLogViewModel = _presentationService.GetDeviceStateLogViewModel(Period);
            ControlPanelViewModel   controlPanelViewModel   = _controlPanelPresentationService.GetControlPanelViewModel();

            object[] lastTempData = temperatureChartViewModel.Data.LastOrDefault();

            CurrentStateViewModel currentState = _presentationService.GetCurrentStateViewModel((decimal?)lastTempData?[1] ?? 0);

            var model = new DashboardViewModel
            {
                CurrentState      = currentState,
                TemperatureChart  = temperatureChartViewModel,
                DeviceStates      = deviceStateLogViewModel,
                SwitchableDevices = _switchableDevices,
                ControlPanel      = controlPanelViewModel
            };

            return(View(model));
        }
        async Task <IActionResult> PlayAsync(ControlPanelViewModel viewModel, SimulationMode mode)
        {
            if (!viewModel.IsVerifiedInput)
            {
                return(await ControlPanel(new ControlPanelViewModel { State = "Warning" }));
            }

            switch (_simulator.SimulationState)
            {
            case SimulationState.Playing:
            case SimulationState.Paused:
                return(await Error(
                           "Error! Simulator is not READY to play another simulation.\nAnother simulation is in progress."));

            case SimulationState.Stopped:
                return(await Error(
                           "Error! Simulator is not READY to play another simulation.\nPlease reset the current simulation data."));

            case SimulationState.Ready:
                _simulator.SimulationMode = mode;
                await _simulator.PlayAsync();

                return(RedirectToAction("ControlPanel"));

            default:
                throw new ArgumentOutOfRangeException();
            }
        }
        public MainViewModel(IMediaEngineFacade engine,
                             ControlPanelViewModel controlViewModel,
                             IFileSelector fileSelector,
                             IDialogService dialogService,
                             ISettingsProvider settingsProvider,
                             IImageCreaterFactory imageCreaterFactory,
                             IDisplayService displayService,
                             IFailedStreamsContainer failedStreamsContainer,
                             ICursorManager cursorManager)
        {
            _engine                 = engine;
            _controlViewModel       = controlViewModel;
            _fileSelector           = fileSelector;
            _dialogService          = dialogService;
            _settingsProvider       = settingsProvider;
            _imageCreaterFactory    = imageCreaterFactory;
            _displayService         = displayService;
            _failedStreamsContainer = failedStreamsContainer;
            _cursorManager          = cursorManager;

            _settingsProvider.SettingChanged += _settingsProvider_SettingChanged;

            ReadSettings();

            Messenger.Default.Register <PropertyChangedMessageBase>(this, true, OnPropertyChanged);
            Messenger.Default.Register <EventMessage>(this, true, OnEventMessage);
            Messenger.Default.Register <PlayNewFileMessage>(this, true, OnPlayNewFile);
            Messenger.Default.Register <PlayDiscMessage>(this, true, OnPlayDisc);

            PackUpCommandBag();
        }
        public async Task <IActionResult> ControlPanel(ControlPanelViewModel viewModel = null)
        {
            var role = HttpContext.Session.GetString("Role");

            if (string.IsNullOrEmpty(role) || role != "Administrator")
            {
                return(RedirectToAction("Home", "Public"));
            }

            if (viewModel == null)
            {
                viewModel = new ControlPanelViewModel();
            }

            viewModel.Symbols = (await _securityRepository.GetAllAsync()).Select(s => s.Symbol).ToList();

            viewModel.Login = new Login
            {
                Role     = role,
                Username = HttpContext.Session.GetString("Username")
            };

            ModelState.Clear();

            ViewData["Title"] = "Control Panel";

            return(View("ControlPanel", viewModel));
        }
Beispiel #6
0
 public MainWindow()
 {
     InitializeComponent();
     Closing    += MainWindow_Closing;
     viewModel   = new ControlPanelViewModel(null, analyzer);
     DataContext = viewModel;
 }
Beispiel #7
0
        public ShellViewModel(ControlPanelViewModel controlPanel, HexyWorldViewModel hexyWorld)
        {
            ControlPanel = controlPanel;
            HexyWorld    = hexyWorld;

            var info = (AssemblyInformationalVersionAttribute)Assembly.GetAssembly(typeof(ShellViewModel)).GetCustomAttributes(typeof(AssemblyInformationalVersionAttribute), false)[0];

            DisplayName = "Hexenstein " + info.InformationalVersion;
        }
Beispiel #8
0
 public LibraryViewModel()
 {
     AutoFillList          = new ObservableCollection <Book>();
     BooksDataContext      = new BooksDataGridViewModel();
     ControlDataContext    = new ControlPanelViewModel();
     GetDetailsCommand     = new RelayParamCommand <Book>(GetDetails);
     AddNewBookCommand     = new RelayParamCommand <Book>(AddNewBook);
     GenerateCopiesCommand = new RelayParamCommand <string>(GenerateCopies);
     AddNewCopiesCommand   = new RelayCommand(AddNewCopies);
 }
Beispiel #9
0
 /// <summary>
 /// Creates the main window for the Wave Subscription Demo.
 /// </summary>
 public MainWindow()
 {
     InitializeComponent();
     this.Loaded += new RoutedEventHandler(MainWindow_Loaded);
     this.Closing += new System.ComponentModel.CancelEventHandler(MainWindow_Closing);
     m_viewModel = new ControlPanelViewModel(this.WaveForm);
     this.ControlPanel.DataContext = m_viewModel;
     this.Stat.DataContext = new StatViewModel(m_viewModel.AudioGraph);
     m_viewModel.AudioGraph.PlaybackStateChanged += new EventHandler<TVA.EventArgs<PlaybackState, string>>(AudioGraph_PlaybackStateChanged);
 }
Beispiel #10
0
 /// <summary>
 /// Creates the main window for the Wave Subscription Demo.
 /// </summary>
 public MainWindow()
 {
     InitializeComponent();
     this.Loaded += MainWindow_Loaded;
     this.Closing += MainWindow_Closing;
     m_viewModel = new ControlPanelViewModel(this.WaveForm);
     this.ControlPanel.DataContext = m_viewModel;
     this.Stat.DataContext = new StatViewModel(m_viewModel.AudioGraph);
     m_viewModel.AudioGraph.PlaybackStateChanged += AudioGraph_PlaybackStateChanged;
 }
        private void OnViewConsolidated(ApplicationView sender, ApplicationViewConsolidatedEventArgs args)
        {
            //ViewModel.Unsubscribe();
            ViewModel = null;
            //Bindings.StopTracking();
            var appView = ApplicationView.GetForCurrentView();

            appView.Consolidated -= OnViewConsolidated;
            ServiceLocator.DisposeCurrent();
            Window.Current.Close();
        }
        public async Task <IActionResult> ToggleReportsEnabled(ControlPanelViewModel viewModel)
        {
            if (!viewModel.IsVerifiedInput)
            {
                return(await ControlPanel(new ControlPanelViewModel { State = "Warning" }));
            }

            AppSettings.UpdateReportsEnabled(!AppSettings.IsReportsEnabled());

            return(RedirectToAction("ControlPanel"));
        }
        public async Task <IActionResult> ResetTrades(ControlPanelViewModel viewModel)
        {
            if (!viewModel.IsVerifiedInput)
            {
                return(await ControlPanel(new ControlPanelViewModel { State = "Warning" }));
            }

            _simulator.Reset();

            return(RedirectToAction("ControlPanel"));
        }
Beispiel #14
0
        public ActionResult Index(bool?isPartial = false)
        {
            ControlPanelViewModel model = new ControlPanelViewModel();

            model.PageInfo = new PageInfo()
            {
                PageTitle       = "Control Panel",
                PageDescription = "Manage AssessmentTool."
            };

            return(View(model));
        }
Beispiel #15
0
        public ActionResult Statistics()
        {
            ControlPanelViewModel CPVM = new ControlPanelViewModel();

            CPVM.Users = database.Users.FindAll();

            CPVM.Trainers = database.Trainers.FindAll();

            CPVM.events = database.Events.FindAll();



            return(View(CPVM));
        }
        public async Task <IActionResult> ContinueAsync(ControlPanelViewModel viewModel)
        {
            if (!viewModel.IsVerifiedInput)
            {
                return(await ControlPanel(new ControlPanelViewModel { State = "Warning" }));
            }

            if (_simulator.SimulationState != SimulationState.Paused)
            {
                return(await Error("Error! There is no PAUSED simulation in progress."));
            }

            await _simulator.PlayAsync();

            return(RedirectToAction("ControlPanel"));
        }
        public HttpResponseMessage Create(HttpRequestMessage request, ControlPanelViewModel controPanelVM)
        {
            return(CreateHttpResponse(request, () =>
            {
                HttpResponseMessage response = null;

                if (!ModelState.IsValid)
                {
                    response = request.CreateErrorResponse(HttpStatusCode.BadRequest, ModelState);
                }
                else
                {
                    ControlPanel newControlPanel = new ControlPanel();
                    newControlPanel.UpdateControlPanel(controPanelVM);
                    var page = _controlPanelService.Add(newControlPanel);
                    _controlPanelService.Save();
                    response = request.CreateResponse(HttpStatusCode.Created, page);
                }
                return response;
            }));
        }
        public HttpResponseMessage Put(HttpRequestMessage request, ControlPanelViewModel controPanelVM)
        {
            return(CreateHttpResponse(request, () =>
            {
                HttpResponseMessage response = null;

                if (!ModelState.IsValid)
                {
                    response = request.CreateErrorResponse(HttpStatusCode.BadRequest, ModelState);
                }
                else
                {
                    var ControlPanelDb = _controlPanelService.GetById(controPanelVM.ID);
                    ControlPanelDb.UpdateControlPanel(controPanelVM);
                    _controlPanelService.Update(ControlPanelDb);
                    _controlPanelService.Save();

                    var responseData = Mapper.Map <ControlPanel, ControlPanelViewModel>(ControlPanelDb);
                    response = request.CreateResponse(HttpStatusCode.Created, responseData);
                }
                return response;
            }));
        }
        public async Task <IActionResult> UpdatePrice(ControlPanelViewModel viewModel)
        {
            if (!viewModel.IsVerifiedInput)
            {
                return(await ControlPanel(new ControlPanelViewModel { State = "Warning" }));
            }

            if (viewModel.Price < 0)
            {
                return(await Error("Price must be a postive integer!"));
            }

            var security = await _securityRepository.GetAsync(viewModel.Symbol);

            if (security == null)
            {
                return(RedirectToAction("ControlPanel"));
            }

            security.Price = viewModel.Price;
            await _securityRepository.UpdateAsync(security);

            return(RedirectToAction("ControlPanel"));
        }
        public ControlPanel(DBContext context, Employee empl)
        {
            InitializeComponent();

            DataContext = new ControlPanelViewModel(context, empl);
        }
 public void PropertiesTest()
 {
     var vm = new ControlPanelViewModel();
     TestsHelper.TestPublicPropertiesGetSet(vm, x => vm.Model, x => vm.Icon);
 }
Beispiel #22
0
        public IHttpActionResult GetDeviceStates()
        {
            ControlPanelViewModel controlPanelViewModel = _presentationService.GetControlPanelViewModel();

            return(Json(controlPanelViewModel.DevicesOptions));
        }
 public async Task <IActionResult> PlayCompetitionAsync(ControlPanelViewModel viewModel) => await PlayAsync(viewModel, SimulationMode.Competition);
 public async Task <IActionResult> PlayPracticeAsync(ControlPanelViewModel viewModel) => await PlayAsync(viewModel, SimulationMode.Practice);
 public ControlPanel()
 {
     InitializeComponent();
     DataContext = new ControlPanelViewModel();
 }
 //UpdateControlPanel
 public static void UpdateControlPanel(this ControlPanel controlPanel, ControlPanelViewModel controlPanelViewModel)
 {
     controlPanel.ID     = controlPanelViewModel.ID;
     controlPanel.Name   = controlPanelViewModel.Name;
     controlPanel.Status = controlPanelViewModel.Status;
 }
Beispiel #27
0
 private void UserControl_Loaded(object sender, RoutedEventArgs e)
 {
     view_model = (ControlPanelViewModel)DataContext;
 }
Beispiel #28
0
 public ControlPanelView(ControlPanelViewModel VM)
 {
     view_model  = VM;
     DataContext = view_model;
     InitializeComponent();
 }
Beispiel #29
0
 public ControlPanelPage()
 {
     InitializeComponent();
     BindingContext = new ControlPanelViewModel(Navigation);
 }