示例#1
0
        public Application(SimpleContainer container)
        {
            _container = container;

            Initialize();

            ViewModelLocator.AddNamespaceMapping("Shell.Views", "Shared.ViewModels");
            ViewLocator.AddNamespaceMapping("Shared.ViewModels", "Shell.Views");

            MessageBinder.SpecialValues.Add("$tappedItem", GetTappedItem);

            container.Instance <FormsApplication>(this);

            container
            .Singleton <ITeamServicesClient, OfflineTeamServicesClient>()
            .Singleton <IAuthenticationService, AuthenticationService>()
            .Singleton <IApplicationNavigationService, ApplicationNavigationService>()
            .Singleton <IDialogService, ApplicationDialogService>();

            container
            .PerRequest <RootViewModel>()
            .PerRequest <ShellViewModel>()
            .PerRequest <LoginViewModel>()
            .PerRequest <LoginPopupViewModel>()
            .PerRequest <MainViewModel>()
            .PerRequest <LoginOldViewModel>()
            .PerRequest <ProjectsViewModel>()
            .PerRequest <BuildsViewModel>();

            DisplayRootView <RootView>();
        }
示例#2
0
        protected override void OnStartup(object sender, StartupEventArgs e)
        {
            // Set custom namespace mappings.
            ViewLocator.AddNamespaceMapping("Jarvis.ViewModels.Settings", "Jarvis.Views.Settings");

            // Initialize everything that needs to.
            var initializables = IoC.GetAll <IInitializable>();

            foreach (var initializable in initializables)
            {
                initializable.Initialize();
            }

            // Show the root view.
            var windowSettings = new Dictionary <string, object> {
                { "Visibility", Visibility.Hidden }
            };

            DisplayRootViewFor <ShellViewModel>(windowSettings);
            Application?.MainWindow?.Hide();

            // Create the taskbar icon.
            _taskbarIcon = IoC.Get <JarvisTaskbarIcon>();

            // Start all background services.
            IoC.Get <ServiceOrchestrator>().Start();

            // Register the hotkey.
            var service = IoC.Get <ApplicationService>();

            _hotKey = new KeyboardHook(() => service.Toggle());
        }
示例#3
0
        public Application(SimpleContainer container)
        {
            this.container = container;

            ConventionManager.AddElementConvention <SearchBar>(SearchBar.TextProperty, "Text", "SearchButtonPressed");

            ViewModelLocator.AddNamespaceMapping("Hubb.Forms.Core.Views", "Hubb.Core.ViewModels");
            ViewLocator.AddNamespaceMapping("Hubb.Core.ViewModels", "Hubb.Forms.Core.Views");

            Initialize();

            container
            .Instance <IGitHubClient>(new GitHubClient(new ProductHeaderValue("hubb-forms", "1.0.0")));

            container
            .Singleton <IAuthenticationService, AuthenticationService>()
            .Singleton <IRepositoryService, RepositoryService>()
            .Singleton <IAppNavigationService, AppNavigationService>();

            container
            .PerRequest <LoginViewModel>()
            .PerRequest <RepositorySearchViewModel>();

            DisplayRootView <LoginView>();
        }
