Exemple #1
0
        public CreateModsTabControl()
        {
            ViewModel = WpfFactory.CreateViewModel <CreateModsTabControlModel>();

            InitializeComponent();

            var projectsTab = WpfFactory.CreateControl <ProjectsTabControl>();

            projectsTab.HorizontalAlignment = System.Windows.HorizontalAlignment.Stretch;
            projectsTab.VerticalAlignment   = System.Windows.VerticalAlignment.Stretch;
            ProjectsTab.Content             = projectsTab;

            var guidsTab = WpfFactory.CreateControl <GuidsTabControl>();

            guidsTab.HorizontalAlignment = System.Windows.HorizontalAlignment.Stretch;
            guidsTab.VerticalAlignment   = System.Windows.VerticalAlignment.Stretch;
            GUIDsTab.Content             = guidsTab;

            this.WhenActivated(d => {
                TabSelector
                .Events()
                .SelectionChanged
                .Select(o => o.Source as TabControl)
                .WhereNotNull()
                .Select(tabSelector => tabSelector.SelectedIndex)
                .InvokeCommand(ViewModel.SetSelectedTabCommand);
            });
        }
        public ApplicationView()
        {
            ViewModel = WpfFactory.CreateViewModel <ApplicationViewModel>();

            InitializeComponent();

            var installModsTab = WpfFactory.CreateControl <InstallModsTabControl>();

            installModsTab.HorizontalAlignment = System.Windows.HorizontalAlignment.Stretch;
            installModsTab.VerticalAlignment   = System.Windows.VerticalAlignment.Stretch;
            InstallModsTab.Content             = installModsTab;

            var createModsTab = WpfFactory.CreateControl <CreateModsTabControl>();

            createModsTab.HorizontalAlignment = System.Windows.HorizontalAlignment.Stretch;
            createModsTab.VerticalAlignment   = System.Windows.VerticalAlignment.Stretch;
            CreateModsTab.Content             = createModsTab;

            var aboutTab = WpfFactory.CreateControl <AboutTabControl>();

            aboutTab.HorizontalAlignment = System.Windows.HorizontalAlignment.Stretch;
            aboutTab.VerticalAlignment   = System.Windows.VerticalAlignment.Stretch;
            AboutTab.Content             = aboutTab;

            this.WhenActivated((d) => {
                TabSelector
                .Events()
                .SelectionChanged
                .Select(o => o.Source as TabControl)
                .WhereNotNull()
                .Select(tabSelector => tabSelector.SelectedIndex)
                .InvokeCommand(ViewModel.SetSelectedTabCommand);

                ViewModel
                .ObservableForProperty(vm => vm.InInstallModsTab)
                .Select(o => o.GetValue())
                .Subscribe((inInstallTab) =>
                {
                    if (inInstallTab && !wasInInstallTab)
                    {
                        Height          = 720;
                        Width           = 1006;
                        ResizeMode      = System.Windows.ResizeMode.NoResize;
                        wasInInstallTab = true;
                    }
                    else
                    {
                        ResizeMode      = System.Windows.ResizeMode.CanResizeWithGrip;
                        wasInInstallTab = false;
                    }
                });
            });
        }