public Tuple<AdvancedTabControl, Window> CreateHost(AdvancedTabControl rpSourceTabControl, string rpSourcePartition)
        {
            var rWindow = new TabWindow() { Owner = App.Current.MainWindow };
            rWindow.TabControl.DataContext = rpSourceTabControl.DataContext;
            rWindow.TabControl.TabController = rpSourceTabControl.TabController;
            rWindow.DockableZone.DockingController = new TabDockingController();

            return Tuple.Create(rWindow.TabControl, (Window)rWindow);
        }
 public AdvancedTabControl CreateHost(AdvancedTabControl rpSourceTabControl, string rpSourcePartition)
 {
     return new AdvancedTabControl()
     {
         DataContext = rpSourceTabControl.DataContext,
         ItemTemplate = rpSourceTabControl.ItemTemplate,
         ContentTemplateSelector = rpSourceTabControl.ContentTemplateSelector,
         TabController = new TabController() { TearOffController = rpSourceTabControl.TabController.TearOffController, Partition = rpSourceTabControl.TabController.Partition },
     };
 }
 public AdvancedTabControl CreateHost(AdvancedTabControl rpSourceTabControl, string rpSourcePartition)
 {
     return(new AdvancedTabControl()
     {
         DataContext = rpSourceTabControl.DataContext,
         ItemTemplate = rpSourceTabControl.ItemTemplate,
         ContentTemplateSelector = rpSourceTabControl.ContentTemplateSelector,
         TabController = new TabController()
         {
             TearOffController = rpSourceTabControl.TabController.TearOffController, Partition = rpSourceTabControl.TabController.Partition
         },
     });
 }
        public Tuple <AdvancedTabControl, Window> CreateHost(AdvancedTabControl rpSourceTabControl, string rpSourcePartition)
        {
            var rWindow = new TabWindow()
            {
                Owner = App.Current.MainWindow
            };

            rWindow.TabControl.DataContext         = rpSourceTabControl.DataContext;
            rWindow.TabControl.TabController       = rpSourceTabControl.TabController;
            rWindow.DockableZone.DockingController = new TabDockingController();

            return(Tuple.Create(rWindow.TabControl, (Window)rWindow));
        }
Пример #5
0
        private void DoUpdateSubscription()
        {
            _subscription?.Dispose();
            var api_to_subscribe = Settings.Values?.Where(s => !string.IsNullOrEmpty(s.Api) && s.IsEnabled);

            if (api_to_subscribe != null && api_to_subscribe.Count() == 0)
            {
                return;
            }
            _subscription = ApiService.Subscribe(api_to_subscribe.Select(s => s.Api).ToArray(), apiinfo =>
            {
                // Don't dispose return object of HwndSource.FromHwnd, or it will close target window.
                // Suppose IMainWindowService has registered. Maybe a null-test is needed.
                if (mainwindow == null)
                {
                    mainwindow = HwndSource.FromHwnd(ServiceManager.GetService <IMainWindowService>().Handle).RootVisual;
                }
                if (tabc == null)
                {
                    tabc = mainwindow?.Dispatcher.Invoke(() => FindChild <AdvancedTabControl>(mainwindow, null));
                }
                var setting = Settings.Values.Where(s => s.Api == apiinfo.Api).SingleOrDefault();
                if (setting == null)
                {
                    return;
                }
                else if (setting.SwitchBy == SwitchType.Index)
                {
                    int index = setting.Index;
                    tabc?.Dispatcher.BeginInvoke(new Action(() =>
                    {
                        tabc.SelectedIndex = index;
                    }));
                }
                else if (setting.SwitchBy == SwitchType.TabName)
                {
                    string name = setting.TabName;
                    tabc?.Dispatcher.BeginInvoke(new Action(() =>
                    {
                        int?index = tabc.ItemsSource.OfType <TabItemViewModel>().Select((vm, i) => new { ViewModel = vm, Index = i }).Where(p => p.ViewModel.Name == name).FirstOrDefault()?.Index;
                        if (index.HasValue)
                        {
                            tabc.SelectedIndex = index.Value;
                        }
                    }));
                }
            });
        }
 public TabEmptiedAction OnTabEmptied(AdvancedTabControl rpTabControl, Window rpWindow)
     => rpWindow == App.Current.MainWindow ? TabEmptiedAction.DoNothing : TabEmptiedAction.CloseWindow;
 public TabEmptiedAction OnTabEmptied(AdvancedTabControl rpTabControl, Window rpWindow)
 => rpWindow == App.Current.MainWindow ? TabEmptiedAction.DoNothing : TabEmptiedAction.CloseWindow;