Ejemplo n.º 1
0
        public override void Load(Call call, TabModel model)
        {
            TaskInstance = new TaskInstance();
            TaskInstance.Log.Add("Double Tag Test", new Tag("Double", 0.5));

            _sampleCall = new Call(Label);
            _counter    = 0;

            model.Items = new List <ListItem>()
            {
                new("Task Instance Log", TaskInstance.Log),
                new("Sample Call", _sampleCall),
                new("Sample Call Log", _sampleCall.Log),
                new("Log Entry", new LogEntry(null, LogLevel.Info, "test", null)),
            };

            model.Actions = new List <TaskCreator>()
            {
                new TaskAction("Add 1 Entry", () => AddEntries(1)),
                new TaskAction("Add 10 Entries", () => AddEntries(10)),
                new TaskAction("Add 100 Entries", () => AddEntries(100)),
                new TaskAction("Add 1,000 Entries", () => AddEntries(1000)),
                new TaskAction("Add 10,000 Entries", () => AddEntries(10000)),
                new TaskDelegate("Reset", Reset),
                // Tests different threading contexts
                new TaskAction("System.Timer: Log 1 Entry / second", () => StartSystemTimer()),
                //new TaskAction("Threading.Timer: Log 1 Entry / second", () => StartThreadTimer()),
                new TaskDelegate("Task Delegate Thread:  Log 1 Entry / second", SubTaskInstances, true),
            };
            //actions.Add(new TaskAction("Add Child Entry", () => AddChildEntry()));
        }
Ejemplo n.º 2
0
 public void CopyTab()
 {
     try
     {
         var model = new TabModel
         {
             Name        = Name,
             FilterQuery = Model.FilterQuery != null
                 ? QueryCompiler.Compile(Model.FilterQuery.ToQuery())
                 : null,
             RawQueryString    = Model.RawQueryString,
             BindingHashtags   = Model.BindingHashtags.ToArray(),
             NotifyNewArrivals = Model.NotifyNewArrivals,
             ShowUnreadCounts  = Model.ShowUnreadCounts,
             NotifySoundSource = Model.NotifySoundSource
         };
         Model.BindingAccounts.ForEach(id => model.BindingAccounts.Add(id));
         Parent.Model.CreateTab(model);
     }
     catch (FilterQueryException fqex)
     {
         BackstageModel.RegisterEvent(
             new OperationFailedEvent(QueryCompilerResources.QueryCompileFailed, fqex));
     }
 }
Ejemplo n.º 3
0
 public override void Load(Call call, TabModel model)
 {
     model.Items = new ItemCollection <ListItem>()
     {
         new("File Browser", new TabFileBrowser()),
     };
 }
Ejemplo n.º 4
0
        public override void Load(Call call, TabModel model)
        {
            _series = new List <ItemCollection <int> >();
            //model.Items = items;

            model.Actions = new List <TaskCreator>()
            {
                new TaskDelegate("Add Entry", AddEntry),
                new TaskDelegate("Start: 1 Entry / second", StartTask, true),
            };

            var chartSettings = new ChartSettings();

            for (int i = 0; i < 2; i++)
            {
                var list = new ItemCollection <int>();
                chartSettings.AddList("Series " + i, list);
                _series.Add(list);
            }

            for (int i = 0; i < 10; i++)
            {
                AddSample();
            }
            model.AddObject(chartSettings);
        }
Ejemplo n.º 5
0
        public override void Load(Call call, TabModel model)
        {
            if (!Directory.Exists(Tab.Path))
            {
                return;
            }

            model.Actions = new List <TaskCreator>()
            {
                new TaskDelegate("Delete", Delete, true),
            };


            var directories = new ItemCollection <DirectoryView>();

            foreach (string directoryPath in Directory.EnumerateDirectories(Tab.Path))
            {
                var listDirectory = new DirectoryView(directoryPath);
                directories.Add(listDirectory);
            }
            model.ItemList.Add(directories);

            var files = new ItemCollection <FileView>();

            foreach (string filePath in Directory.EnumerateFiles(Tab.Path))
            {
                var listFile = new FileView(filePath);
                files.Add(listFile);
            }
            if (files.Count > 0)
            {
                model.ItemList.Add(files);
            }
        }
