/// <summary> /// Performs the RefreshAssemblies command. /// </summary> /// <param name="parameter">The RefreshAssemblies command parameter.</param> private void DoRefreshAssembliesCommand(object parameter) { // Clear the assemblies. Assemblies.Clear(); // Set the status text. RefreshAssembliesCommand.ReportProgress( () => { StatusInfo = Resources.Msg_RefreshAssemblies_Progress; }); // Start the enumeration. var timeTaken = ApexBroker.GetModel <IGACManagerModel>().EnumerateAssemblies( assemblyDetails => { // Create an assembly view model from the detials. var viewModel = new GACAssemblyViewModel(); viewModel.FromModel(assemblyDetails); // Add it to the collection. Assemblies.Add(viewModel); }); // Set the resulting status info. RefreshAssembliesCommand.ReportProgress( () => { AssembliesCollectionView = new ListCollectionView(Assemblies.ToList()); AssembliesCollectionView.SortDescriptions.Add(new SortDescription("DisplayName", ListSortDirection.Ascending)); AssembliesCollectionView.Filter += Filter; StatusInfo = string.Format(Resources.Msg_RefreshAssemblies_Success, Assemblies.Count, timeTaken.TotalMilliseconds); }); }
protected override void OnExit(ExitEventArgs e) { // Save the last run time. ApexBroker.GetModel <IAppModel>().SaveLastRunTime(DateTime.Now); base.OnExit(e); }
/// <summary> /// Initializes a new instance of the <see cref="TheModelViewModel"/> class. /// </summary> public TheModelViewModel() { Title = "The Model"; // Get the Zune Model. var zuneModel = ApexBroker.GetModel <IZuneModel>(); // Get the albums. var albums = zuneModel.GetAlbums(); }
/// <summary> /// Initializes a new instance of the <see cref="MainViewModel"/> class. /// </summary> public MainViewModel() { // Wire up commands. CloseCommand = new Command(DoCloseCommand); // Get the last run time from the model - as long as we're not in the designer. if (Apex.Design.DesignTime.IsDesignTime) { Title += " (Design Time)"; } else { LastRunTime = ApexBroker.GetModel <IAppModel>().LoadLastRunTime(); } }
/// <summary> /// Initializes a new instance of the <see cref="MusicViewModel"/> class. /// </summary> public MusicViewModel() { Title = "Music"; if (ApexBroker.CurrentExecutionContext == ExecutionContext.Design) { // Add some design-time data. artists.Add("The Beatles"); artists.Add("Pink Floyd"); } else { // Get the artists from the model. var zuneModel = ApexBroker.GetModel <ItscuiModel>(); foreach (var artist in zuneModel.GetArtists()) { artists.Add(artist); } } }