示例#4
0
        static void AddCustomConventions()
        {
            ViewModelLocator.AddNamespaceMapping("TivoAhoy.Phone.Views", "TivoAhoy.Common.ViewModels", "View");
            ViewModelLocator.AddNamespaceMapping("TivoAhoy.Phone.Views", "TivoAhoy.Common.ViewModels", "Page");
            ViewLocator.AddNamespaceMapping("TivoAhoy.Common.ViewModels", "TivoAhoy.Phone.Views", "View");
            ViewLocator.AddNamespaceMapping("TivoAhoy.Common.ViewModels", "TivoAhoy.Phone.Views", "Page");

            ConventionManager.AddElementConvention <PerformanceProgressBar>(PerformanceProgressBar.IsIndeterminateProperty, "IsIndeterminate", "Loaded");

            ConventionManager.AddElementConvention <Pivot>(Pivot.ItemsSourceProperty, "SelectedItem", "SelectionChanged").ApplyBinding =
                (viewModelType, path, property, element, convention) =>
            {
                if (ConventionManager
                    .GetElementConvention(typeof(ItemsControl))
                    .ApplyBinding(viewModelType, path, property, element, convention))
                {
                    ConventionManager
                    .ConfigureSelectedItem(element, Pivot.SelectedItemProperty, viewModelType, path);
                    ConventionManager
                    .ApplyHeaderTemplate(element, Pivot.HeaderTemplateProperty, null, viewModelType);
                    return(true);
                }

                return(false);
            };

            ConventionManager.AddElementConvention <Panorama>(Panorama.ItemsSourceProperty, "SelectedItem", "SelectionChanged").ApplyBinding =
                (viewModelType, path, property, element, convention) =>
            {
                if (ConventionManager
                    .GetElementConvention(typeof(ItemsControl))
                    .ApplyBinding(viewModelType, path, property, element, convention))
                {
                    ConventionManager
                    .ConfigureSelectedItem(element, Panorama.SelectedItemProperty, viewModelType, path);
                    ConventionManager
                    .ApplyHeaderTemplate(element, Panorama.HeaderTemplateProperty, null, viewModelType);
                    return(true);
                }

                return(false);
            };

            ConventionManager.AddElementConvention <ListPicker>(ListPicker.ItemsSourceProperty, "SelectedItem", "SelectionChanged")
            .ApplyBinding =
                (viewModelType, path, property, element, convention) =>
            {
                if (ConventionManager.GetElementConvention(typeof(ItemsControl))
                    .ApplyBinding(viewModelType, path, property, element, convention))
                {
                    ConventionManager
                    .ConfigureSelectedItem(element, ListPicker.SelectedItemProperty, viewModelType, path);
                    //ConventionManager
                    //    .ApplyHeaderTemplate(element, ListPicker.HeaderTemplateProperty, null, viewModelType);
                    return(true);
                }

                return(false);
            };
        }
示例#5
0
        protected override void Configure()
        {
            ViewModelLocator.AddNamespaceMapping("Hubb.App.UWP.Views", "Hubb.Core.ViewModels");
            ViewLocator.AddNamespaceMapping("Hubb.Core.ViewModels", "Hubb.App.UWP.Views");

            container = new WinRTContainer();
            container.RegisterWinRTServices();

            container.Instance <IGitHubClient>(new GitHubClient(new ProductHeaderValue("hubb-uwp", "1.0.0")));

            container
            .Singleton <IAppNavigationService, AppNavigationService>()
            .Singleton <IAuthenticationService, AuthenticationService>()
            .Singleton <IRepositoryService, RepositoryService>();

            container
            .PerRequest <LoginViewModel>()
            .PerRequest <RepositorySearchViewModel>();

            Coroutine.Completed += (s, e) =>
            {
                if (e.Error == null)
                {
                    return;
                }

                Debug.Write(e.Error.Message);
            };

            ConventionManager.AddElementConvention <AutoSuggestBox>(AutoSuggestBox.TextProperty, "Text", "QuerySubmitted");
        }
示例#6
0
        public Application(SimpleContainer container)
        {
            this.container = container;

            Initialize();

            ViewModelLocator.AddNamespaceMapping("NDC.Build.Forms.Core.Views", "NDC.Build.Core.ViewModels");
            ViewLocator.AddNamespaceMapping("NDC.Build.Core.ViewModels", "NDC.Build.Forms.Core.Views");

            MessageBinder.SpecialValues.Add("$tappedItem", GetTappedItem);

            container.Instance <FormsApplication>(this);

            container
            .Singleton <ITeamServicesClient, OfflineTeamServicesClient>()
            .Singleton <IAuthenticationService, OfflineAuthenticationService>()
            .Singleton <IApplicationNavigationService, ApplicationNavigationService>()
            .Singleton <IDialogService, ActionSheetDialogService>();

            container
            .PerRequest <LoginViewModel>()
            .PerRequest <ProjectsViewModel>()
            .PerRequest <BuildsViewModel>();

            DisplayRootView <LoginView>();
        }
示例#7
0
        public SettingsViewModel()
        {
            ViewLocator.AddNamespaceMapping(typeof(SettingsViewModel).Namespace, typeof(SettingsView).Namespace);

            CancelCommand = new RelayCommand(_ => TryClose(false));
            OkCommand     = new RelayCommand(SaveChanges);

            DisplayName = GeminiResources.SettingsDisplayName;
        }