Ejemplo n.º 6
0
        /// <summary>
        /// Gives focus to the specified <see cref="TabModel"/>, if possible.
        /// </summary>
        /// <param name="tab">The <see cref="TabModel"/> to show.</param>
        /// <returns>true if the tab was focused, otherwise false.</returns>
        public static bool ShowTab(TabModel tab)
        {
            if (tab?.Parent == null)
            {
                return(false);
            }

            var well = tab.Parent as TabWellModelBase;

            if (well != null)
            {
                var currentIndex = well.Children.IndexOf(tab);
                if (currentIndex > 0)
                {
                    well.Children.Move(currentIndex, 0);
                }

                well.SelectedItem = tab;
                well.IsActive     = true;

                return(true);
            }

            var container = tab.Parent as DockContainerModel;

            if (container != null)
            {
                container.SelectedDockItem = tab;
                tab.IsActive = true;

                return(true);
            }

            return(false);
        }
Ejemplo n.º 7
0
        public void AddItem(TabModel item, ModelBase target, Dock dock)
        {
            if (item == null)
            {
                throw new ArgumentNullException(nameof(item));
            }

            var group = new ToolWellModel()
            {
                Width = item.Width, Height = item.Height
            };

            group.Children.Add(item);

            var container = new SplitViewModel(dock, group);

            if (target == null)
            {
                target  = Content;
                Content = container;
            }
            else if (target.ParentModel != null)
            {
                target.ParentModel.Replace(target, container);
            }
            else
            {
                System.Diagnostics.Debugger.Break();
                throw new InvalidOperationException();
            }

            container.Add(target);
        }
Ejemplo n.º 8
0
 private void CloseTabExecuted(TabModel item)
 {
     LeftDockItems.Remove(SelectedDockItem);
     TopDockItems.Remove(SelectedDockItem);
     RightDockItems.Remove(SelectedDockItem);
     BottomDockItems.Remove(SelectedDockItem);
 }
Ejemplo n.º 9
0
        public override void Load(Call call, TabModel model)
        {
            _sampleItems = new ItemCollection <SampleItem>();
            AddItems(5);

            model.Items = new ItemCollection <ListItem>("Items")
            {
                new("Sample Items", _sampleItems),
                new("Collections", new TabTestGridCollectionSize()),
                new("Recursive Copy", new TabSample()),
            };

            model.Actions = new List <TaskCreator>()
            {
                new TaskDelegate("Sleep 10s", Sleep, true),
                new TaskAction("Add 5 Items", () => AddItems(5), false),                 // Foreground task so we can modify collection
            };

            model.Notes =
                @"
This is a sample tab that shows some of the different tab features

Actions
DataGrids
";
        }
Ejemplo n.º 10
0
        public TabModel ToTabModel()
        {
            FilterQuery filter;

            try
            {
                filter = QueryCompiler.Compile(Query);
            }
            catch (FilterQueryException ex)
            {
                BackstageModel.RegisterEvent(new QueryCorruptionEvent(Name, ex));
                filter = null;
            }
            var model = new TabModel
            {
                Name              = Name,
                FilterQuery       = filter,
                BindingHashtags   = this.BindingHashtags,
                NotifyNewArrivals = this.NotifyNewArrivals,
                NotifySoundSource = this.NotifySoundSource,
                ShowUnreadCounts  = this.ShowUnreadCounts
            };

            this.BindingAccountIds.ForEach(model.BindingAccounts.Add);
            return(model);
        }
Ejemplo n.º 11
0
        public TabViewModel(TabModel model)
        {
            Model = model;

            Applications = new ObservableCollection <ApplicationViewModel>();
            foreach (var application in model.Applications)
            {
                Applications.Add(new ApplicationViewModel(application));
            }
            Applications.CollectionChanged += OnApplicationsChanged;

            ApplicationsView = (ListCollectionView)CollectionViewSource.GetDefaultView(Applications);
            ApplicationsView.SortDescriptions.Add(new SortDescription("Title", ListSortDirection.Ascending));
            UpdateFilter(Configuration.ApplicationFilter);

            Messenger.Default.Register <SettingChangedMessage>(this, (message) =>
            {
                switch (message.Name)
                {
                case "ApplicationFilter":
                    UpdateFilter((ApplicationFilter)message.Value);
                    break;
                }
            });
        }
Ejemplo n.º 12
0
 public TabViewModel(WindowFrameTitle title, DataTemplate titleTemplate, TabModel model)
 {
     Title                  = title;
     TitleTemplate          = titleTemplate;
     Model                  = model;
     Model.PropertyChanged += OnModelPropertyChanged;
 }
