private void SelectPrevious() { if (_backgrounds.Any()) { BackgroundListItemViewModel selected = _backgrounds.FirstOrDefault(x => x.IsSelected); foreach (BackgroundListItemViewModel background in _backgrounds) { background.IsSelected = false; } if (selected == null) { _backgrounds[_backgrounds.Count - 1].IsSelected = true; _selectedBackground = new BackgroundViewModel(_backgrounds[_backgrounds.Count - 1].BackgroundModel); } else { int index = Math.Max(_backgrounds.IndexOf(selected) - 1, 0); _backgrounds[index].IsSelected = true; _selectedBackground = new BackgroundViewModel(_backgrounds[index].BackgroundModel); } OnPropertyChanged(nameof(SelectedBackground)); } }
private void EditBackground(BackgroundViewModel background) { _editBackgroundXML = background.XML; OnPropertyChanged(nameof(EditingBackgroundXML)); OnPropertyChanged(nameof(IsEditingBackground)); }
private IEnumerator Start() { guiCamera = CameraManager.AddCamera("GUI Camera", enableAudioListener: true); while (!ViewModel.Initialized) { yield return(null); } StartupMenuViewModel startupMenuViewModel = UIManager.Create <StartupMenuViewModel>(); BackgroundViewModel backgroundViewModel = UIManager.Create <BackgroundViewModel>(); startupMenuViewModel.IsActive = true; backgroundViewModel.IsActive = true; startupMenuViewModel.ZIndex = 1; backgroundViewModel.ZIndex = 0; EventManager.Subscribe <OnSinglePlayerButtonClicked>((o, e) => { Instantiate(Singelplayer); CurrentMode = Mode.Single; }); EventManager.Subscribe <OnMultiPlayersButtonClicked>((o, e) => { Instantiate(Multiplayers); CurrentMode = Mode.Multi; }); }
private void SelectBackground(BackgroundViewModel background) { SelectedBackground?.Deselect(); SelectedBackground = background; SelectedBackground?.Select(); DeleteBackgroundCommand?.OnCanExecuteChanged(); }
public BackgroundView() { this.InitializeComponent(); ViewModelLocator myVML = new ViewModelLocator(); myBackgroundVM = myVML.BackgroundVM; }
private void ExportBackground(BackgroundViewModel backgroundViewModel) { Microsoft.Win32.SaveFileDialog saveFileDialog = new Microsoft.Win32.SaveFileDialog(); saveFileDialog.Filter = "XML Document|*.xml"; saveFileDialog.Title = "Save Background"; saveFileDialog.FileName = backgroundViewModel.Name; if (saveFileDialog.ShowDialog() == true) { try { string ext = System.IO.Path.GetExtension(saveFileDialog.FileName); if (ext == ".xml") { string xml = _xmlExporter.FormatXMLWithHeader(_xmlExporter.GetXML(backgroundViewModel.BackgroundModel)); System.IO.File.WriteAllText(saveFileDialog.FileName, xml, System.Text.Encoding.UTF8); } else { _dialogService.ShowConfirmationDialog("Unable To Export", "Invalid file extension.", "OK", null, null); } } catch (Exception) { _dialogService.ShowConfirmationDialog("Unable To Export", "An error occurred when attempting to export the background.", "OK", null, null); } } }
private void InitializeBackgroundView(BackgroundViewModel background) { var view = background.CreateTileView(); background.Command = SelectBackgroundCommand; background.CommandParameter = background; BackgroundViews.Add(view); }
public ActionResult DriversView() { List <BackgroundCheck> driverCheck = db.BackgroundCheck.ToList(); BackgroundViewModel backgroundVM = new BackgroundViewModel(); List <BackgroundViewModel> backgroundListVm = driverCheck.Select(x => new BackgroundViewModel { FirstName = x.Driver.FirstName, LastName = x.Driver.LastName, PhoneNumber = x.Driver.PhoneNumber, InsuranceProvider = x.InsuranceProvider, ExpirationDate = x.ExpirationDate, DrivingLicence = x.DrivingLicence, LicenceState = x.LicenceState, VehicleType = x.VehicleType, VehicleYear = x.VehicleYear, Date_of_Birth = x.Date_of_Birth, Ssn = x.Ssn }).ToList(); return(View(backgroundListVm)); }
private void CreateBackgroundColor() { var background = new BackgroundViewModel() { Type = BackgroundType.SolidColor, BackgroundData = SelectedColor.ToString() }; UserData.Backgrounds.Add(background); HideCreateView(); }
public BackgroundOrganiserView() { InitializeComponent(); BackgroundViewModel bgViewModel = new BackgroundViewModel( (TrayApp)DependencyFactory.Container.Resolve(typeof(TrayApp), "trayApp"), (Configs)DependencyFactory.Container.Resolve(typeof(Configs), "configs"), (OrganisationSyncer)DependencyFactory.Container.Resolve(typeof(OrganisationSyncer), "organisationSyncer"), (BackgroundOrganiser)DependencyFactory.Container.Resolve(typeof(BackgroundOrganiser), "bgOrganiser")); this.DataContext = bgViewModel; }
private void CreateBackgroundImage() { var background = new BackgroundViewModel() { Type = BackgroundType.Image, BackgroundData = SelectedFilePath }; UserData.Backgrounds.Add(background); HideCreateView(); SelectedFilePath = null; }
/// <summary> /// Shows details dialog /// </summary> public void ShowDetailsDialog(BackgroundViewModel backgroundViewModel) { ModalDialog modalDialog = new ModalDialog(); if (_parentWindow != null) { modalDialog.Owner = _parentWindow; } modalDialog.WindowTitle = backgroundViewModel.Name; modalDialog.Body = new DetailsView(backgroundViewModel); ShowDialog(modalDialog); }
private void Delete() { if (_selectedBackground != null) { bool canDelete = true; foreach (CharacterModel character in _compendium.Characters) { if (character.Background != null && character.Background.Id == _selectedBackground.BackgroundModel.Id) { canDelete = false; break; } } if (canDelete) { string message = String.Format("Are you sure you want to delete {0}?", _selectedBackground.Name); bool?result = _dialogService.ShowConfirmationDialog("Delete Background", message, "Yes", "No", null); if (result == true) { _compendium.DeleteBackground(_selectedBackground.BackgroundModel.Id); BackgroundListItemViewModel listItem = _backgrounds.FirstOrDefault(x => x.BackgroundModel.Id == _selectedBackground.BackgroundModel.Id); if (listItem != null) { _backgrounds.Remove(listItem); } _selectedBackground = null; _compendium.SaveBackgrounds(); OnPropertyChanged(nameof(SelectedBackground)); if (_editBackgroundXML != null) { CancelEditBackground(); } } } else { _dialogService.ShowConfirmationDialog("Unable Delete Background", "Background is in use by a character.", "OK", null, null); } } }
private void SelectBackground(BackgroundListItemViewModel background) { bool selectBackground = true; if (_editBackgroundXML != null) { if (_editHasUnsavedChanges) { string body = String.Format("{0} has unsaved changes.{1}What would you like to do?", _selectedBackground.Name, Environment.NewLine + Environment.NewLine); string accept = "Save and Continue"; string reject = "Discard Changes"; string cancel = "Cancel Navigation"; bool? result = _dialogService.ShowConfirmationDialog("Unsaved Changes", body, accept, reject, cancel); if (result == true) { if (!SaveEditBackground()) { selectBackground = false; } } else if (result == false) { CancelEditBackground(); } else { selectBackground = false; } } else { CancelEditBackground(); } } if (selectBackground) { foreach (BackgroundListItemViewModel item in _backgrounds) { item.IsSelected = false; } background.IsSelected = true; _selectedBackground = new BackgroundViewModel(background.BackgroundModel); OnPropertyChanged(nameof(SelectedBackground)); } }
public async Task AddAsync() { var destDataBaseName = await this.SelectDataBaseAsync(); if (destDataBaseName == null) { return; } var task = new BackgroundViewModel(this.authenticator, this.cremaHost, this.cremaAppHost.DataBaseName, destDataBaseName); task.ProgressChanged += Task_ProgressChanged; var dialog = new BackgroundTaskViewModel(this.statusBarService, task: task) { DisplayName = "데이터 베이스 비교하기", }; await dialog.ShowDialogAsync(); }
public virtual ActionResult Index() { var dvm = _ctx.Demographics.Select(d => new DropDownViewModel { Value = d.Id, Text = d.Name }).ToList(); var cvm = _ctx.Categories.Select(c => new DropDownViewModel { Value = c.Id, Text = c.Name, }).ToList(); var model = new BackgroundViewModel { Demographics = dvm, Categories = cvm, }; return View(model); }
/// <summary> /// 初始化数据绑定资源 /// </summary> private void InitializeBindingSource() { userViewModel = new UserViewModel(); eventViewModel = new EventViewModel(); backgroundViewModel = new BackgroundViewModel(); }
private bool SaveEditBackground() { bool saved = false; try { BackgroundModel model = _xmlImporter.GetBackground(_editBackgroundXML); if (model != null) { model.Id = _selectedBackground.BackgroundModel.Id; _compendium.UpdateBackground(model); _selectedBackground = new BackgroundViewModel(model); BackgroundListItemViewModel oldListItem = _backgrounds.FirstOrDefault(x => x.BackgroundModel.Id == model.Id); if (oldListItem != null) { if (_backgroundSearchService.SearchInputApplies(_backgroundSearchInput, model)) { oldListItem.UpdateModel(model); } else { _backgrounds.Remove(oldListItem); } } _editBackgroundXML = null; _editHasUnsavedChanges = false; SortBackgrounds(); _compendium.SaveBackgrounds(); OnPropertyChanged(nameof(SelectedBackground)); OnPropertyChanged(nameof(EditingBackgroundXML)); OnPropertyChanged(nameof(IsEditingBackground)); OnPropertyChanged(nameof(HasUnsavedChanges)); saved = true; } else { string message = String.Format("Something went wrong...{0}{1}{2}{3}", Environment.NewLine + Environment.NewLine, "The following are required:", Environment.NewLine, "-name"); _dialogService.ShowConfirmationDialog("Unable To Save", message, "OK", null, null); } } catch (Exception ex) { string message = String.Format("Something went wrong...{0}{1}", Environment.NewLine + Environment.NewLine, ex.Message); _dialogService.ShowConfirmationDialog("Unable To Save", message, "OK", null, null); } return(saved); }
private void SelectBackground(BackgroundViewModel background) { Tile.Background?.Deselect(); Tile.Background = background; Tile.Background?.Select(); }
}//ctor //- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -// public OrderItemViewModel(MyDictionary <T> map, IEnumerable <T> list, Action setFocus) { UpdateData(map, list); Background = new BackgroundViewModel(); }//ctor
public MainViewModel() { BackgroundVm = new BackgroundViewModel(this); }
//-------------------------------------------------------------------------------// public ResultViewModel() { Background = new BackgroundViewModel(); Caret = new CaretViewModel(); }//ctor
private void Add() { bool addBackground = true; if (_editBackgroundXML != null) { if (_editHasUnsavedChanges) { string body = String.Format("{0} has unsaved changes.{1}What would you like to do?", _selectedBackground.Name, Environment.NewLine + Environment.NewLine); string accept = "Save and Continue"; string reject = "Discard Changes"; string cancel = "Cancel Navigation"; bool? result = _dialogService.ShowConfirmationDialog("Unsaved Changes", body, accept, reject, cancel); if (result == true) { if (!SaveEditBackground()) { addBackground = false; } } else if (result == false) { CancelEditBackground(); } else { addBackground = false; } } else { CancelEditBackground(); } } if (addBackground) { string xml = "<name>New Background</name><proficiency></proficiency><trait><name></name><text></text></trait>"; BackgroundModel backgroundModel = _xmlImporter.GetBackground(xml); _compendium.AddBackground(backgroundModel); if (_backgroundSearchService.SearchInputApplies(_backgroundSearchInput, backgroundModel)) { BackgroundListItemViewModel listItem = new BackgroundListItemViewModel(backgroundModel, _stringService); _backgrounds.Add(listItem); foreach (BackgroundListItemViewModel item in _backgrounds) { item.IsSelected = false; } listItem.IsSelected = true; } _selectedBackground = new BackgroundViewModel(backgroundModel); _editBackgroundXML = backgroundModel.XML; SortBackgrounds(); _compendium.SaveBackgrounds(); OnPropertyChanged(nameof(EditingBackgroundXML)); OnPropertyChanged(nameof(IsEditingBackground)); OnPropertyChanged(nameof(SelectedBackground)); } }
private void Copy() { if (_selectedBackground != null) { bool copyBackground = true; if (_editBackgroundXML != null) { if (_editHasUnsavedChanges) { string body = String.Format("{0} has unsaved changes.{1}What would you like to do?", _selectedBackground.Name, Environment.NewLine + Environment.NewLine); string accept = "Save and Continue"; string reject = "Discard Changes"; string cancel = "Cancel Navigation"; bool? result = _dialogService.ShowConfirmationDialog("Unsaved Changes", body, accept, reject, cancel); if (result == true) { if (!SaveEditBackground()) { copyBackground = false; } } else if (result == false) { CancelEditBackground(); } else { copyBackground = false; } } else { CancelEditBackground(); } } if (copyBackground) { BackgroundModel newBackground = new BackgroundModel(_selectedBackground.BackgroundModel); newBackground.Name += " (copy)"; newBackground.Id = Guid.NewGuid(); newBackground.XML = newBackground.XML.Replace("<name>" + _selectedBackground.BackgroundModel.Name + "</name>", "<name>" + newBackground.Name + "</name>"); _compendium.AddBackground(newBackground); if (_backgroundSearchService.SearchInputApplies(_backgroundSearchInput, newBackground)) { BackgroundListItemViewModel listItem = new BackgroundListItemViewModel(newBackground, _stringService); _backgrounds.Add(listItem); foreach (BackgroundListItemViewModel item in _backgrounds) { item.IsSelected = false; } listItem.IsSelected = true; } _selectedBackground = new BackgroundViewModel(newBackground); SortBackgrounds(); _compendium.SaveBackgrounds(); OnPropertyChanged(nameof(SelectedBackground)); } } }
public BackgroundPage(BackgroundViewModel model) { BindingContext = model; model.Navigation = Navigation; InitializeComponent(); }
public MainViewModel() { Person = new PersonViewModel(); Background = new BackgroundViewModel(); }