public MainShellViewModel(IResultFactory resultFactory, IEventAggregator eventAggregator, IPersistanceManager persistanceManager, ISettingsManager settingsManager, MainMenuViewModel mainMenuViewModel, ConsoleViewModel consoleViewModel, ErrorViewModel errorViewModel, WatchesViewModel watchesViewModel, IFileSystem fileSystem, ScriptDialogStrategy scriptDialogStrategy, IPaths paths ) : base(resultFactory) { this.eventAggregator = eventAggregator; eventAggregator.Subscribe(this); this.persistanceManager = persistanceManager; this.fileSystem = fileSystem; this.scriptDialogStrategy = scriptDialogStrategy; this.paths = paths; Scripts = new BindableCollection <ScriptEditorViewModel>(); Tools = new BindableCollection <PanelViewModel> { consoleViewModel, errorViewModel, watchesViewModel }; Menu = mainMenuViewModel; Menu.Plugins = settingsManager.ListConfigurablePluginSettings().Select(ps => new PluginSettingsMenuViewModel(ps)); Menu.HelpFiles = settingsManager.ListPluginSettingsWithHelpFile().Select(ps => new PluginHelpFileViewModel(ps)).ToList(); Menu.Views = Tools; DisplayName = "FreePIE - Programmable Input Emulator"; }
public ModuleController(IEnvironmentService environmentService, IPresentationService presentationService, ShellService shellService, Lazy <FileController> fileController, Lazy <RichTextDocumentController> richTextDocumentController, Lazy <PrintController> printController, Lazy <ShellViewModel> shellViewModel, Lazy <MainViewModel> mainViewModel, Lazy <StartViewModel> startViewModel, Lazy <IPowerShellService> powerShellService, Lazy <ConsoleViewModel> consoleViewModel) { // Upgrade the settings from a previous version when the new version starts the first time. if (Settings.Default.IsUpgradeNeeded) { Settings.Default.Upgrade(); Settings.Default.IsUpgradeNeeded = false; } // Initializing the cultures must be done first. Therefore, we inject the Controllers and ViewModels lazy. InitializeCultures(); presentationService.InitializeCultures(); this._environmentService = environmentService; this._fileController = fileController.Value; this._richTextDocumentController = richTextDocumentController.Value; this._printController = printController.Value; this._shellViewModel = shellViewModel.Value; this._mainViewModel = mainViewModel.Value; this._startViewModel = startViewModel.Value; this._consoleViewModel = consoleViewModel.Value; shellService.ShellView = this._shellViewModel.View; this._shellViewModel.Closing += ShellViewModelClosing; this._exitCommand = new DelegateCommand(Close); powerShellService.Value.Initialize(); }
public ShiftInfo(Shift shift, Employee employee) { InitializeComponent(); SelectedSchedule = shift; CurrentUser = employee; _ConsoleViewModel = new ConsoleViewModel(); _ConsoleViewModel.InitializeViewModelData(); Shift_Id = SelectedSchedule.ShiftID; DateOfShift = SelectedSchedule.DateOfShift.ToShortDateString(); Start_Time_ = SelectedSchedule.StartTime.ToShortTimeString(); End_Time_ = SelectedSchedule.EndTime.ToShortTimeString(); if (SelectedSchedule.AvailableEmployees.Exists(x => x.ID == _CurrentUser.ID) == true) { IsAvailable = true; IsNotAvailable = !IsAvailable; } else { IsAvailable = false; IsNotAvailable = !IsAvailable; } this.DataContext = this; }
public async Task NewSessionAndCancel() { ConsoleViewModel consoleViewModel = new ConsoleViewModel( new StubConsoleService(), new StubSerialPortService(), new StubSettingsService(), new StubClipboardService(), new StubDialogService(), new StubApplicationServices(), new StubWindowService(), new StubPrinterService(), new StubTaskHelpers()); consoleViewModel.Initialize(); StubWindowService.StubDialogResult = false; var newsSessionCommand = consoleViewModel.NewSessionCommand .AsAsyncRelayCommand(); await newsSessionCommand.ExecuteAsync(); Assert.IsTrue(StubWindowService.StubWindow == "SessionSetupWindow"); Assert.IsFalse(consoleViewModel.IsSessionOpen); var endSessionCommand = consoleViewModel.EndSessionCommand; endSessionCommand.Execute(null); }
public IActionResult RunProcess(ConsoleViewModel viewModel) { _l4D2AppHost.HostSettings.RedirectStandardInput = viewModel.HostSettings.RedirectStandardInput; _l4D2AppHost.HostSettings.ShowWindow = viewModel.HostSettings.ShowWindow; _l4D2AppHost.Run(); return(RedirectToAction("Index")); }
public ConsoleView() { InitializeComponent(); DataContext = new ConsoleViewModel(); ((INotifyCollectionChanged)FeatureHolder.Items).CollectionChanged += ListView_CollectionChanged; }
/// <summary> /// Instantiate ConsoleView /// </summary> public ConsoleView() { InitializeComponent(); //Routing.EventManager.GetInstance().ClearAllIOEvent += () => Events.SubscribeEvent("ClearAllIO", new Action(() => { if (DataContext is ConsoleViewModel) { ((ConsoleViewModel)DataContext).TextLines = ""; } })); this.DataContextChanged += ConsoleView_DataContextChanged; #region TextBox Events for inputting txtOutput.TextChanged += (s, e) => txtOutput.CaretIndex = txtOutput.Text.Length; bool isDirty = true; txtOutput.SelectionChanged += (s, e) => { isDirty = !isDirty; if (!isDirty) { txtOutput.CaretIndex = txtOutput.Text.Length; } }; txtOutput.PreviewKeyDown += (s, e) => { if (!(DataContext is ConsoleViewModel)) { return; } ConsoleViewModel vm = (ConsoleViewModel)DataContext; switch (e.Key) { case Key.Enter: vm.EndInput(txtOutput.Text); break; case Key.Escape: vm.EndInput(txtOutput.Text); break; case Key.Back: e.Handled = txtOutput.Text.Length <= vm.InputStart; break; default: break; } }; #endregion }
private void SetupOutputWindow() { lookLikeConsoleText = Application.Current.FindResource("ConsoleText") as Style; cmdOut = new ConsoleOutputs(); // cmdOut.InitializeComponent(); cmdOut.Show(); outputController = new ConsoleViewModel(cmdOut); DisplayHeaderMessage(); }
private void Initialize() { Logger.debug("Initalizing components", origin: "ChatMail.ConsolePresenter"); List <LogEntry> logEntries = m_consoleDao.GetLogEntries(); m_consoleViewModel = ResolveViewModel(logEntries); m_consoleView.DisplayDebug(m_consoleViewModel); }
public ConsoleWindow(RCONClient rcon) { InitializeComponent(); _vmConsole = ConsoleViewModel.INSTANCE; DataContext = _vmConsole; _rconClient = rcon; _vmConsole.ConsoleMonitor.Add( "[" + DateTime.Now + "] " + "Initialize Complete! Try \"list\" to see who is online."); }
public void DisplayDebug(ConsoleViewModel viewModel) { Logger.debug("Displaying debug messages", origin: "ChatMail.ConsoleView"); consoleViewListBox.Items.Clear(); foreach (LogEntry entry in viewModel.LogEntries) { consoleViewListBox.Items.Add(entry.Display()); } }
public ActionResult Console() { ViewBag.AlertType = TempData["AlertType"]; ViewBag.AlertContent = TempData["AlertContent"]; AbstractManager manager = new AbstractManager(); ConsoleViewModel model = new ConsoleViewModel(); model.ShowList = manager.GetListOnShow(); model.WaitList = manager.GetWaitingList(); return(View(model)); }
/// <summary> /// Instantiate a TextBoxReader /// </summary> /// <param name="model">The ConsoleViewModel it is reading from</param> public TextBoxReader(ConsoleViewModel model) { Model = model; Events.SubscribeEvent("OnDestroyed", new Action(() => m_Abort = true)); Events.SubscribeEvent("OnTerminateExecution", new Action <Action>((x) => m_Abort = true)); m_Index = 0; m_Input = String.Empty; m_HasInput = false; m_Abort = false; }
public ConsoleView() { ViewModel = new ConsoleViewModel(); App.RustRcon.ConsoleLogUpdated += (s, args) => { if (ViewModel.ConsoleSettings.IsAutoScrollEnabled) { ConsoleScrollViewer.ScrollToBottom(); } }; InitializeComponent(); }
private void Application_Startup(object sender, StartupEventArgs e) { var viewmodel = new ConsoleViewModel( new GenerateNewWeapon( new GenerateWeaponName(), new GenerateDamageType(), new GenerateDamageStat())); new Console() { DataContext = viewmodel }.ShowDialog(); }
public void ShowCurrentConsoleHasNotBeenElevatedYetMessage_should_show_the_message() { // Arrange var fixture = new Fixture().Customize(new AutoMoqCustomization()); var vm = new ConsoleViewModel(); // Act vm.ShowCurrentConsoleHasNotBeenElevatedYetMessage(); // Assert Assert.IsNotNullOrEmpty(vm.Message.Value); }
public void ReportNuGetPackageCreatingProgress_should_report_the_progress() { // Arrange var fixture = new Fixture().Customize(new AutoMoqCustomization()); var pkgName = fixture.Create <string>(); var vm = new ConsoleViewModel(); // Act vm.ReportNuGetPackageCreatingProgress(pkgName); // Assert Assert.That(vm.Message.Value, Is.StringMatching(pkgName)); }
public void ReportProfilerStatusCheckingProgress_should_report_the_progress() { // Arrange var fixture = new Fixture().Customize(new AutoMoqCustomization()); var pathOfInstalling = fixture.Create <string>(); var profLoc = new ProfilerLocation(RegistryView.Registry64, pathOfInstalling); var vm = new ConsoleViewModel(); // Act vm.ReportProfilerStatusCheckingProgress(profLoc); // Assert Assert.That(vm.Message.Value, Is.StringMatching(pathOfInstalling)); }
public ConsoleViewModel BuildModel() { User user = GetUser(); /* * if (user.Inventory.Count == 0) { * List<InventoryItem> invItems = _context.InventoryItems.Where(ii => ii.UserID == user.UserID).ToList(); * foreach (InventoryItem item in invItems) * { * user.Inventory.Add(_context.Item.Where(i => i.ItemID == item.ItemID).FirstOrDefault()); * } * } */ Screen screen = _context.Screen.Include(s => s.ScreenInventory).Where(s => s.ScreenID == user.Screen).FirstOrDefault(); /* * List<InventoryItem> inventory = _context.InventoryItems.Where(inv => inv.UserID == user.UserID).ToList(); * foreach (InventoryItem invItem in inventory) * { * user.Inventory.Add(_context.Item.Where(i => i.ItemID == invItem.ItemID).FirstOrDefault()); * } * SaveUser(user); */ Chest chest = new Chest(); foreach (ScreenItem si in screen.ScreenInventory) { si.Item = _context.Item.Where(i => i.ItemID == si.ItemID).FirstOrDefault(); chest.ParentContainer = si.Item; List <InventoryItem> items = _context.InventoryItems.Where(i => i.ScreenItemID == si.ScreenItemID).ToList(); foreach (InventoryItem inv in items) { chest.ItemsInside.Add(inv.InventoryItemID, _context.Item.Where(i => i.ItemID == inv.ItemID).FirstOrDefault()); } } ConsoleViewModel model = new ConsoleViewModel(); model.User = user; model.Log = _context.FightLogs.Where(l => l.UserID == user.UserID).ToList(); model.AccessPoints = _context.AccessPoint.Where(a => a.From == user.Screen).ToList(); model.Screen = screen; model.Chest = chest; return(model); }
public void EndCompletedMachineWideProcessProgress_should_report_the_progress( [Values(MachineWideProcesses.Installing, MachineWideProcesses.Uninstalling)] MachineWideProcesses mwProc) { // Arrange var fixture = new Fixture().Customize(new AutoMoqCustomization()); var vm = new ConsoleViewModel(); vm.BeginMachineWideProcessProgress(mwProc); vm.ShowCompletedMachineWideProcessMessage(); // Act vm.EndCompletedMachineWideProcessProgress(); // Assert Assert.IsNotNullOrEmpty(vm.Message.Value); Assert.AreEqual(0, vm.ExitCode.Value); }
private void UserControl_DataContextChanged_1(object sender, DependencyPropertyChangedEventArgs e) { ConsoleViewModel tmpOldVM = e.OldValue as ConsoleViewModel; if (tmpOldVM != null) { tmpOldVM.SearchVM.FindNext -= OnSearchVM_FindNext; } ConsoleViewModel tmpNewVM = e.NewValue as ConsoleViewModel; if (tmpNewVM != null) { tmpNewVM.SearchVM.FindNext += OnSearchVM_FindNext; } this.txtCommand.Focus(); }
public void ReportEnvironmentVariableProcessedProgress_should_report_the_progress( [Values(MachineWideProcesses.Installing, MachineWideProcesses.Uninstalling)] MachineWideProcesses mwProc) { // Arrange var fixture = new Fixture().Customize(new AutoMoqCustomization()); var vm = new ConsoleViewModel(); vm.BeginMachineWideProcessProgress(mwProc); // Act vm.ReportEnvironmentVariableProcessedProgress(); // Assert Assert.IsNotNullOrEmpty(vm.Message.Value); }
public void ShowSkippedMachineWideProcessMessage_should_show_the_message( [Values(MachineWideProcesses.Installing, MachineWideProcesses.Uninstalling)] MachineWideProcesses mwProc, [Values(SkippedReasons.AlreadyRegistered, SkippedReasons.Error)] SkippedReasons reason) { // Arrange var fixture = new Fixture().Customize(new AutoMoqCustomization()); var vm = new ConsoleViewModel(); vm.BeginMachineWideProcessProgress(mwProc); // Act vm.ShowSkippedMachineWideProcessMessage(reason); // Assert Assert.IsNotNullOrEmpty(vm.Message.Value); }
public void EndSkippedMachineWideProcessProgress_should_report_the_progress( [Values(MachineWideProcesses.Installing, MachineWideProcesses.Uninstalling)] MachineWideProcesses mwProc, [Values(SkippedReasons.AlreadyRegistered, SkippedReasons.Error)] SkippedReasons reason) { // Arrange var fixture = new Fixture().Customize(new AutoMoqCustomization()); var vm = new ConsoleViewModel(); vm.BeginMachineWideProcessProgress(mwProc); vm.ShowSkippedMachineWideProcessMessage(reason); // Act vm.EndSkippedMachineWideProcessProgress(reason); // Assert Assert.IsNotNullOrEmpty(vm.Message.Value); Assert.AreEqual(10 + (int)reason, vm.ExitCode.Value); }
public void ReportProfilerProcessingProgress_should_report_the_progress( [Values(MachineWideProcesses.Installing, MachineWideProcesses.Uninstalling)] MachineWideProcesses mwProc) { // Arrange var fixture = new Fixture().Customize(new AutoMoqCustomization()); var pathOfInstalling = fixture.Create <string>(); var profLoc = new ProfilerLocation(RegistryView.Registry64, pathOfInstalling); var vm = new ConsoleViewModel(); vm.BeginMachineWideProcessProgress(mwProc); // Act vm.ReportProfilerProcessingProgress(profLoc); // Assert Assert.That(vm.Message.Value, Is.StringMatching(pathOfInstalling)); }
public void ReportNuGetSourceProcessingProgress_should_report_the_progress( [Values(MachineWideProcesses.Installing, MachineWideProcesses.Uninstalling)] MachineWideProcesses mwProc) { // Arrange var fixture = new Fixture().Customize(new AutoMoqCustomization()); var path = fixture.Create <string>(); var name = fixture.Create <string>(); var vm = new ConsoleViewModel(); vm.BeginMachineWideProcessProgress(mwProc); // Act vm.ReportNuGetSourceProcessingProgress(path, name); // Assert Assert.That(vm.Message.Value, Is.StringMatching(string.Format("({0})|({1})", path, name))); }
private void ConsoleExtensionAppThread(object obj) { Thread.CurrentThread.SetApartmentState(ApartmentState.STA); try { _dispatcher = Dispatcher.CurrentDispatcher; _viewModel = new ConsoleViewModel(); "Console Extension App Thread Started".Log(); _view = new Mubox.Extensions.Console.Views.ConsoleView(); _presenter = new System.Windows.Window(); //_presenter.Title = (AppDomain.CurrentDomain.FriendlyName ?? "Default").Replace('.', ' '); _presenter.Title = "Mubox Console"; _presenter.Topmost = true; _presenter.WindowStyle = WindowStyle.SingleBorderWindow; /* transparent window * _presenter.WindowStyle = WindowStyle.None; * _presenter.BorderThickness = new Thickness(1); * _presenter.AllowsTransparency = true; * _presenter.Background = new System.Windows.Media.SolidColorBrush(System.Windows.Media.Color.FromArgb(0, 0, 0, 0)); */ _presenter.DataContext = _viewModel; _presenter.Content = _view; _view.Margin = new Thickness(0); _presenter.Closing += OnWindowClosing; // TODO: save/restore last-known size and position _presenter.WindowStartupLocation = WindowStartupLocation.Manual; _presenter.Width = 512.0; _presenter.Height = 256; _presenter.Top = 32; _presenter.Left = 32; _application = new System.Windows.Application(); _application.Run(_presenter); } finally { "Console Extension App Thread Exiting".Log(); } }
private void ConsoleView_DataContextChanged(object sender, DependencyPropertyChangedEventArgs e) { if (DataContext is ConsoleViewModel) { ConsoleViewModel vm = (ConsoleViewModel)DataContext; TextBoxWriter Output = new TextBoxWriter(vm); TextBoxWriter Error = new TextBoxWriter(vm); TextBoxReader Input = new TextBoxReader(vm); vm.FocusEvent = () => { txtOutput.Dispatcher.BeginInvoke(DispatcherPriority.Normal, new Action(() => { txtOutput.Focus(); Keyboard.Focus(txtOutput); })); }; //Routing.EventManager.ChangeIO(String.Empty, ConsoleModel.GetInstance().Output, ConsoleModel.GetInstance().Error, null); Events.InvokeEvent("SetIO", String.Empty, Output, Error, Input); } }
public UpdateCommandListingCommand(ConsoleViewModel vm) { VM = vm; }
public Console() { InitializeComponent(); ViewModel = new ConsoleViewModel(); this.DataContext = ViewModel; }
public void ReportNuGetPackageCreatingProgress_should_report_the_progress() { // Arrange var fixture = new Fixture().Customize(new AutoMoqCustomization()); var pkgName = fixture.Create<string>(); var vm = new ConsoleViewModel(); // Act vm.ReportNuGetPackageCreatingProgress(pkgName); // Assert Assert.That(vm.Message.Value, Is.StringMatching(pkgName)); }
public void ReportNuGetSourceProcessingProgress_should_report_the_progress( [Values(MachineWideProcesses.Installing, MachineWideProcesses.Uninstalling)] MachineWideProcesses mwProc) { // Arrange var fixture = new Fixture().Customize(new AutoMoqCustomization()); var path = fixture.Create<string>(); var name = fixture.Create<string>(); var vm = new ConsoleViewModel(); vm.BeginMachineWideProcessProgress(mwProc); // Act vm.ReportNuGetSourceProcessingProgress(path, name); // Assert Assert.That(vm.Message.Value, Is.StringMatching(string.Format("({0})|({1})", path, name))); }
protected ConsoleCommand(ConsoleViewModel vm) : base(vm) { }
protected ConsoleCommand(ConsoleViewModel vm, IObservable<bool> canExecuteSource) : base(vm, canExecuteSource) { }
public UnregisterPrigCommand(ConsoleViewModel vm) : base(vm) { }
public AttachConsoleCommand(ConsoleViewModel vm) { VM = vm; }
public void ReportProfilerProcessingProgress_should_report_the_progress( [Values(MachineWideProcesses.Installing, MachineWideProcesses.Uninstalling)] MachineWideProcesses mwProc) { // Arrange var fixture = new Fixture().Customize(new AutoMoqCustomization()); var pathOfInstalling = fixture.Create<string>(); var profLoc = new ProfilerLocation(RegistryView.Registry64, pathOfInstalling); var vm = new ConsoleViewModel(); vm.BeginMachineWideProcessProgress(mwProc); // Act vm.ReportProfilerProcessingProgress(profLoc); // Assert Assert.That(vm.Message.Value, Is.StringMatching(pathOfInstalling)); }
public void ReportProfilerStatusCheckingProgress_should_report_the_progress() { // Arrange var fixture = new Fixture().Customize(new AutoMoqCustomization()); var pathOfInstalling = fixture.Create<string>(); var profLoc = new ProfilerLocation(RegistryView.Registry64, pathOfInstalling); var vm = new ConsoleViewModel(); // Act vm.ReportProfilerStatusCheckingProgress(profLoc); // Assert Assert.That(vm.Message.Value, Is.StringMatching(pathOfInstalling)); }