Ejemplo n.º 13
0
        public override void Load(Call call, TabModel model)
        {
            model.Items = new List <ListItem>()
            {
                new("Sample", new TabSample()),

                new("Objects", new TabTestObjects()),
                new("Data Grid", new TabTestDataGrid()),
                new("Params", new TabTestParams()),
                new("Log", new TabTestLog()),
                new("Actions", new TabActions()),
                new("Json", new TabTestJson()),
                new("Bookmarks", new TabTestBookmarks()),
                new("Skip", new TabTestSkip()),                 // move into new Lists?
                new("Exceptions", new TabTestExceptions()),

                new("Web Browser", new TabTestBrowser()),
                new("Text Editor", new TabTestTextEditor()),
                new("Chart", new TabTestChart()),
                new("Toolbar", new TabTestToolbar()),
                new("Serializer", new TabSerializer()),
                new("Process", new TabTestProcess()),
                new("Loading", new TabTestLoading()),
                new("Data Repos", new TabTestDataRepo()),
                new("Icons", new TabIcons()),
                new("Tools", new TabTools()),
            };
        }
Ejemplo n.º 14
0
 public TabViewModel(ColumnViewModel owner, TabModel tabModel)
 {
     _owner = owner;
     _model = tabModel;
     tabModel.Activate();
     CompositeDisposable.Add(
         Observable.FromEvent(
             _ => Model.Timeline.OnNewStatusArrived += _,
             _ => Model.Timeline.OnNewStatusArrived -= _)
                   .Subscribe(_ => UnreadCount++));
     CompositeDisposable.Add(
         Observable.FromEvent<ScrollLockStrategy>(
             handler => Setting.ScrollLockStrategy.OnValueChanged += handler,
             handler => Setting.ScrollLockStrategy.OnValueChanged -= handler)
                   .Subscribe(_ =>
                   {
                       RaisePropertyChanged(() => IsScrollLock);
                       RaisePropertyChanged(() => IsScrollLockExplicitEnabled);
                   }));
     CompositeDisposable.Add(() => Model.Deactivate());
     CompositeDisposable.Add(
         Observable.FromEvent(
         h => tabModel.OnBindingAccountIdsChanged += h,
         h => tabModel.OnBindingAccountIdsChanged -= h)
         .Subscribe(_ => DispatcherHolder.Enqueue(() => Timeline.ForEach(t => t.BindingAccounts = Model.BindingAccountIds))));
     IsLoading = true;
     Observable.Defer(
         () =>
         Observable.Start(() => Model.Timeline.ReadMore(null, true))
                   .Merge(Observable.Start(() => Model.ReceiveTimelines(null))))
               .SelectMany(_ => _)
               .Finally(() => IsLoading = false)
               .Subscribe();
 }
        public ProjectAdministrationModel(IAdministrationRemoteService adminService, ApplicationGlobalModel globalModel, [Named("WpfClientMapper")] IMapper mapper,
                                          IEventAggregator eventAggregator)
        {
            this.adminService     = adminService;
            this.globalModel      = globalModel;
            this.mapper           = mapper;
            this._eventAggregator = eventAggregator;

            TabModel = new TabModel()
            {
                Title      = Properties.Resources.AdministrationTab_Title_Project,
                CanClose   = false,
                IsModified = false
            };


            IsProjectSelected = false;

            AllCompanyUsers = new ObservableCollection <User>();
            ProjectUsers    = new ObservableCollection <ProjectUser>();

            AddUserToProjectCommand      = new AwaitableDelegateCommand(AddUserToProject, CanExecuteAddUserToProject);
            RemoveUserFromProjectCommand = new AwaitableDelegateCommand(RemoveUserFromProject, CanExecuteRemoveUserFromProject);
            InviteUserCommand            = new AwaitableDelegateCommand(InviteUser, CanExecuteInviteUser);
            CompanyAdminCheckCommand     = new AwaitableDelegateCommand(CompanyAdminCheck);
            ProjectSetAsAdminCommand     = new AwaitableDelegateCommand(SetAsAdmin, CanSetAsAdmin);
            InitializeCommand            = new AwaitableDelegateCommand(LoadProjects);

            ChangeNotification = new InteractionRequest <INotification>();
        }
Ejemplo n.º 16
0
 public override void Load(Call call, TabModel model)
 {
     model.Items = new ItemCollection <ListItem>()
     {
         new("Sample Text", LazyJsonNode.Parse(Json1)),
     };
 }
