public SettingsMenu() { InitializeComponent(); ISettingsMenuModel sm = new SettingsMenuModel(); vm = new SettingsMenuViewModel(sm); this.DataContext = vm; }
/// <summary> /// Instantiation of SettingsMenuViewModel /// </summary> public SettingsMenuViewModel() { s_Instance = this; Model = new SettingsMenuModel(); Events.SubscribeEvent("ThemeChanged", (Action)ThemeChanged); //Routing.EventManager.ThemeChangedEvent += ThemeChanged; PreviousTheme = MainWindowViewModel.GetInstance().ActiveTheme.Name; LoadColors(); //Events.OnAssembliesChanged += LoadAssemblies; Events.SubscribeEvent("OnAssembliesChanged", (Action)LoadAssemblies); LoadAssemblies(); }
/// <summary> /// Registers a <see cref="Action{T}"/> callback. /// </summary> /// <typeparam name="T"> /// The type of data that the <see cref="callback"/> takes as a parameter. /// </typeparam> /// <param name="title">The title for the settings.</param> /// <param name="callback"> /// A reference to a callback. /// </param> /// <param name="data"> /// The data that will be passed as a parameter when the <see cref="callback"/> is invoked. /// </param> public void Register <T>(string title, Action <T> callback, T data) { if (string.IsNullOrEmpty(title)) { throw new ArgumentNullException("title"); } if (callback == null) { throw new ArgumentNullException("callback"); } var modal = new SettingsMenuModel <T> { Title = title, Callback = callback, Data = data }; this.callbacks.Add(modal); }
/// <summary> /// Set the changed ItemSource to the SettingsMenu for use in the Ribbon tab /// </summary> private void UpdateRibbon() { SettingsMenuModel.SetRibbonItems(ItemSource); }