public GitDataService() { // Because our event's payloads are not strongly typed, paranoid usage is the only way to properly consume them // For strongly typed payloads - see Prism's EventAggregator // I do want strongly typed payloads, but to have it, I would have had to re-implement // Prism's EventAggregator, which I could do but is beyond the scope of this project _mediator.Subscribe <RepositoryTypeSelectedInEditEvent>(arg => { Repository.RepositoryType type; if (arg != null && Enum.TryParse(arg.ToString(), out type) && type == Repository.RepositoryType.Git) { _dispatcherService.InvokeAsync(() => { var detailsView = ViewLocator.GetSharedInstance <IGitRepositoryDetailsView>(); _mediator.NotifyColleaguesAsync <ShowRepositoryDetailsInEditorEvent>(detailsView); }); } }); }
public ShellViewModel() { if (!Directory.Exists(ApplicationSettings.Instance.DiffDirectory)) { Directory.CreateDirectory(ApplicationSettings.Instance.DiffDirectory); } var files = Directory.GetFiles(ApplicationSettings.Instance.DiffDirectory).ToList(); files.ForEach(File.Delete); MenuView = ViewLocator.GetSharedInstance <IMenuView>(); MainView = ViewLocator.GetSharedInstance <IRevisionHistoryView>(); RepositoriesView = ViewLocator.GetSharedInstance <IRepositoriesView>(); Container.RegisterInstance <ISourceControlController>(); ChildWindowState = WindowState.Closed; Mediator.Subscribe <BeginBusyEvent>(text => { IsBusy = true; IsBusyText = (text ?? "").ToString(); }); Mediator.Subscribe <EndBusyEvent>(text => IsBusy = false); var showChildWindow = new Action <object>(repo => { UiDispatcherService.InvokeAsync(() => { ChildWindowContent = ViewLocator.GetSharedInstance <IRepositoryEditorView>(); ChildWindowState = WindowState.Open; }); }); Mediator.Subscribe <EditRepositoryEvent>(showChildWindow); Mediator.Subscribe <AddRepositoryEvent>(showChildWindow); Mediator.Subscribe <HideChildWindowEvent>(ignore => ChildWindowState = WindowState.Closed); }
public ShellViewModel() { SubscribeToSwitchViewEvent(); CurrentView = ViewLocator.GetSharedInstance <IUglyDisplayView>(); }