public static bool SetField <T>(this PropertyChangedBase obj , ref T field, T value , bool overrideChecks = false , [System.Runtime.CompilerServices.CallerMemberName] string propertyName = "") { if (obj == null) { return(false); } if (!overrideChecks) { if (EqualityComparer <T> .Default.Equals(field, value)) { return(false); } } field = value; if (obj.IsNotifying) { obj.NotifyOfPropertyChange(propertyName); } return(true); }
public static bool SetFieldEnum <TEnum>(this PropertyChangedBase obj , ref TEnum field, TEnum value , bool overrideChecks = false , [System.Runtime.CompilerServices.CallerMemberName] string propertyName = "") where TEnum : struct, IComparable, IFormattable, IConvertible { if (obj == null) { return(false); } if (!overrideChecks) { if (field.ToInt64(null) == value.ToInt64(null)) { return(false); } } field = value; if (obj.IsNotifying) { obj.NotifyOfPropertyChange(propertyName); } return(true); }
void OpenLicenseVerify(string license) { WindowContent = new LicenseVerificationViewModel(); LicenseVerify(license); DialogOpenIfNotOpenedYet(); }
public SuppressNotificationScope(PropertyChangedBase model) { _wasNotifying = model.IsNotifying; _model = model; _model.IsNotifying = false; }
public static bool SetFieldObj <T>(this PropertyChangedBase obj , ref T field, T value , bool overrideChecks = false , [System.Runtime.CompilerServices.CallerMemberName] string propertyName = "") where T : class, IEquatable <T> { if (obj == null) { return(false); } if (!overrideChecks) { if (field == null) { if (value == null) { return(false); } } else if (field.Equals(value)) { return(false); } } field = value; if (obj.IsNotifying) { obj.NotifyOfPropertyChange(propertyName); } return(true); }
/// <summary> /// Opens the specified content. /// </summary> /// <param name="content">The content.</param> public void Open(PropertyChangedBase content) { this.ClearContent(); this.SetPosition(); this.SetContent(content); this._mouseLurker.MouseMove += this.MouseLurker_MouseMove; }
public void Handle(TerminationMessages.Success message) { ActiveViewModel = _plannedAction == LaunchAction.Install ? (PropertyChangedBase)_screens.OfType <InstallSuccessViewModel>().First() : (PropertyChangedBase)_screens.OfType <UninstallSuccessViewModel>().First(); NotifyStateChanged(); }
public void Handle(DirectorySearchMessages.DotaDirectoryFound message) { _dotaDirectoryKnown = true; _ba.Engine.StringVariables["DotaConfigDir"] = message.Path; ActiveViewModel = _screens.OfType <DotaDetectedViewModel>().First(); NotifyStateChanged(); }
public void Downloading() { if (SelectedView is DownloadingViewModel) { return; } SelectedView = new DownloadingViewModel(GlobalVariables.Instance.Songs); }
public void Settings() { if (SelectedView is SettingsViewModel) { return; } SelectedView = new SettingsViewModel(); }
public void SongsList() { if (SelectedView is SongsListViewModel) { return; } SelectedView = new SongsListViewModel(GlobalVariables.Instance.Songs); }
public void AddLink() { if (SelectedView is AddLinkViewModel) { return; } SelectedView = new AddLinkViewModel(GlobalVariables.Instance.Songs); }
public static void QuietlyReload <T>(this PropertyChangedBase presenter, ref ICollectionView list, string propertyName) { var temp = list; list = new ListCollectionView(new List <T>()); presenter.NotifyOfPropertyChange(propertyName); list = temp; presenter.NotifyOfPropertyChange(propertyName); }
/// <summary> /// Backs this instance. /// </summary> public void Back() { if (ActiveChart is ColumnChartViewModel) { this._pieChart = this.GetPieChart(); this._pieChart.OnPieClick += this.PieChartViewModel_OnPieClick; this.ActiveChart = this._pieChart; } }
public static void QuietlyReload <T>(this PropertyChangedBase presenter, ref IEnumerable <T> list, string propertyName) { var temp = list; list = null; presenter.NotifyOfPropertyChange(propertyName); list = temp; presenter.NotifyOfPropertyChange(propertyName); }
public static void QuietlyReload(this PropertyChangedBase presenter, ref IList list, string propertyName) { var temp = list; list = new List <IEnumerable>(); presenter.NotifyOfPropertyChange(propertyName); list = temp; presenter.NotifyOfPropertyChange(propertyName); }
public ToolbarViewModel(RiseSectionData riseSectionData, EditorManager editorManager) { mEditorManager = editorManager; mEditorManager.PropertyChanged += EditorManagerPropertyChanged; CreatePropertiesViewModels(riseSectionData); EditorViewModel = new EditorViewModel(riseSectionData, editorManager); PropertiesViewModel = new NoSelectionPropertiesViewModel(); }
public static bool Set <T>(this PropertyChangedBase screen, ref T field, T value, [CallerMemberName] string propertyName = null) { if (EqualityComparer <T> .Default.Equals(field, value)) { return(false); } field = value; screen.NotifyOfPropertyChange(propertyName); return(true); }
public static bool SetValue <T>(this PropertyChangedBase viewModel, ref T field, T newValue, Expression <Func <T> > propertyExpression) { if (EqualityComparer <T> .Default.Equals(field, newValue)) { return(false); } field = newValue; viewModel.NotifyOfPropertyChange(propertyExpression); return(true); }
private void SelectPropertiesViewModel() { if (mEditorManager.SelectedPlatform != null) { PropertiesViewModel = mPropertiesViewModels[typeof(PlatformEditorViewModel)]; } else { PropertiesViewModel = mPropertiesViewModels[typeof(NoSelectionPropertiesViewModel)]; } }
public static bool SetValue <T>(this PropertyChangedBase viewModel, ref T field, T newValue, [CallerMemberName] string propertyName = null) { if (EqualityComparer <T> .Default.Equals(field, newValue)) { return(false); } field = newValue; viewModel.NotifyOfPropertyChange(propertyName); return(true); }
public static bool SetPropertyValue <T>(this PropertyChangedBase @base, ref T property, T value, [CallerMemberName] string propertyName = "") { if (Equals(property, value)) { return(false); } property = value; @base.NotifyOfPropertyChange(propertyName); return(true); }
public static bool Set <T>(this PropertyChangedBase propertyChangedBase, ref T oldValue, T newValue, [CallerMemberName] string propertyName = null) { if (Equals(oldValue, newValue)) { return(false); } oldValue = newValue; propertyChangedBase.NotifyOfPropertyChange(propertyName); return(true); }
/// <summary> /// Pies the chart view model on pie click. /// </summary> /// <param name="sender">The sender.</param> /// <param name="e">The e.</param> private void PieChartViewModel_OnPieClick(object sender, LiveCharts.ChartPoint e) { if (Enum.TryParse <CurrencyType>(e.SeriesView.Title, true, out var value)) { var trades = this._trades.Where(t => t.Price.CurrencyType == value); var chart = new ColumnChartViewModel(trades.Select(t => t.ItemName).ToArray()); chart.Add(e.SeriesView.Title, trades.Select(t => t.Price.NumberOfCurrencies)); this._columnChart = chart; this.ActiveChart = this._columnChart; this._pieChart.OnPieClick -= this.PieChartViewModel_OnPieClick; } }
public static void showVMDialog(PropertyChangedBase viewmodel, string windowHeader) { WindowManager windowManager = new WindowManager(); dynamic settings = new ExpandoObject(); settings.WindowStyle = WindowStyle.None; settings.ShowInTaskbar = true; settings.Title = windowHeader; settings.WindowState = WindowState.Normal; settings.ResizeMode = ResizeMode.CanMinimize; windowManager.ShowDialog(viewmodel, null, settings); }
/// <summary> /// Called when activating. /// </summary> protected override async void OnActivate() { using (var service = new DatabaseService()) { await service.CheckPledgeStatus(); this._trades = service.Get().Where(t => !t.IsOutgoing).ToArray(); } this._pieChart = this.GetPieChart(); this._pieChart.OnPieClick += this.PieChartViewModel_OnPieClick; this.ActiveChart = this._pieChart; base.OnActivate(); }
void OpenLicenseServerUnreachable(string license) { WindowContent = new LicenseServerUnreachableViewModel( context, () => { if (ConfirmUseBasicFeatures()) { LicenseSetBasicFeatures(); } }, () => LicenseVerify(license) ); DialogOpenIfNotOpenedYet(); }
public static bool SetPropertyChanged(this PropertyChangedBase obj , [System.Runtime.CompilerServices.CallerMemberName] string propertyName = "") { if (obj == null) { return(false); } if (obj.IsNotifying) { obj.NotifyOfPropertyChange(propertyName); } return(true); }
/// <summary> /// Show a pop-up window, can be a dialog, which once showed up does not allow interaction /// with the background window. It also can be an independent window, which does allow /// interaction with any other window of the application. /// </summary> /// <param name="viewModel">ViewModel to be shown in the pop-up window</param> /// <param name="windowHeader">Title of the window.</param> /// <param name="isDialog">Whether its a dialog or a window.</param> public static void ShowPopupWindow(PropertyChangedBase viewModel, string windowHeader, bool isDialog = true) { WindowManager windowManager = new WindowManager(); var settings = SetupPopupWindow(windowHeader); settings.WindowState = WindowState.Normal; settings.ResizeMode = ResizeMode.CanResize; settings.SizeToContent = SizeToContent.Manual; if (isDialog) { windowManager.ShowDialog(viewModel, null, settings); } else { windowManager.ShowWindow(viewModel, null, settings); } }
public void ShowWorldSettings() { RightPanel = new SimulationSettingsViewModel(this, WorldSettings); }
public void AddMenu(ToggleButtonMenuViewModel panel) { //AppModel.EventAggregator.Publish(new SoundPlayMessage(SoundPlayType.MenuSlideOut)); if (!Menus.Contains(panel)) { if (panel.MenuParent == MainMenu) { Menus.Apply(x => x.ControlIsVisible = false); Menus.Clear(); Menus.Add(panel); } else { BindableCollection<ToggleButtonMenuViewModel> newMenus = new BindableCollection<ToggleButtonMenuViewModel>(Menus); bool foundParent = false; foreach (ToggleButtonMenuViewModel menu in newMenus) { if ((foundParent |= menu == panel.MenuParent) && menu != panel.MenuParent) { menu.ControlIsVisible = false; Menus.Remove(menu); } } Menus.Add(panel); } panel.ControlIsVisible = true; foreach (OptionButtonViewModel button in panel.Buttons) { button.IsOptionChecked = false; } Popup = null; } }