Ejemplo n.º 17
0
        private void StartTabConfigure(Tuple <TabModel, ISubject <Unit> > args)
        {
            // ensure close before starting configuration
            this.IsConfigurationActive = false;

            var model    = args.Item1;
            var callback = args.Item2;

            this._completeCallback           = callback;
            this._currentConfigurationTarget = model;
            this.IsConfigurationActive       = true;
            this._lastValidFilterQuery       = model.FilterQuery;
            this._initialNormalizedQuery     =
                _lastValidFilterQuery == null
                    ? String.Empty
                    : _lastValidFilterQuery.ToQuery();
            _foundError         = false;
            _currentQueryString = model.GetQueryString();
            RaisePropertyChanged(() => TabName);
            RaisePropertyChanged(() => IsShowUnreadCounts);
            RaisePropertyChanged(() => IsNotifyNewArrivals);
            RaisePropertyChanged(() => NotifySoundSourcePath);
            RaisePropertyChanged(() => QueryString);
            RaisePropertyChanged(() => FoundError);
        }
Ejemplo n.º 18
0
 public override void Load(Call call, TabModel model)
 {
     model.Items = new ItemCollection <IListItem>()
     {
         new ListDelegate(SlowItemAsync),
     };
 }
Ejemplo n.º 19
0
    public TabBookmark FindMatches(IList list)
    {
        TabModel    tabModel     = TabModel.Create("", list);
        TabBookmark bookmarkNode = tabModel.FindMatches(Filter, Filter.Depth);

        return(bookmarkNode);
    }
Ejemplo n.º 20
0
        public override void Load(Call call, TabModel model)
        {
            var items = new ItemCollection <ManyTypesItem>();

            for (int i = 0; i < 10; i++)
            {
                var testItem = new ManyTypesItem()
                {
                    Integer  = i,
                    Long     = (long)i * int.MaxValue,
                    DateTime = new DateTime(DateTime.Now.Ticks + i),
                    TimeSpan = TimeSpan.FromHours(i),
                    Bool     = (i % 2 == 1),
                };

                if (i % 2 == 0)
                {
                    testItem.Object = (i % 4 == 0);
                }

                for (int j = 0; j < i; j++)
                {
                    testItem.IntegerList.Add(j);
                }

                testItem.LongString += i;                 // make as a unique string
                items.Add(testItem);
            }
            model.Items = items;
        }
Ejemplo n.º 21
0
        public override void LoadUI(Call call, TabModel model)
        {
            _myParams = new MyParams();
            var tabMyParams = new TabControlMyParams(this, _myParams);

            model.AddObject(tabMyParams);

            _toolbar = new TabControlSearchToolbar(this);
            model.AddObject(_toolbar);

            _toolbar.ButtonSearch.Click        += ButtonSearch_Click;       // move logic into SearchToolbar Command
            _toolbar.ButtonLoadNext.Click      += ButtonLoadNext_Click;
            _toolbar.ButtonCopyClipBoard.Click += ButtonCopyClipBoard_Click;

            _items = new ItemCollection <MyParams>();
            for (int i = 0; i < 10; i++)
            {
                var item = new MyParams()
                {
                    Name   = "Item " + i.ToString(),
                    Amount = i,
                };
                _items.Add(item);
            }
            model.Items = _items;
        }
Ejemplo n.º 22
0
        public override void Load(Call call, TabModel model)
        {
            string characters = "abcdefghijklmn";
            var    items      = new ItemCollection <TestFilterItem>();

            for (int i = 0; i < 2; i++)
            {
                var item = new TestFilterItem()
                {
                    Text   = "Item " + i,
                    Number = i
                };

                var child = new TestFilterItem()
                {
                    Text   = characters[i].ToString(),
                    Number = i
                };
                item.Child = child;

                items.Add(item);
            }

            model.Items = items;

            model.Notes = @"
* Press Ctrl-F on any Data Grid to add a filter (You can click anywhere on a tab to focus it)
* You can use | or & to restrict searches
* Examples:
  - Search for the exact string ""ABC"" or anything containing 123
	- ""ABC"" | 123
* Recursive searches will eventually be supported
";
        }
Ejemplo n.º 23
0
        public SettingViewer()
        {
            InitializeComponent();
            TabModel = new TabModel(this, Studio.Controls.TabItemType.Tool);

            TabModel.Header = TabModel.ToolTip = "Settings";
        }
