Esempio n. 1
0
 public TabControlWindow(ITabControlAppParms parms, ITabCreationViewModel mainViewModel)
 {
     m_Parms         = parms;
     m_MainViewModel = mainViewModel;
     Instance        = this;
     Loaded         += BaseMainWindow_Loaded;
 }
Esempio n. 2
0
        public static void Init(Application app, ITabControlAppParms parms, TabControlWindow window)
        {
            foreach (var rd in parms.ResourceDictionaries)
            {
                app.Resources.MergedDictionaries.Add(new ResourceDictionary {
                    Source = new Uri(rd, UriKind.Relative)
                });
            }
            foreach (var r in parms.Resources)
            {
                var ctor = r.Value.GetConstructor(Type.EmptyTypes);
                var obj  = ctor?.Invoke(new object[0]);
                app.Resources.Add(r.Key, obj);
            }
            var menuDic = new ResourceDictionary();

            foreach (var cat in parms.Categories)
            {
                DataTemplate template = new DataTemplate
                {
                    DataType   = cat.MenuViewModelType,
                    VisualTree = new FrameworkElementFactory(cat.MenuViewType)
                };
                menuDic.Add(new DataTemplateKey(cat.MenuViewModelType), template);
            }
            app.Resources.MergedDictionaries.Add(menuDic);
            var mainTabsDic = new ResourceDictionary();

            foreach (var mtv in parms.MainTabViews)
            {
                DataTemplate template = new DataTemplate
                {
                    DataType   = mtv.Key,
                    VisualTree = new FrameworkElementFactory(mtv.Value)
                };
                mainTabsDic.Add(new DataTemplateKey(mtv.Key), template);
            }
            app.Resources.MergedDictionaries.Add(mainTabsDic);
            var imagesDic = new ResourceDictionary();

            foreach (var img in parms.Images)
            {
                imagesDic.Add(img.Key, new BitmapImage(new Uri("pack://application:,,/" + img.Value)));
            }
            app.Resources.MergedDictionaries.Add(imagesDic);
            window.Init();
            app.MainWindow = window;
            app.MainWindow?.Show();
        }
        public MultiCategoriesNewTabViewModel(ITabControlAppParms parms, ITabFactoryService tabFactoryService)
        {
            m_Parms             = parms;
            m_TabFactoryService = tabFactoryService;
            Init();

            AddAllSections();
            AddAllHeaderActions();
            AddAllFooterActions();

            if (Sections.Any())
            {
                Sections.First().IsExpanded = true;
            }
        }
Esempio n. 4
0
 public TabControlWindowViewModel(ITabControlAppParms parms, ITabFactoryService tabFactory) : base(tabFactory)
 {
     m_Parms            = parms;
     m_TabFactory       = tabFactory;
     AppWindow.Instance = this;
 }
 public TabControlWindowRegistrant(ITabControlAppParms parms)
 {
     RegisterInstance(parms);
 }