示例#8
0
        public OutputViewModel()
        {
            ViewLocator.AddNamespaceMapping(typeof(OutputViewModel).Namespace, typeof(OutputView).Namespace);
            DisplayName   = Resources.FactorioLogOutputTitle;
            StringBuilder = new StringBuilder();
            Writer        = new OutputWriter(this);

            LogWatcher = new LogWatcher(this, new FactorioLogFile().Path);
        }
示例#9
0
        public EnumEditorViewModel()
        {
            ViewLocator.AddNamespaceMapping(typeof(EnumEditorViewModel <TEnum>).Namespace, typeof(EnumEditorView).Namespace);

            _items = Enum.GetValues(typeof(TEnum)).Cast <TEnum>().Select(x => new EnumValueViewModel <TEnum>
            {
                Value = x,
                Text  = x.GetDescription()
            }).ToList();
        }
示例#10
0
        private void OnSettingsLoaded()
        {
            //ViewLocator.NameTransformer.AddRule(@"ViewModel", @"ViewX");
            ViewLocator.AddNamespaceMapping("Cockpit.Core.Plugins.Plugins.Properties", "Cockpit.General.Properties.Views");
            DisplayRootViewFor <TrayIconViewModel>();

            //Dictionary<string, object> window_settings = new Dictionary<string, object>();
            //window_settings.Add("Assemblies", ass);
            DisplayRootViewFor <MainShellViewModel>(/*window_settings*/);
        }
示例#11
0
        protected override void Configure()
        {
            ViewModelLocator.AddNamespaceMapping("Hubb.App.UWP.Views", "Hubb.Core.ViewModels");
            ViewLocator.AddNamespaceMapping("Hubb.Core.ViewModels", "Hubb.App.UWP.Views");

            MessageBinder.SpecialValues.Add("$clickedItem", c => ((ItemClickEventArgs)c.EventArgs).ClickedItem);

            container = new WinRTContainer();

            container.RegisterWinRTServices();

            container.Instance <IGitHubClient>(new GitHubClient(new ProductHeaderValue("Hubb", "0.0.1")));
            container.Singleton <IHubbClient, OfflineHubbClient>();
            container.PerRequest <ShellViewModel>();
        }
示例#12
0
        private static void RegisterConventions()
        {
            // Add FBReader.AppServices dll to Caliburn assembly list
            AssemblySource.Instance.Add(typeof(MainPageViewModel).Assembly);

            MessageBinder.CustomConverters.Add(
                typeof(int?),
                (val, ctx) =>
            {
                if (val == null)
                {
                    return(null);
                }
                return(Convert.ToInt32(val));
            });

            AddGenericItemsControlConvention <Pivot>(
                () => Pivot.HeaderTemplateProperty,
                () => Pivot.SelectedItemProperty);

            ViewModelLocator.AddNamespaceMapping("FBReader.App.Views.Pages", "FBReader.AppServices.ViewModels.Pages", "Page");
            ViewLocator.AddNamespaceMapping("FBReader.AppServices.ViewModels.Pages", "FBReader.App.Views.Pages", "Page");

            ViewModelLocator.AddNamespaceMapping("FBReader.App.Views.Pages.Settings", "FBReader.AppServices.ViewModels.Pages.Settings", "");
            ViewLocator.AddNamespaceMapping("FBReader.AppServices.ViewModels.Pages.Settings", "FBReader.App.Views.Pages.Settings", "");

            ViewModelLocator.AddNamespaceMapping("FBReader.App.Views.Pages.Settings", "FBReader.AppServices.ViewModels.Pages.Settings", "View");
            ViewLocator.AddNamespaceMapping("FBReader.AppServices.ViewModels.Pages.Settings", "FBReader.App.Views.Pages.Settings", "View");

            ViewModelLocator.AddNamespaceMapping("FBReader.App.Views.Pages.Settings", "FBReader.AppServices.ViewModels.Pages.Settings", "Page");
            ViewLocator.AddNamespaceMapping("FBReader.AppServices.ViewModels.Pages.Settings", "FBReader.App.Views.Pages.Settings", "Page");

            ViewModelLocator.AddNamespaceMapping("FBReader.App.Views.Pages.MainHub", "FBReader.AppServices.ViewModels.Pages.MainHub");
            ViewLocator.AddNamespaceMapping("FBReader.AppServices.ViewModels.Pages.MainHub", "FBReader.App.Views.Pages.MainHub");

            ViewModelLocator.AddNamespaceMapping("FBReader.App.Views.Pages.Bookmarks", "FBReader.AppServices.ViewModels.Pages.Bookmarks", "");
            ViewLocator.AddNamespaceMapping("FBReader.AppServices.ViewModels.Pages.Bookmarks", "FBReader.App.Views.Pages.Bookmarks", "");

            ViewModelLocator.AddNamespaceMapping("FBReader.App.Views.Pages.Bookmarks", "FBReader.AppServices.ViewModels.Pages.Bookmarks", "View");
            ViewLocator.AddNamespaceMapping("FBReader.AppServices.ViewModels.Pages.Bookmarks", "FBReader.App.Views.Pages.Bookmarks", "View");

            ViewModelLocator.AddNamespaceMapping("FBReader.App.Views.Pages.Catalogs", "FBReader.AppServices.ViewModels.Pages.Catalogs", "");
            ViewLocator.AddNamespaceMapping("FBReader.AppServices.ViewModels.Pages.Catalogs", "FBReader.App.Views.Pages.Catalogs", "");
        }