Ejemplo n.º 24
0
        public ImpedanceTabVM()
        {
            dateImpedanceTest    = DateTime.Now;
            complianceDict       = new SortedDictionary <double, Compliance>();
            complianceDict[-400] = new Compliance();
            complianceDict[-300] = new Compliance();
            complianceDict[-200] = new Compliance();
            complianceDict[-100] = new Compliance();
            complianceDict[0]    = new Compliance();
            complianceDict[100]  = new Compliance();
            complianceDict[200]  = new Compliance();
            complianceDict[300]  = new Compliance();
            complianceDict[400]  = new Compliance();

            acousticReflexDict       = new SortedDictionary <double, AcousticReflex>();
            acousticReflexDict[500]  = new AcousticReflex();
            acousticReflexDict[1000] = new AcousticReflex();
            acousticReflexDict[2000] = new AcousticReflex();
            acousticReflexDict[4000] = new AcousticReflex();

            Tympanogram = new PlotModel();
            AddPlotAxes();

            impModel = new ImpedanceModel(this);
        }
Ejemplo n.º 25
0
        public override void Load(Call call, TabModel model)
        {
            model.MinDesiredWidth = 250;

            model.Items = new List <ListItem>()
            {
                new("Parameters", new TabParamsDataGrid()),
                new("Async Load", new TabTestLoadAsync()),
            };

            model.Actions = new List <TaskCreator>()
            {
                new TaskDelegate("Add Log Entry", AddEntry),
                new TaskDelegate("Test Exception", TestException, true, true, "Throws an exception"),
                new TaskDelegate("Parallel Task Progress", ParallelTaskProgress, true),
                new TaskDelegateAsync("Task Progress", SubTaskProgressAsync, true),
                new TaskAction("Action", () => PassParams(1, "abc")),
                new TaskDelegateAsync("Long load (Async)", SleepAsync, true),
                new TaskDelegate("StartAsync error", StartAsyncError),
            };

            model.Notes = @"
Actions add Buttons to the tab. When clicked, it will:
* Start a task that calls this action
* Add a Tasks grid to the tab
  - Add a new Task to that grid

* Tasks
";
        }
        public UserSelfAdministrationModel(IAdministrationRemoteService adminService, ApplicationGlobalModel globalModel,
                                           UserNameClientCredentials userCredentials, [Named("WpfClientMapper")]  IMapper mapper, IEventAggregator eventAggregator)
        {
            this._adminService    = adminService;
            this._mapper          = mapper;
            this._userCredentials = userCredentials;
            this._eventAggregator = eventAggregator;

            TabModel = new TabModel()
            {
                Title      = Properties.Resources.AdministrationTab_Title_User,
                CanClose   = false,
                IsModified = false
            };

            CurrentUser = globalModel.CurrentUser;
            BackupUser  = new User();

            IsUserInEditMode     = false;
            IsPasswordInEditMode = false;
            PasswordChangeModel  = new PasswordChangeViewModel();

            StartUserChangesCommand  = new DelegateCommand(StartUserChanges);
            SaveUserChangesCommand   = new AwaitableDelegateCommand(SaveUserChanges);
            CancelUserChangesCommand = new DelegateCommand(CancelUserChanges);

            StartPasswordChangeCommand  = new DelegateCommand(StartPasswordChange);
            ChangeUserPasswordCommand   = new AwaitableDelegateCommand(ChangeUserPassword);
            CancelPasswordChangeCommand = new DelegateCommand(CancelPasswordChange);

            ChangeNotification = new InteractionRequest <INotification>();
        }
Ejemplo n.º 27
0
 public override void Load(Call call, TabModel model)
 {
     model.Items = new ItemCollection <ListItem>()
     {
         new("Test Item", new TestItem()),
     };
 }
Ejemplo n.º 28
0
 public static DatabaseMessage Remove(TabModel updateThis)
 {
     return new DatabaseMessage()
     {
         Action = ActionType.Remove,
         Tab = updateThis
     };
 }
Ejemplo n.º 29
0
 public static DatabaseMessage Add(TabModel addThis)
 {
     return new DatabaseMessage()
     {
         Action = ActionType.Add,
         Tab = addThis
     };
 }
 public HierarchyView()
 {
     InitializeComponent();
     TabModel = new TabModel(this, Studio.Controls.TabItemType.Tool)
     {
         Header = "Hierarchy", ToolTip = "Hierarchy View"
     };
 }
 public InstancePropertyView()
 {
     InitializeComponent();
     TabModel = new TabModel(this, Studio.Controls.TabItemType.Tool)
     {
         Header = "Properties", ToolTip = "Property View"
     };
 }
Ejemplo n.º 32
0
 public override void Load(Call call, TabModel model)
 {
     model.Items = new List <ListItem>()
     {
         new("Current", new TabDirectory(Directory.GetCurrentDirectory())),
         new("Root", new TabDirectory("")),
     };
 }
