public PersonEditorViewModel(IForcesService forceService = null, Person person = null) { this.forceService = forceService; this.Person = person ?? new Person(); this.BeginPersonEdit(this.Person); this.isSaveRequested = false; this.IntializeCommandBar(); }
public StartupViewModel(IShellService shellService, ILog log, IJobService jobService, IForcesService forceService) { this.jobService = jobService; this.forceService = forceService; this.log = log; this.UserName = Settings.Default.LastUserName; this.IpAddress = Settings.Default.LastServerAddress; if (string.IsNullOrEmpty(this.IpAddress)) { var firstAddress = this.Addresses.FirstOrDefault(); this.IpAddress = firstAddress?.ToString() ?? string.Empty; } shellService.ShellActivated += (s, e) => { if (Environment.GetCommandLineArgs().Contains("serverRole")) { this.Loading = true; this.log.Info("Start as server role"); this.StartAsServerCommand.Execute(null); } }; }
public PersonEditorViewModel(IForcesService forceService) { this.Person = new Person(); this.IntializeCommandBar(); }
public JobToForceViewModel(IShellService shellService, IForcesService forceService, IJobService jobService, Force force) { this.shellService = shellService; this.forceService = forceService; this.jobService = jobService; this.SelectedForce = force; // this.selectedJob = new Job(); this.availableJobsList = new ObservableCollection <Job>(); this.AvailableJobsView = new ListCollectionView(this.availableJobsList); this.assignedJobsList = new ObservableCollection <Job>(); this.AssignedJobsView = new ListCollectionView(this.assignedJobsList); this.changedJobs = new ObservableCollection <Job>(); // Configure shell this.ShellViewState = ShellViewState.Embedded; this.undockingCommandBarButton = new ShellCommandBarButton { ImageUri = new Uri("pack://application:,,/Resources/Images/ShellIcons/open_in_shell.scale-150.png"), Label = "Abdocken", Command = new RelayCommand(() => { this.View.DataContext = new ForceToJobViewModel(this.shellService, this.forceService, this.jobService, this.SelectedJob); var newView = new ForceToJob { DataContext = this }; this.shellService.ShowInNewTab("Neue Zuweisung", newView, this, true); }), Width = 284 }; this.showInTabCommandBarButton = new ShellCommandBarButton { ImageUri = new Uri("pack://application:,,/Resources/Images/ShellIcons/open_in_shell.scale-150.png"), Label = "Im Hauptfenster andocken", Command = new RelayCommand(() => { this.shellService.ShowWindowInNewTab(this.window); this.window = null; }), Visibility = Visibility.Collapsed }; this.showInWindowCommandBarButton = new ShellCommandBarButton { ImageUri = new Uri("pack://application:,,/Resources/Images/ShellIcons/open_in_window.scale-150.png"), Label = "In Fenster öffnen", Command = new RelayCommand(() => { var shellViewModel = SimpleIoc.Default.GetInstance <ShellViewModel>(); var shellTab = Enumerable.Single(shellViewModel.ShellTabs, tab => Equals(tab.View, this.View)); this.window = this.shellService.ShowTabInNewWindow(shellTab); }) }; this.saveAndCloseCommandBarButton = new ShellCommandBarButton { ImageUri = new Uri("pack://application:,,/Resources/Images/ShellIcons/save_green.scale-150.png"), Label = "Speichern und schließen", Command = this.SaveJobAssignmentCommand }; this.cancelAndCloseCommandBarButton = new ShellCommandBarButton { ImageUri = new Uri("pack://application:,,/Resources/Images/ShellIcons/delete_sign_red.scale-150.png"), Label = "Abbrechen und schließen", Command = this.CancelJobAssignmentCommand }; this.CommandBarItems = new ObservableCollection <ShellCommandBarItem> { this.undockingCommandBarButton, this.showInTabCommandBarButton, this.showInWindowCommandBarButton, new ShellCommandBarSeparator(), this.saveAndCloseCommandBarButton, this.cancelAndCloseCommandBarButton }; }
public JobToForceViewModel(IShellService shellService, IForcesService forceService, IJobService jobService) : this(shellService, forceService, jobService, new Force()) { }
public ForceToJobViewModel(IShellService shellService, IForcesService forceService, IJobService jobService) : this(shellService, forceService, jobService, new Job()) { }
public JobsViewModel(IJobService jobService, IForcesService forceService, IShellService shellService) { this.jobService = jobService; this.forceService = forceService; this.shellService = shellService; this.jobs = new ObservableCollection <Job>(); this.SelectedJobs = new List <Job>(); this.JobsView = new ListCollectionView(this.jobs); this.groupFilter = new GroupFilter(); this.JobsView.Filter = this.groupFilter.Filter; // Apply standard filter ApplyStandardFilter(); // Register messages Messenger.Default.Register <JobAddedMessage>(this, this.OnJobAdded); Messenger.Default.Register <JobUpdatedMessage>(this, this.OnJobUpdated); Messenger.Default.Register <JobDeletedMessage>(this, this.OnJobDeleted); // Exposing command bar items this.CommandBarItems = new ObservableCollection <ShellCommandBarItem> { // Create job button new ShellCommandBarButton { ImageUri = new Uri("pack://application:,,/Resources/Images/ShellIcons/plus_math.scale-150.png"), Label = "Auftrag anlegen", Width = 284, Command = new RelayCommand(() => { var mainViewModel = SimpleIoc.Default.GetInstance <MainViewModel>(); mainViewModel.SelectedTabIndex = 2; }) }, new ShellCommandBarSeparator(), // Filter types new ShellCommandBarDropDownButton { ImageUri = new Uri("pack://application:,,/Resources/Images/ShellIcons/filter.scale-150.png"), Label = "Filtern nach Auftragsstatus", Items = new List <ShellCommandBarItem>() { // All jobs new ShellCommandBarButton { ImageUri = new Uri("pack://application:,,/Resources/Images/ShellIcons/versions.scale-150.png"), Label = "Alle Aufträge", Command = this.ResetFilterCommand }, new ShellCommandBarButton { ImageUri = new Uri("pack://application:,,/Resources/Images/ShellIcons/versions.scale-150.png"), Label = "Neu oder in Bearbeitung", Command = this.FilterByOpenOrInProgressCommand }, // New jobs new ShellCommandBarButton { ImageUri = new Uri("pack://application:,,/Resources/Images/ShellIcons/add_list.scale-150.png"), Label = "Neue Aufträge", Command = this.FilterByOpenCommand }, // Jobs in progress new ShellCommandBarButton { ImageUri = new Uri("pack://application:,,/Resources/Images/ShellIcons/edit_file.scale-150.png"), Label = "In Bearbeitung", Command = this.FilterByInProgressCommand }, // Ended jobs new ShellCommandBarButton { ImageUri = new Uri("pack://application:,,/Resources/Images/ShellIcons/check_file.scale-150.png"), Label = "Beendete Aufträge", Command = this.FilterByEndedCommand }, //new ShellCommandBarButton //{ // ImageUri = new Uri("pack://application:,,/Resources/Images/ShellIcons/check_file.scale-150.png"), // Label = "Erweiterte Filter ein-/ausblenden", // Command = this.ToggleFilterBarVisibilityCommand //}, }, DropDownHorizontalOffset = -55.0 }, // Hide / show filters ////new ShellCommandBarButton ////{ //// ImageUri = new Uri("pack://application:,,/Resources/Images/ShellIcons/invisible.scale-150.png"), //// Label = "Filter ein/ausblenden", //// Command = new RelayCommand(() => this.View.ToggleFilterVisibility()) ////}, // Export dropdown menu new ShellCommandBarDropDownButton { ImageUri = new Uri("pack://application:,,/Resources/Images/ShellIcons/save.scale-150.png"), Label = "Export", Items = new List <ShellCommandBarItem>() { // Export all new ShellCommandBarButton { ImageUri = new Uri("pack://application:,,/Resources/Images/ShellIcons/export.scale-150.png"), Label = "Alle Aufträge exportieren", Command = this.ExportAllCommand }, // Select all new ShellCommandBarButton { ImageUri = new Uri("pack://application:,,/Resources/Images/ShellIcons/select_all.scale-150.png"), Label = "Alle sichtbaren Aufträge markieren", Command = this.SelectAllJobsCommand }, // Export selected new ShellCommandBarButton { ImageUri = new Uri("pack://application:,,/Resources/Images/ShellIcons/export_blue.scale-150.png"), Label = "Alle markierten Aufträge exportieren", Command = this.ExportSelectedJobsCommand }, }, DropDownHorizontalOffset = -55.0 }, }; }
public JobEditorViewModel(IShellService shellService, IJobService jobService, IForcesService forcesService, Job job) { this.shellService = shellService; this.jobService = jobService; this.forcesService = forcesService; this.Job = job ?? new Job(); this.BeginJobEdit(this.Job); this.isSaveRequested = false; this.forcesList = new ObservableCollection <Force>(); this.ForcesView = new ListCollectionView(this.forcesList); // Set up messenger completion values this.jobService.GetAllJobs().Select(j => j.Messenger).Distinct().ToList() .ForEach(messenger => this.MessengerValues.Add(messenger)); this.AddMessengerValueIfNotExists("Leitstelle"); // Configure shell this.ShellViewState = ShellViewState.Embedded; this.undockingCommandBarButton = new ShellCommandBarButton { ImageUri = new Uri("pack://application:,,/Resources/Images/ShellIcons/open_in_shell.scale-150.png"), Label = "Abdocken", Command = new RelayCommand(() => { this.View.DataContext = new JobEditorViewModel(this.shellService, this.jobService, this.forcesService); var newView = new JobEditorView { DataContext = this }; this.shellService.ShowInNewTab("Neuer Auftrag", newView, this, true); }), Width = 284, Visibility = this.Job.IsNew ? Visibility.Visible : Visibility.Collapsed }; this.showInTabCommandBarButton = new ShellCommandBarButton { ImageUri = new Uri("pack://application:,,/Resources/Images/ShellIcons/open_in_shell.scale-150.png"), Label = "Im Hauptfenster andocken", Command = new RelayCommand(() => { this.shellService.ShowWindowInNewTab(this.window); this.window = null; }), Visibility = Visibility.Collapsed }; this.showInWindowCommandBarButton = new ShellCommandBarButton { ImageUri = new Uri("pack://application:,,/Resources/Images/ShellIcons/open_in_window.scale-150.png"), Label = "In Fenster öffnen", Command = new RelayCommand(() => { var shellViewModel = SimpleIoc.Default.GetInstance <ShellViewModel>(); var shellTab = shellViewModel.ShellTabs.Single(tab => Equals(tab.View, this.View)); this.window = this.shellService.ShowTabInNewWindow(shellTab); }), Visibility = this.Job.IsNew ? Visibility.Collapsed : Visibility.Visible }; this.saveAndCloseCommandBarButton = new ShellCommandBarButton { ImageUri = new Uri("pack://application:,,/Resources/Images/ShellIcons/save_green.scale-150.png"), Label = "Speichern und schließen", Command = this.SaveJobCommand, Visibility = this.Job.IsNew ? Visibility.Collapsed : Visibility.Visible }; this.saveAndNextCommandBarButton = new ShellCommandBarButton { ImageUri = new Uri("pack://application:,,/Resources/Images/ShellIcons/save_green.scale-150.png"), Label = "Speichern und neuen Auftrag anlegen", Command = this.SaveJobCommand, Visibility = this.Job.IsNew ? Visibility.Visible : Visibility.Collapsed }; this.cancelCommandBarButton = new ShellCommandBarButton { ImageUri = new Uri("pack://application:,,/Resources/Images/ShellIcons/delete_sign_red.scale-150.png"), Label = "Abbrechen", Command = this.CancelJobEditCommand, Visibility = this.Job.IsNew ? Visibility.Visible : Visibility.Collapsed }; this.cancelAndCloseCommandBarButton = new ShellCommandBarButton { ImageUri = new Uri("pack://application:,,/Resources/Images/ShellIcons/delete_sign_red.scale-150.png"), Label = "Abbrechen und schließen", Command = this.CancelJobEditCommand, Visibility = this.Job.IsNew ? Visibility.Collapsed : Visibility.Visible }; this.CommandBarItems = new ObservableCollection <ShellCommandBarItem> { this.undockingCommandBarButton, this.showInTabCommandBarButton, this.showInWindowCommandBarButton, new ShellCommandBarSeparator(), this.saveAndCloseCommandBarButton, this.saveAndNextCommandBarButton, this.cancelAndCloseCommandBarButton, this.cancelCommandBarButton }; }
public JobEditorViewModel(IShellService shellService, IJobService jobService, IForcesService forcesService) : this(shellService, jobService, forcesService, new Job()) { }
public ConnectionForcesService(IForcesService forcesService) { this.forcesService = forcesService; }
public ForceEditorViewModel(IShellService shellService, IForcesService forceService, Force force) { this.shellService = shellService; this.forceService = forceService; this.Force = force ?? new Force(); this.BeginForceEdit(this.Force); //this.personsUnmodified = this.Force.Persons.Clone().ToList(); //foreach (var p in this.Force.Persons) // personsUnmodified.Add(p); //this.Persons = new ObservableCollection<Person>(this.Force.Persons); //this.PersonsView = new ListCollectionView(this.Force.Persons); this.ShellViewState = ShellViewState.Embedded; this.undockingCommandBarButton = new ShellCommandBarButton { ImageUri = new Uri("pack://application:,,/Resources/Images/ShellIcons/open_in_shell.scale-150.png"), Label = "Abdocken", Command = new RelayCommand(() => { this.View.DataContext = new ForceEditorViewModel(this.shellService, this.forceService); var newView = new ForceEditorView { DataContext = this }; this.shellService.ShowInNewTab("Neue Einheit", newView, this, true); }), Width = 284, Visibility = this.Force.IsNew ? Visibility.Visible : Visibility.Collapsed }; this.showInTabCommandBarButton = new ShellCommandBarButton { ImageUri = new Uri("pack://application:,,/Resources/Images/ShellIcons/open_in_shell.scale-150.png"), Label = "Im Hauptfenster andocken", Command = new RelayCommand(() => { this.shellService.ShowWindowInNewTab(this.window); this.window = null; }), Visibility = Visibility.Collapsed }; this.showInWindowCommandBarButton = new ShellCommandBarButton { ImageUri = new Uri("pack://application:,,/Resources/Images/ShellIcons/open_in_window.scale-150.png"), Label = "In Fenster öffnen", Command = new RelayCommand(() => { var shellViewModel = SimpleIoc.Default.GetInstance <ShellViewModel>(); var shellTab = shellViewModel.ShellTabs.Single(tab => Equals(tab.View, this.View)); this.window = this.shellService.ShowTabInNewWindow(shellTab); }), Visibility = this.Force.IsNew ? Visibility.Collapsed : Visibility.Visible }; this.saveAndCloseCommandBarButton = new ShellCommandBarButton { ImageUri = new Uri("pack://application:,,/Resources/Images/ShellIcons/save_green.scale-150.png"), Label = "Speichern und schließen", Command = this.SaveForceCommand, Visibility = this.Force.IsNew ? Visibility.Collapsed : Visibility.Visible }; this.saveAndNextCommandBarButton = new ShellCommandBarButton { ImageUri = new Uri("pack://application:,,/Resources/Images/ShellIcons/save_green.scale-150.png"), Label = "Speichern und neue Einheit anlegen", Command = this.SaveForceCommand, Visibility = this.Force.IsNew ? Visibility.Visible : Visibility.Collapsed }; this.CommandBarItems = new ObservableCollection <ShellCommandBarItem> { this.undockingCommandBarButton, this.showInTabCommandBarButton, this.showInWindowCommandBarButton, new ShellCommandBarSeparator(), this.saveAndCloseCommandBarButton, this.saveAndNextCommandBarButton, new ShellCommandBarButton { ImageUri = new Uri("pack://application:,,/Resources/Images/ShellIcons/delete_sign_red.scale-150.png"), Label = "Abbrechen", Command = this.CancelForceEditCommand } }; }
public ForceEditorViewModel(IShellService shellService, IForcesService forceService) : this(shellService, forceService, new Force()) { }
public ForcesViewModel(IForcesService forceService, IShellService shellService, IJobService jobService) { this.forceService = forceService; this.shellService = shellService; this.jobService = jobService; this.forces = new ObservableCollection <Force>(); this.ForcesView = new ListCollectionView(this.forces); this.groupFilter = new GroupFilter(); this.ForcesView.Filter = this.groupFilter.Filter; this.personsCountFilter = new NumberRangeFilter(); // Register messages Messenger.Default.Register <ForceAddedMessage>(this, this.OnForceAdded); Messenger.Default.Register <ForceUpdatedMessage>(this, this.OnForceUpdated); Messenger.Default.Register <ForceDeletedMessage>(this, this.OnForceDeleted); // Exposing command bar items this.CommandBarItems = new ObservableCollection <ShellCommandBarItem> { // Create force button new ShellCommandBarButton { ImageUri = new Uri("pack://application:,,/Resources/Images/ShellIcons/plus_math.scale-150.png"), Label = "Einheit anlegen", Width = 284, Command = new RelayCommand(() => { var mainViewModel = SimpleIoc.Default.GetInstance <MainViewModel>(); // Create force tab mainViewModel.SelectedTabIndex = 5; }) }, new ShellCommandBarSeparator(), // Hide / unhide filters //new ShellCommandBarButton //{ // ImageUri = new Uri("pack://application:,,/Resources/Images/ShellIcons/invisible.scale-150.png"), // Label = "Filter ein/ausblenden", // Command = new RelayCommand(() => this.View.ToggleFilterVisibility()) //}, // Export dropdown menu new ShellCommandBarDropDownButton { ImageUri = new Uri("pack://application:,,/Resources/Images/ShellIcons/save.scale-150.png"), Label = "Export", Items = new List <ShellCommandBarItem>() { // Export all new ShellCommandBarButton { ImageUri = new Uri("pack://application:,,/Resources/Images/ShellIcons/export.scale-150.png"), Label = "Alle Einheiten exportieren", Command = this.ExportAllCommand }, // Select all new ShellCommandBarButton { ImageUri = new Uri("pack://application:,,/Resources/Images/ShellIcons/select_all.scale-150.png"), Label = "Alle sichtbaren Einheiten markieren", Command = this.SelectAllForcesCommand }, // Export selected new ShellCommandBarButton { ImageUri = new Uri("pack://application:,,/Resources/Images/ShellIcons/export_blue.scale-150.png"), Label = "Alle markierten Einheiten exportieren", Command = this.ExportSelectedForcesCommand }, }, DropDownHorizontalOffset = -55.0 }, }; }