示例#13
0
        /// <summary>
        /// Configures the bindings
        /// </summary>
        protected override void Configure()
        {
            ViewLocator.AddNamespaceMapping("CoreNgine.Models", "RcktMon.Views");
            ViewLocator.NameTransformer.AddRule("IMainModel", "MainViewModel");

            _container.Configure(services =>
            {
                services.AddSingleton <IWindowManager, AppWindowManager>();
                services.AddSingleton <IMainModel, MainViewModel>();
                services.AddSingleton <ISettingsProvider, SettingsModel>();
                services.AddSingleton <IUSADataManager, USADataManager>();
                services.AddSingleton <StatusViewModel>();
                services.AddSingleton <ArbitrageMonitoringStrategy>();
                services.AddSingleton <AutoUpdate>();
                services.AddLogging(lb =>
                {
                    lb.AddNLog("NLog.config");
                });
            });
        }
示例#14
0
        protected override void Configure()
        {
            ViewModelLocator.AddNamespaceMapping("Spending.App.Windows.Views", "Spending.Core.ViewModels");
            ViewLocator.AddNamespaceMapping("Spending.Core.ViewModels", "Spending.App.Windows.Views");

            container = new WinRTContainer();
            container.RegisterWinRTServices();

            container
            .Instance <IMobileServiceClient>(new MobileServiceClient("https://spending.azurewebsites.net"));

            container
            .Singleton <IAuthenticationService, AuthenticationService>()
            .Singleton <IApplicationNavigationService, ApplicationNavigationService>()
            .Singleton <IExpenseService, ExpenseService>()
            .Singleton <INotificationsService, NotificationsService>();

            container
            .PerRequest <LoginViewModel>()
            .PerRequest <CurrentExpensesViewModel>()
            .PerRequest <AddExpenseViewModel>();
        }
示例#15
0
        protected override void Configure()
        {
            ConfigureTitleBar();

            ViewModelLocator.AddNamespaceMapping("Demo.App.Views", "Demo.Core.ViewModels");
            ViewLocator.AddNamespaceMapping("Demo.Core.ViewModels", "Demo.App.Views");

            container = new WinRTContainer();
            container.RegisterWinRTServices();

            container.Singleton <ISettingsService, StorageSettingsService>();
            container.Singleton <IRepositoryService, RepositoryService>();
            container.Singleton <IIssuesService, IssuesService>();

            container.Instance(CreateClient());

            container
            .ViewModel <ShellViewModel>()
            .ViewModel <MenuViewModel>()
            .ViewModel <RepositoryDetailsViewModel>()
            .ViewModel <IssuesListViewModel>();
        }