Ejemplo n.º 33
0
 public MetaViewer()
 {
     InitializeComponent();
     TabModel       = new TabModel(this, TabItemType.Document);
     Metadata       = new ObservableCollection <MetaValueBase>();
     DataContext    = this;
     ShowInvisibles = MetaViewerPlugin.Settings.ShowInvisibles;
 }
Ejemplo n.º 34
0
 public TabDescription(TabModel model)
 {
     this.Name = model.Name;
     this.IsShowUnreadCounts = model.IsShowUnreadCounts;
     this.IsNotifyNewArrivals = model.IsNotifyNewArrivals;
     this.BindingAccountIds = model.BindingAccountIds.ToArray();
     this.BindingHashtags = model.BindingHashtags.ToArray();
     this.Query = model.FilterQueryString;
 }
Ejemplo n.º 35
0
        public IEnumerable<ApplicationModel> LoadApplications(TabModel forThis)
        {
            if (forThis == null)
                throw new ArgumentNullException("forThis");

            return from elem in _database.Element("Applications").Elements("Application")
                   where elem.GetValue("Tab") == forThis.Title
                   select ApplicationFromXml(elem);
        }
Ejemplo n.º 36
0
 public static DatabaseMessage Move(TabModel moveThis, TabModel moveToThis)
 {
     return new DatabaseMessage()
     {
         Action = ActionType.Move,
         Tab = moveThis,
         TabB = moveToThis
     };
 }
 private void OnConfigurationStart(TabModel model)
 {
     this._currentConfigurationTarget = model;
     this.IsConfigurationActive = true;
     _filterQuery = model.FilterQuery;
     _initialQuery = _filterQuery.ToQuery();
     _foundError = false;
     _currentQueryString = model.FilterQueryString;
     RaisePropertyChanged(() => TabName);
     RaisePropertyChanged(() => IsShowUnreadCounts);
     RaisePropertyChanged(() => IsNotifyNewArrivals);
     RaisePropertyChanged(() => QueryString);
     RaisePropertyChanged(() => FoundError);
 }
Ejemplo n.º 38
0
 public void CreateTab(TabModel info)
 {
     _tabs.Add(info);
     CurrentFocusTabIndex = _tabs.Count - 1;
 }
Ejemplo n.º 39
0
 /// <summary>
 ///     Find tab info where existed.
 /// </summary>
 /// <param name="info">tab info</param>
 /// <param name="colIndex">column index</param>
 public static int FindTabIndex(TabModel info, int colIndex)
 {
     for (var ti = 0; ti < _columns[colIndex].Tabs.Count; ti++)
     {
         if (_columns[colIndex].Tabs[ti] == info)
         {
             return ti;
         }
     }
     return -1;
 }
Ejemplo n.º 40
0
 /// <summary>
 ///     Find tab info where existed.
 /// </summary>
 /// <param name="info">tab info</param>
 /// <param name="colIndex">column index</param>
 /// <param name="tabIndex">tab index</param>
 public static bool FindColumnTabIndex(TabModel info, out int colIndex, out int tabIndex)
 {
     for (var ci = 0; ci < _columns.Count; ci++)
     {
         for (var ti = 0; ti < _columns[ci].Tabs.Count; ti++)
         {
             if (_columns[ci].Tabs[ti] != info) continue;
             colIndex = ci;
             tabIndex = ti;
             return true;
         }
     }
     colIndex = -1;
     tabIndex = -1;
     return false;
 }
Ejemplo n.º 41
0
 /// <summary>
 ///     Create tab into specified column
 /// </summary>
 public static void CreateTab(TabModel info, int columnIndex)
 {
     // ReSharper disable LocalizableElement
     if (columnIndex > _columns.Count) // column index is only for existed or new column
         throw new ArgumentOutOfRangeException(
             "columnIndex",
             "currently " + _columns.Count +
             " columns are existed. so, you can't set this parameter as " +
             columnIndex + ".");
     // ReSharper restore LocalizableElement
     if (columnIndex == _columns.Count)
     {
         // create new
         CreateColumn(info);
     }
     else
     {
         _columns[columnIndex].CreateTab(info);
         Save();
     }
 }
Ejemplo n.º 42
0
        void Move(TabModel moveThis, TabModel moveToThis)
        {
            Log.DebugFormat("Move {0} to {1}", moveThis.Title, moveToThis.Title);

            var moveThisXml = GetTab(moveThis);
            var moveToThisXml = GetTab(moveToThis);

            // Move xml from current position to just above the other tab.
            moveThisXml.Remove();
            moveToThisXml.AddBeforeSelf(moveThisXml);
        }
