public Game() { _options = new OptionsViewModel(); _options.Language = _options.Language; _availableSuits = new List<SuitEnum>(_suits); _collection = new DeckCollection(_availableSuits); _generalDeck = new List<Card>(); _steps = new List<Step>(); }
public BuildTreeSection() { Title = "Build Tree"; IsVisible = true; IsExpanded = true; IsBusy = false; SectionContent = new BuildTreeView(); View.ParentSection = this; _optionsViewModel = new OptionsViewModel(); _dialogService = new DialogService(new WindowViewModelMappings());//ServiceLocator.Resolve<IDialogService>(); }
private void ShowOptionsWindowMethod() { OptionsModel model = new OptionsModel(); OptionsViewModel viewModel = new OptionsViewModel(model); OptionsWindow view = new OptionsWindow(); view.DataContext = viewModel; view.ShowDialog(); }
public void AfterLoadSettings_AllProperties_ShouldBeSet() { OptionsViewModel target = new OptionsViewModel(new TestSettingsProvider()); target.LoadSettings(); Assert.AreEqual(@"Default Player", target.DefaultHumanPlayerName); Assert.AreEqual(7, target.DefaultComputerPlayers); Assert.IsTrue(target.AutoCheckForUpdates); return; }
public async Task <FormsViewModel> Get(int formId) { var formCategoryAssignment = await _context.FormsCategoryAssignments .Where(c => c.FormId == formId) .Include(f => f.FormsInfo) .Include(c => c.Categories) .FirstOrDefaultAsync(); var questions = await _context.QuestionsFormAssignments .Where(qfa => qfa.FormId == formId) .Include(q => q.Questions) .ThenInclude(qt => qt.QuestionTypes) .ToListAsync(); var options = await _context.OptionsQuestionAssignmnents .Where(oqa => oqa.FormId == formId) .Include(o => o.Options) .ToListAsync(); //Save fetched data to FormsViewModel var form = new FormsViewModel { Questions = new List <QuestionsViewModel>(), CategoryId = formCategoryAssignment.CategoryId, CategoryName = formCategoryAssignment.Categories.CategoryName, DestinationEmail = formCategoryAssignment.FormsInfo.DestinationEmail, FormName = formCategoryAssignment.FormsInfo.FormName, IsAnonymous = formCategoryAssignment.FormsInfo.IsAnonymous }; foreach (var fetchedQuestion in questions) { var question = new QuestionsViewModel { QuestionName = fetchedQuestion.Questions.QuestionName, QuestionOrderNum = fetchedQuestion.QuestionOrderNum, QuestionType = fetchedQuestion.Questions.QuestionTypes.QuestionType, QuestionTypeOrderNum = fetchedQuestion.QuestionTypeOrderNum, Options = new List <OptionsViewModel>() }; foreach (var fetchedOption in options.Where(o => o.QuestionOrderNum == question.QuestionOrderNum)) { var option = new OptionsViewModel { OptionName = fetchedOption.Options.OptionName, OptionOrderNum = fetchedOption.OptionOrderNum }; question.Options.Add(option); } form.Questions.Add(question); } return(form); }
public OptionsView() { InitializeComponent(); viewModel = mainGrid.DataContext as OptionsViewModel; globalEventProvider = new GlobalEventProvider(); //makes sure all up keys are parsed, before resetting with the debounced down key event globalKeyUpEventHandler = globalEventProvider.CreateDebounceKeyEventHandler(Global_OnKeyUp, TimeSpan.FromMilliseconds(300)); AttachGlobalKeyListener(); }
public OptionsWindow(MainWindow mainWindow) { _mainWindow = mainWindow; InitializeComponent(); //Initialize the viewmodel _monitorNames = ScreenBoundsHelper.GetMonitorNames(); OptionsViewModel = new OptionsViewModel(this) { ScreenMirrorAlgorithmPerDevice = UserSettings.Settings.Devices.ToDictionary(d => d.Name, d => d.ScreenMirrorAlgorithm), ScreenMirrorFlipPerDevice = UserSettings.Settings.Devices.ToDictionary(d => d.Name, d => d.ScreenMirrorFlip), ScreenMirrorRefreshRatePerSecond = UserSettings.Settings.ScreenMirrorRefreshRatePerSecond, SelectedMonitor = _monitorNames.ElementAt(UserSettings.Settings.ScreenMirrorMonitorIndex), DeviceNames = new ObservableCollection <string>(UserSettings.Settings.Devices.Select(d => d.Name)), MonitorNames = _monitorNames, StartAtWindowsStartUp = UserSettings.Settings.StartAtWindowsStartup, Latitude = UserSettings.Settings.Latitude?.ToString("N7", CultureInfo.InvariantCulture), Longitude = UserSettings.Settings.Longitude?.ToString("N7", CultureInfo.InvariantCulture), SelectedLanguage = FullNameForCulture(UserSettings.Settings.UserLocale), Languages = _languageDictionary.Keys.ToList(), MinimizeToSystemTray = UserSettings.Settings.MinimizeToSystemTray, CustomColorEffects = UserSettings.Settings.CustomEffects == null ? new List <UserCustomColorEffect>() : UserSettings.Settings.CustomEffects.ToList(), WinleafsServerURL = UserSettings.Settings.WinleafServerURL, ProcessResetIntervalText = UserSettings.Settings.ProcessResetIntervalInSeconds.ToString() }; foreach (var customEffects in OptionsViewModel.CustomColorEffects) { ColorList.Children.Add(new ColorUserControl(this, customEffects.EffectName, customEffects.Color)); } OptionsViewModel.SelectedDevice = UserSettings.Settings.ActiveDevice.Name; //Set this one last since it triggers changes in properties //Initialize variables _startupKey = Registry.CurrentUser.OpenSubKey("SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Run", RegistryKeyPermissionCheck.ReadWriteSubTree, RegistryRights.FullControl); _visualizationOpen = false; foreach (var device in UserSettings.Settings.Devices) { DeviceList.Children.Add(new DeviceUserControl(device.Name, this)); } //Draw monitors DrawMonitors(); //Check Spotify connection _winleafsServerClient = new WinleafsServerClient(); InitializeSpotifyButtons(); //last: set datacontext DataContext = OptionsViewModel; }
public OptionsPageControl(OptionsViewModel viewModel, IVsStatusbar statusBar) { InitializeComponent(); DataContext = viewModel; _statusBar = statusBar; Loaded += async(s, e) => await UpdateModelAsync(false).ConfigureAwait(false); Unloaded += (s, e) => viewModel.Save(); }
public OptionsWindow(MainWindow mainWindow) { _mainWindow = mainWindow; InitializeComponent(); var monitorNames = WindowsDisplayAPI.DisplayConfig.PathDisplayTarget.GetDisplayTargets().Select(m => m.FriendlyName).ToList(); OptionsViewModel = new OptionsViewModel(this) { AlgorithmPerDevice = UserSettings.Settings.Devices.ToDictionary(d => d.Name, d => d.ScreenMirrorAlgorithm), ScreenMirrorControlBrightnessPerDevice = UserSettings.Settings.Devices.ToDictionary(d => d.Name, d => d.ScreenMirrorControlBrightness), ScreenMirrorRefreshRatePerDevice = UserSettings.Settings.Devices.ToDictionary(d => d.Name, d => d.ScreenMirrorRefreshRatePerSecond), DeviceNames = new ObservableCollection <string>(UserSettings.Settings.Devices.Select(d => d.Name)), MonitorNames = monitorNames, StartAtWindowsStartUp = UserSettings.Settings.StartAtWindowsStartup, Latitude = UserSettings.Settings.Latitude?.ToString("N7", CultureInfo.InvariantCulture), Longitude = UserSettings.Settings.Longitude?.ToString("N7", CultureInfo.InvariantCulture), SelectedLanguage = FullNameForCulture(UserSettings.Settings.UserLocale), Languages = _languageDictionary.Keys.ToList(), MinimizeToSystemTray = UserSettings.Settings.MinimizeToSystemTray, CustomColorEffects = UserSettings.Settings.CustomEffects == null ? new List <UserCustomColorEffect>() : UserSettings.Settings.CustomEffects.ToList() }; //Setup MonitorPerDevice with necessary checks var monitorPerDevice = new Dictionary <string, string>(); foreach (var device in UserSettings.Settings.Devices) { if (monitorNames.Count <= device.ScreenMirrorMonitorIndex) { // It is possible that the user adjusted his/her screen setup and no longer has the monitor the device is set to monitorPerDevice.Add(device.Name, monitorNames.FirstOrDefault()); } else { monitorPerDevice.Add(device.Name, monitorNames[device.ScreenMirrorMonitorIndex]); } } foreach (var customEffects in OptionsViewModel.CustomColorEffects) { ColorList.Children.Add(new ColorUserControl(this, customEffects.EffectName, customEffects.Color)); } OptionsViewModel.MonitorPerDevice = monitorPerDevice; OptionsViewModel.SelectedDevice = UserSettings.Settings.ActiveDevice.Name; //Set this one last since it triggers changes in properties _startupKey = Registry.CurrentUser.OpenSubKey("SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Run", RegistryKeyPermissionCheck.ReadWriteSubTree, RegistryRights.FullControl); _visualizationOpen = false; DataContext = OptionsViewModel; }
public MainWindow() { InitializeComponent(); OptionsViewModel.Create(); DataContext = ViewModel = new BackendViewModel(); ViewModel.SetLoadingLyrics(); DispatcherTimer t = new DispatcherTimer(); t.Tick += Tick; t.Interval = TimeSpan.FromSeconds(1); t.Start(); }
public OptionsController( OptionsViewModel viewModel, CommonServices svc, IOptionsManager optionsManager) { _viewModel = viewModel; _svc = svc; _optionsManager = optionsManager; _viewModel.CommandSave = new SmartCommand(SaveResults); _viewModel.CommandClose = new SmartCommand(Close); }
public OptionsWindow() { this.InitializeComponent(); if (!DesignerProperties.GetIsInDesignMode(this)) { this.viewModel = new OptionsViewModel(new DesktopSettingsProvider()); this.viewModel.LoadSettings(); this.DataContext = this.viewModel; this.buttonOk.Click += new RoutedEventHandler(this.ButtonOk_Click); } }
public IActionResult Update(OptionsViewModel model, int paymentMethodToEdit) { var selected = payRep.RetrievePaymentMethodsById(paymentMethodToEdit); if (selected.RetrieveID() != 0) { var newPaymentMethod = new Payment(selected.RetrieveID(), model.PaymentMethodName, model.PaymentMethodDescription); payRep.UpdatePaymentMethodById(newPaymentMethod); return(RedirectToAction("Overview", "PaymentMethod", selected)); } return(RedirectToAction("Overview", "PaymentMethod")); }
public App() { //MessageBox.Show("This is an updated version!"); //Interaction logic for all known connections as well as all other started features var mainViewModel = new MainViewModel(); //declare services var dataService = new StackOverflowDataService(); var toastService = new ToastService(); var profileViewModel = new ProfileViewModel(dataService); var messagesviewModel = new MessagesViewModel(); var optionsViewModel = new OptionsViewModel(); // Note(Matthew): Hooking into everything that needs to be notified that new messages are coming in from stack overflow dataService.IncomingNotificationsEvent += toastService.PostNotifications; dataService.IncomingNotificationsEvent += messagesviewModel.ProcessNotifications; // Note(Matthew): this will start the call for seeing if the token is actually valid. var token = Spillway.Properties.Settings.Default.Access_Token; if (!String.IsNullOrEmpty(token)) { dataService.SetToken(token); } // Note(Matthew): Adding in the views mainViewModel.Tabs.Add(profileViewModel); mainViewModel.Tabs.Add(messagesviewModel); mainViewModel.Tabs.Add(optionsViewModel); #if DEBUG // Note(Matthew): Added in a debug panel to test ui functionality so to easially debug in future cases. I might want to remove this later var debugPanel = new DebugViewModel(); debugPanel.Toasts = toastService; debugPanel.DataManager = dataService; debugPanel.Messages = messagesviewModel; mainViewModel.Tabs.Add(debugPanel); #endif var dataTimingService = new DataTimingService(dataService, null, 0); mainViewModel.TimingService = dataTimingService; mainViewModel.SelectedTab = profileViewModel; MainWindow mw = new MainWindow(); mw.DataContext = mainViewModel; mw.Show(); //kick off update in the background Task.Run(() => { mainViewModel.CheckForUpdate(); });; }
private void UpdateModel(MenuViewModel model, Menu NewMenu, OptionsViewModel moreInfo) { _hrUnitOfWork.MenuRepository.AddLName(Language, NewMenu.Name + NewMenu.Version, model.MenuName + NewMenu.Version, model.Title); if (model.IFunctions != null && model.IFunctions.Count() > 0) { var MenuFunc = _hrUnitOfWork.Repository <MenuFunction>().Where(a => a.MenuId == NewMenu.Id).ToList(); var Funclist = model.IFunctions.Select(a => a).ToList(); foreach (var item in Funclist) { if (!MenuFunc.Select(a => a.FunctionId).Contains(item)) { _hrUnitOfWork.MenuRepository.Add(new MenuFunction() { FunctionId = item, Menu = NewMenu }); } } foreach (var item in MenuFunc) { if (!Funclist.Contains(item.FunctionId)) { _hrUnitOfWork.MenuRepository.Remove(item); } } } if (NewMenu == null) { AutoMapper(new Models.AutoMapperParm { Destination = NewMenu, Source = model, ObjectName = "MenuForm", Version = NewMenu.Version, Options = moreInfo, Transtype = TransType.Insert }); } else { AutoMapper(new Models.AutoMapperParm { Destination = NewMenu, Source = model, ObjectName = "MenuForm", Version = NewMenu.Version, Options = moreInfo, Transtype = TransType.Update }); } NewMenu.Name = model.MenuName; }
public OptionsPageTemplateOptions() { _settingsService = MvvmToolsPackage.Container.Resolve <ISettingsService>(); // Create a WinForms container for our WPF General Options page. _dialog = MvvmToolsPackage.Container.Resolve <OptionsTemplateOptionsUserControl>(); // Create, initialize, and bind a view model to our user control. // This is a singleton. _viewModel = MvvmToolsPackage.Container.Resolve <OptionsViewModel>(); _dialog.DataContext = _viewModel; _viewModel.Init(); }
public OptionsPageSolutionAndProjects() { _settingsService = MvvmToolsPackage.Kernel.Get <ISettingsService>(); // Create a WinForms container for our WPF General Options page. _dialog = MvvmToolsPackage.Kernel.Get <OptionsSolutionAndProjectsUserControl>(); // Create, initialize, and bind a view model to our user control. // This is a singleton. _viewModel = MvvmToolsPackage.Kernel.Get <OptionsViewModel>(); _dialog.DataContext = _viewModel; _viewModel.Init(); }
public ApiPortVsAnalyzer( ApiPortClient client, OptionsViewModel optionsViewModel, OutputWindowWriter outputWindow, IReportViewer viewer, IProgressReporter reporter) { _client = client; _optionsViewModel = optionsViewModel; _outputWindow = outputWindow; _viewer = viewer; _reporter = reporter; }
/// <summary> /// Project the options sent from the web page onto the role /// </summary> /// <param name="role"></param> /// <param name="options"></param> /// <remarks>The mapping is only done if the website sent non-default values</remarks> private static void OverwriteRoleOptions(Role role, OptionsViewModel options) { if (options == null) { return; } const string dropDownDefault = "----"; role.Options.InstanceType = options.InstanceType == dropDownDefault ? role.Options.InstanceType : options.InstanceType; role.Options.VolumeType = options.VolumeType == dropDownDefault ? role.Options.VolumeType : options.VolumeType; role.Options.VolumeSize = options.VolumeSize == 0 ? role.Options.VolumeSize : options.VolumeSize; }
public OptionsPageGeneral() { _settingsService = MvvmToolsPackage.Kernel.Get <ISettingsService>(); _child = MvvmToolsPackage.Kernel.Get <OptionsGeneralUserControl>(); // Create, initialize, and bind a view model to our user control. // This is a singleton. _viewModel = MvvmToolsPackage.Kernel.Get <OptionsViewModel>(); _child.DataContext = _viewModel; _viewModel.Init(); }
private static OptionsWindow GetOptionsWindow(IWin32Window owner, LanguagePair[] languagePairs, SdlMTCloudTranslationProvider provider) { var optionsWindow = new OptionsWindow(); var _ = new WindowInteropHelper(optionsWindow) { Owner = owner.Handle }; var optionsViewModel = new OptionsViewModel(optionsWindow, provider, languagePairs.ToList()); optionsWindow.DataContext = optionsViewModel; return(optionsWindow); }
public IActionResult Options(OptionsViewModel viewModel) { switch (viewModel.MigrationOption) { case MigrationOptions.CheckCourses: return(RedirectToAction("Index", "ProviderCourses")); case MigrationOptions.StartAgain: return(RedirectToAction("Index", "BulkUpload")); default: return(RedirectToAction("Options", "Migration")); } }
/// <summary> /// Initializes a new instance of the <see cref="MainWindow"/> class. /// </summary> public MainWindow() { try { InitializeComponent(); errorLogViewModel = new ErrorLogViewModel(); optionsViewModel = new OptionsViewModel(); this.Height = optionsViewModel.VerticalScaleNumber; this.Width = optionsViewModel.HorizontalScaleNumber; } catch { } }
private void App_OnStartup(object sender, StartupEventArgs e) { JournalService.Initialize(); OptionsViewModel optionsViewModel = new OptionsViewModel(OptionsService.Instance); mainViewModel = new MainWindowViewModel(JournalService.Instance, OptionsService.Instance, optionsViewModel); MainWindow mainWindow = new MainWindow { ViewModel = mainViewModel }; Current.MainWindow = mainWindow; Current.MainWindow.Show(); }
public void Open(params Object[] parameters) { Window current = DialogExtensions.Get <OptionsWindow>(); if (current == null) { var settings = _app.Get <ISettings>(); var dialogs = _app.Get <IDialogManager>(); var context = new OptionsViewModel(settings, dialogs); current = WindowFactory.Instance.Create(context); } current.Show(); }
public IActionResult Add(OptionsViewModel model) { Payment p = new Payment(1, model.PaymentMethodName, model.PaymentMethodDescription); if (model.PaymentMethodDescription == null) { model.PaymentMethodDescription = "No description"; } if (payRep.CreateNewPaymentMethod(p)) { return(RedirectToAction("Overview", "PaymentMethod")); } return(RedirectToAction("Overview", "PaymentMethod")); }
public static void SerializeSettings(OptionsViewModel model) { string path = SettingsFilePath; if (File.Exists(path)) { StoreFile(path); } EnsureDirectory(path); using (StreamWriter writer = File.CreateText(path)) { var json = JsonConvert.SerializeObject(model, Formatting.Indented); writer.Write(json); } }
public void ListNativeSpecies_ReportsNoneWhenListEmpty() { var dialogService = new Mock <IDialogService>(); var clipboardService = new Mock <IClipboardService>(); var vm = new OptionsViewModel(clipboardService.Object, dialogService.Object); vm.SpeciesList.Clear(); vm.ListNonNativeSpeciesCommand.Execute(null); dialogService.Verify(d => d.ShowInfoMessageBox("Non-Native Species Summary", "There are no non-native species.")); clipboardService.VerifyNoOtherCalls(); }
/// <summary> /// OptionsOverview /// </summary> /// <returns>Return IActionresult</returns> public IActionResult Overview() { var model = new OptionsViewModel(); model.AllMethodsInSystem = new List <PaymentMethodViewModel>(); foreach (Payment p in payRep.RetrieveAllPayments()) { var mapper = mapextension.PaymentToPaymentViewModel(); PaymentMethodViewModel pmodel = mapper.Map <PaymentMethodViewModel>(p); model.AllMethodsInSystem.Add(pmodel); } return(View("OptionsOverview", model)); }
public void SuffixTest() { var source = "source"; var suffix = "_TEST"; var renameable = GetRenameable(source); var optionsVm = new OptionsViewModel { Suffix = suffix }; var action = optionsVm.Rename; action(renameable); renameable.Destination.Should().Be(source + suffix); }
public void PrefixTest() { var source = "source"; var prefix = "TEST_"; var renameable = GetRenameable(source); var optionsVm = new OptionsViewModel { Prefix = prefix }; var action = optionsVm.Rename; action(renameable); renameable.Destination.Should().Be(prefix + source); }
//public static Dispatcher dispatcher; public MainPage() { InitializeComponent(); //dispatcher = this.Dispatcher; if (newsListView == null) { newsListView = new NewsListViewModel(); PivotItemNews.DataContext = newsListView; UpdateTaskManager.Instance.StartUpdateManager(newsListView); // when newsListView is created, start update manager to download news periodically } if (optionsView == null) { optionsView = new OptionsViewModel(); PivotItemOpt.DataContext = optionsView; } }
public OptionsWindow(IMainContext parentContext) : base(400, 300, 400, 300) { InitializeComponent(); DataContext = new OptionsViewModel(parentContext); }
/// <summary> /// Task list /// </summary> /// <returns></returns> public ActionResult Index() { OptionsViewModel optionsViewModel = new OptionsViewModel(); optionsViewModel.Performers = _todoService.GetPerformerList().OrderBy(x => x.Name).ToList(); optionsViewModel.Statuses = _todoService.GetStatusList().OrderBy(x => x.Title).ToList(); optionsViewModel.Tags = _todoService.GetTagList().OrderBy(x => x.Text).ToList(); optionsViewModel.Priorities = _todoService.GetPriorityList().OrderBy(x => x.Title).ToList(); return View(optionsViewModel); }
public ShellViewModel(TopMenuViewModel topMenu, OptionsViewModel options) { _topMenu = topMenu; _options = options; }