示例#16
0
        protected override void Configure()
        {
            ViewModelLocator.AddNamespaceMapping("NDC.Build.App.UWP.Views", "NDC.Build.Core.ViewModels");
            ViewLocator.AddNamespaceMapping("NDC.Build.Core.ViewModels", "NDC.Build.App.UWP.Views");

            MessageBinder.SpecialValues.Add("$clickedItem", c => ((ItemClickEventArgs)c.EventArgs).ClickedItem);

            container = new WinRTContainer();

            container.RegisterWinRTServices();

            container
            .Singleton <ITeamServicesClient, OfflineTeamServicesClient>()
            .Singleton <IAuthenticationService, OfflineAuthenticationService>()
            .Singleton <IApplicationNavigationService, ApplicationNavigationService>()
            .Singleton <ICredentialsService, SettingsCredentialsService>()
            .Singleton <IDialogService, ContentDialogService>();

            container
            .PerRequest <LoginViewModel>()
            .PerRequest <ProjectsViewModel>()
            .PerRequest <BuildsViewModel>();
        }
示例#17
0
        /// <summary>
        /// Configure the container.
        /// </summary>
        protected override void Configure()
        {
            base.Configure();

            if (!Execute.InDesignMode)
            {
                KernelConfigurator.Configure(_kernel, _catalog.Modules);

#pragma warning disable S2696
                LogManager.GetLog = type => _kernel.Get <IUILogService>(new ConstructorArgument("type", type));
#pragma warning restore S2696
            }

            ViewLocator.AddNamespaceMapping("*", "Logikfabrik.Overseer.WPF.Client.Views");

            _catalog = null;

            LanguageConfigurator.Configure(_kernel.Get <IAppSettingsFactory>());
            DataBindingLanguageConfigurator.Configure();
            DataBindingActionConfigurator.Configure();
            ConventionConfigurator.Configure();
            ErrorLogHandlerConfigurator.Configure(_kernel.Get <AppDomain>(), _kernel.Get <IApp>(), _kernel.Get <ILogService>());
            BuildNotificationConfigurator.Configure(_kernel.Get <IBuildTracker>(), _kernel.Get <IBuildNotificationManager>());
        }
示例#18
0
 static void SetupViewNamespaces()
 {
     ViewLocator.AddNamespaceMapping("CCC.TestApp.UI.Desktop.ViewModels", "CCC.TestApp.UI.Desktop.WPF.Views");
     ViewLocator.AddNamespaceMapping("CCC.TestApp.UI.Desktop.ViewModels.Users",
                                     "CCC.TestApp.UI.Desktop.WPF.Views.Users");
 }
示例#19
0
 static ShellViewModel()
 {
     ViewLocator.AddNamespaceMapping(typeof(ShellViewModel).Namespace, typeof(ShellView).Namespace);
 }
示例#20
0
 static DockingMainWindowViewModel()
 {
     ViewLocator.AddNamespaceMapping(typeof(DockingMainWindowViewModel).Namespace,
                                     typeof(DockingMainWindowView).Namespace);
 }
示例#21
0
 static DockingHostViewModel()
 {
     ViewLocator.AddNamespaceMapping(typeof(DockingHostViewModel).Namespace,
                                     typeof(DockingHostView).Namespace);
 }
 protected override void Configure()
 {
     ViewLocator.AddNamespaceMapping("Scenario.Functional.Core.ViewModels", "Scenario.Functional.App.Views");
 }
示例#23
0
 protected override void Configure()
 {
     base.Configure();
     ViewLocator.AddNamespaceMapping($"{typeof(MainViewModel).GetTypeInfo().Assembly.GetAssemblyName()}.ViewModels", $"{typeof(MainView).GetTypeInfo().Assembly.GetAssemblyName()}.Views");
 }
示例#24
0
 public OutputViewModel()
 {
     ViewLocator.AddNamespaceMapping(typeof(OutputViewModel).Namespace, typeof(OutputView).Namespace);
     StringBuilder = new StringBuilder();
     Writer        = new OutputWriter(this);
 }
示例#25
0
 public Bootstrapper()
 {
     ViewLocator.AddNamespaceMapping("Kebler.ViewModels", new[] { "Kebler.Views", "Kebler.UI.Dialogs" });
     Initialize();
 }