Ejemplo n.º 43
0
 public static void NotifyChangeFocusingTab(TabModel tabModel)
 {
     _currentFocusTabModel = null;
     _bindingAuthInfos.Clear();
     tabModel.BindingAccountIds
             .Select(AccountsStore.GetAccountSetting)
             .Where(_ => _ != null)
             .Select(_ => _.AuthenticateInfo)
             .ForEach(_bindingAuthInfos.Add);
     _bindingHashtags.Clear();
     tabModel.BindingHashtags.ForEach(_bindingHashtags.Add);
     _currentFocusTabModel = tabModel;
 }
Ejemplo n.º 44
0
 public TabModel ToTabModel()
 {
     var model = new TabModel(this.Name, this.Query)
      {
          BindingHashtags = this.BindingHashtags,
          IsNotifyNewArrivals = this.IsNotifyNewArrivals,
          IsShowUnreadCounts = this.IsShowUnreadCounts
      };
     this.BindingAccountIds.ForEach(model.BindingAccountIds.Add);
     return model;
 }
Ejemplo n.º 45
0
        void Add(TabModel addThis)
        {
            Log.DebugFormat("Add {0}", addThis.Title);

            _database.Element("Tabs").Add(TabToXml(addThis));
        }
Ejemplo n.º 46
0
        void Update(TabModel updateThis)
        {
            Log.DebugFormat("Update {0}", updateThis.OldTitle);

            var tab = GetTab(updateThis);
            tab.ReplaceWith(TabToXml(updateThis));
        }
Ejemplo n.º 47
0
 XElement TabToXml(TabModel section)
 {
     XElement xml = new XElement("Tab",
             new XElement("Title", section.Title),
             new XElement("IsExpanded", section.IsExpanded));
     return xml;
 }
Ejemplo n.º 48
0
        void Remove(TabModel removeThis)
        {
            Log.DebugFormat("Remove {0}", removeThis.Title);

            var section = GetTab(removeThis);
            section.Remove();
        }
Ejemplo n.º 49
0
 public void CreateTab(TabModel info)
 {
     _tabs.Add(info);
 }
Ejemplo n.º 50
0
 /// <summary>
 ///     Create column
 /// </summary>
 /// <param name="info">initial created tab</param>
 public static void CreateColumn(TabModel info)
 {
     _columns.Add(new ColumnModel(info));
 }
Ejemplo n.º 51
0
 public static void NotifyChangeFocusingTab(TabModel tabModel)
 {
     if (_currentFocusTabModel == tabModel) return;
     _currentFocusTabModel = null;
     if (!_bindingAuthInfos.Select(ai => ai.Id).SequenceEqual(tabModel.BindingAccountIds))
     {
         _bindingAuthInfos.Clear();
         tabModel.BindingAccountIds
                 .Select(AccountsStore.GetAccountSetting)
                 .Where(_ => _ != null)
                 .Select(_ => _.AuthenticateInfo)
                 .ForEach(_bindingAuthInfos.Add);
     }
     if (!_bindingHashtags.SequenceEqual(tabModel.BindingHashtags))
     {
         _bindingHashtags.Clear();
         tabModel.BindingHashtags.ForEach(_bindingHashtags.Add);
     }
     _currentFocusTabModel = tabModel;
 }
Ejemplo n.º 52
0
 /// <summary>
 /// </summary>
 /// <param name="info"></param>
 /// <param name="columnIndex"></param>
 /// <param name="tabIndex"></param>
 public static void MoveTo(TabModel info, int columnIndex, int tabIndex)
 {
     int fci, fti;
     GetTabInfoIndexes(info, out fci, out fti);
     MoveTo(fci, fti, columnIndex, tabIndex);
 }
Ejemplo n.º 53
0
 public static void ShowTabConfigure(TabModel model)
 {
     var handler = TabModelConfigureRaised;
     if (handler != null) handler(model);
 }
Ejemplo n.º 54
0
 public void CreateNewTab()
 {
     var creating = new TabModel(string.Empty, DefaultQueryString);
     IDisposable subscribe = null;
     subscribe = Observable.FromEvent<bool>(
         h => creating.ConfigurationUpdated += h,
         h => creating.ConfigurationUpdated -= h)
                           .Subscribe(_ =>
                           {
                               if (subscribe != null) subscribe.Dispose();
                               // configuration completed.
                               if (String.IsNullOrEmpty(creating.Name) &&
                                   creating.FilterQueryString == DefaultQueryString) return;
                               this.Model.CreateTab(creating);
                           });
     MainWindowModel.ShowTabConfigure(creating);
 }
