public void Init(Dictionary <string, string> data) { _viewmodel = new MetroDesktop.DesktopViewModel(data); this.DataContext = _viewmodel; Nowa_oferta.Content = _viewmodel.GetResource("Offer").ToUpper(); Nowe_zlecenie_produkcyjne.Content = _viewmodel.GetResource("Commission").ToUpper(); Otworz_istniejacy_dokument.Content = _viewmodel.GetResource("ExistingDocuments", "Existing Documents").ToUpper(); Nowe_zamowienie.Content = _viewmodel.GetResource("Order").ToUpper(); Zamowienie_zbiorcze.Content = _viewmodel.GetResource("SummaryOrder", "Summary Order").ToUpper(); Nowa_optymalizacja.Content = _viewmodel.GetResource("Optimalization").ToUpper(); Wyslij_lub_odbierz_zlecenie.Content = _viewmodel.GetResource("DealersCommunication", "Dealers Communication").ToUpper(); Magazyn.Content = _viewmodel.GetResource("StoreModule", "Store Module").ToUpper(); Tools.Content = _viewmodel.GetResource("Tools").ToUpper(); ipDocuments.Title = _viewmodel.GetResource("Documents").ToUpper(); lblTomorrowDocs.Text = _viewmodel.GetResource("TomorrowDocuments", "Documents with tomorrow's production date:"); lblTodayDocs.Text = _viewmodel.GetResource("TodayDocuments", "Documents with today's production date:"); lblOldDocs.Text = _viewmodel.GetResource("OldDocuments", "Documents after production date:"); ipServer.Title = _viewmodel.GetResource("Server").ToUpper(); ipDatabase.Title = _viewmodel.GetResource("Database").ToUpper(); _viewmodel.ErrorText = _viewmodel.GetResource("Error", string.Empty); }
public JsonResult Delete(DesktopViewModel desktopModel) { try { _genericService.Delete(desktopModel.ID); return(Json(new { Result = "OK" })); } catch (Exception ex) { return(Json(new { Result = "ERROR", Message = ex.Message })); } }
public JsonResult Edit(DesktopViewModel desktopModel) { try { _genericService.Update(_mapper.Map <DesktopViewModel, DesktopDTO>(desktopModel)); return(Json(new { Result = "OK", Record = desktopModel })); } catch (Exception ex) { return(Json(new { Result = "ERROR", Message = ex.Message })); } }
public JsonResult Create(DesktopViewModel desktopModel) { try { var id = _genericService.Save(_mapper.Map <DesktopViewModel, DesktopDTO>(desktopModel)); desktopModel.ID = id; return(Json(new { Result = "OK", Record = desktopModel })); } catch (Exception ex) { return(Json(new { Result = "ERROR", Message = ex.Message })); } }
private void ProcessDesktopViewData(SessionHandler session, byte[] bytes) { if (this._manager_login_c == 0) { return; } string id = (string)session.AppTokens[1]; DesktopViewModel model = new DesktopViewModel() { Msg = AJaxMsgCommand.S_DESKTOPVIEW_IMG, Id = id, ImageBase64 = Convert.ToBase64String(bytes) }; this.SendMessage(JsonConvert.SerializeObject(model)); this.PutLogQueue("DEBUG ImageProcess id:" + id + " " + bytes.Length / 1024 + "k"); }
public AppShellViewModel() { var desktopManager = new DesktopManager().AddTo(this); var processManager = new WindowManager().AddTo(this); _desktopWindowManager = new DesktopWindowManager().AddTo(this); Title = new ReactiveProperty <string>("Robock"); Status = StatusTextService.Instance.ObserveProperty(w => w.Status).ToReactiveProperty(); Status.Throttle(TimeSpan.FromSeconds(30)).Subscribe(_ => StatusTextService.Instance.Status = "Ready").AddTo(this); Tabs = new ReactiveCollection <TabViewModel> { new AboutTabViewModel() }; Tabs.ToCollectionChanged().Subscribe(w => { if (!(w.Value is DesktopViewModel model) || !model.IsPrimary) { return; } VirtualScreen.SelectedIndex.Value = w.Index; model.IsSelected.Value = true; }); VirtualScreen = new VirtualScreenViewModel(); // Subscribe desktopManager.Desktops.CollectionChangedAsObservable().Subscribe(w => { if (w.Action != NotifyCollectionChangedAction.Add || !(w.NewItems[0] is Desktop desktop)) { return; } var viewModel = new DesktopViewModel(desktop, processManager, _desktopWindowManager).AddTo(this); Tabs.Insert(desktop.No - 1, viewModel); VirtualScreen.Desktops.Insert(desktop.No - 1, viewModel); }).AddTo(this); desktopManager.Initialize(); processManager.Start(); }
public DesktopView(UserModel userModel) { InitializeComponent(); DataContext = new DesktopViewModel(userModel); }
public void Startup() { // we will take care of shutting things down Application.Current.ShutdownMode = ShutdownMode.OnExplicitShutdown; var settingsModel = new ScreenSaverSettingsModel(this.service, this.projectPicker); if (string.IsNullOrEmpty(settingsModel.TfsUri)) { // no config found, show settings dialog var saved = this.ShowSettingsDialog(settingsModel); if (!saved || string.IsNullOrEmpty(settingsModel.TfsUri)) { // no config found, user cancelled settings dialog - exit application Application.Current.Shutdown(); return; } } this.service.TfsUrl = settingsModel.TfsUri; var builds = Settings.Default.Builds; var viewModel = new DesktopViewModel(this.service, builds); var desktop = new Desktop(viewModel); // configure view model viewModel.Columns = Settings.Default.Columns; viewModel.ConfigRequested += (object sender, EventArgs e) => { // restore the view desktop.Restore(); // stop querying the server this.service.Stop(); // this is a blocking call var saved = this.ShowSettingsDialog(settingsModel); if (saved) { // re-init builds after settings dialog is closed viewModel.InitializeBuildPanels(Settings.Default.Builds); viewModel.Columns = Settings.Default.Columns; } this.service.Start(); }; // configure view desktop.Title = this.title; desktop.Closed += (object sender, EventArgs e) => { Application.Current.Shutdown(); }; // show view desktop.Show(); // start monitoring the builds this.service.Start(); }
public DesktopView(MainWindow parent, string filePath) { InitializeComponent(); DataContext = new DesktopViewModel(this, parent, filePath); }