Ejemplo n.º 55
0
 XElement GetTab(TabModel tab)
 {
     return
         (from sectionXml in _database.Element("Tabs").Elements("Tab")
          where sectionXml.Element("Title").Value == tab.Title ||
                sectionXml.Element("Title").Value == tab.OldTitle
          select sectionXml).Single();
 }
Ejemplo n.º 56
0
 /// <summary>
 ///     Find tab info where existed.
 /// </summary>
 /// <param name="info">tab info</param>
 /// <param name="colIndex">column index</param>
 /// <param name="tabIndex">tab index</param>
 public static void GetTabInfoIndexes(TabModel info, out int colIndex, out int tabIndex)
 {
     for (int ci = 0; ci < _columns.Count; ci++)
     {
         for (int ti = 0; ti < _columns[ci].Tabs.Count; ti++)
         {
             if (_columns[ci].Tabs[ti] == info)
             {
                 colIndex = ci;
                 tabIndex = ti;
                 return;
             }
         }
     }
     throw new ArgumentException("specified TabInfo was not found.");
 }
Ejemplo n.º 57
0
 /// <summary>
 ///     Create tab
 /// </summary>
 /// <param name="info">tab information</param>
 public static void CreateTab(TabModel info)
 {
     CreateTab(info, _currentFocusColumnIndex);
     Save();
 }
Ejemplo n.º 58
0
 public TabViewModel()
 {
     _model = null;
 }
Ejemplo n.º 59
0
 public TabViewModel(ColumnViewModel parent, TabModel tabModel)
 {
     _parent = parent;
     _model = tabModel;
     tabModel.Activate();
     CompositeDisposable.Add(
         Observable.FromEvent<TwitterStatus>(
             h => Model.Timeline.NewStatusArrival += h,
             h =>
             {
                 if (Model.Timeline != null)
                     Model.Timeline.NewStatusArrival -= h;
             }).Subscribe(_ => UnreadCount++));
     BindTimeline();
     CompositeDisposable.Add(
         Observable.FromEvent<ScrollLockStrategy>(
             handler => Setting.ScrollLockStrategy.ValueChanged += handler,
             handler => Setting.ScrollLockStrategy.ValueChanged -= handler)
                   .Subscribe(_ =>
                   {
                       RaisePropertyChanged(() => IsScrollLock);
                       RaisePropertyChanged(() => IsScrollLockExplicitEnabled);
                   }));
     CompositeDisposable.Add(() => Model.Deactivate());
     if (Model.FilterQuery.PredicateTreeRoot != null)
     {
         CompositeDisposable.Add(
             Observable.FromEvent(
                 h => Model.FilterQuery.InvalidateRequired += h,
                 h => Model.FilterQuery.InvalidateRequired -= h)
                       .Subscribe(_ =>
                       {
                           var count = Interlocked.Increment(ref _refreshCount);
                           Observable.Timer(TimeSpan.FromSeconds(3))
                                     .Where(__ => Interlocked.CompareExchange(ref _refreshCount, 0, count) == count)
                                     .Subscribe(__ =>
                                     {
                                         System.Diagnostics.Debug.WriteLine("* invalidate executed: " + Name);
                                         // regenerate filter query
                                         Model.RefreshEvaluator();
                                         Model.InvalidateCollection();
                                         BindTimeline();
                                     });
                       }));
     }
     CompositeDisposable.Add(
         Observable.FromEvent(
             h => tabModel.BindingAccountIdsChanged += h,
             h => tabModel.BindingAccountIdsChanged -= h)
                   .Subscribe(
                       _ => DispatcherHolder.Enqueue(
                           () => Timeline.ForEach(t => t.BindingAccounts = Model.BindingAccountIds),
                           DispatcherPriority.Background)));
     CompositeDisposable.Add(
         Observable.FromEvent<bool>(
             h => tabModel.ConfigurationUpdated += h,
             h => tabModel.ConfigurationUpdated -= h)
                   .Subscribe(timelineModelRegenerated =>
                   {
                       RaisePropertyChanged(() => Name);
                       RaisePropertyChanged(() => UnreadCount);
                       if (timelineModelRegenerated)
                       {
                           BindTimeline();
                       }
                   }));
     CompositeDisposable.Add(
         Observable.FromEvent(
         h => tabModel.SetPhysicalFocusRequired += h,
         h => tabModel.SetPhysicalFocusRequired -= h)
         .Subscribe(_ => this.Messenger.Raise(new InteractionMessage("SetPhysicalFocus"))));
 }