public CardTypeTab(TabControl tabControl, MsgObject.Action saveMsg) { uiContext = SynchronizationContext.Current; watcher = new FileSystemWatcher(); Categories = new ObservableSortedDictionary <string, Category>(); Enabled.Value = Visibility.Collapsed; this.tabControl = tabControl; this.saveMsg = saveMsg; }
/// <summary> /// Standard <seealso cref="FolderViewModel"/> constructor /// </summary> protected FolderViewModel() : base() { mIsExpanded = mIsSelected = false; mModel = null; // Add dummy folder by default to make tree view show expander by default mFolders = new ObservableSortedDictionary <string, IFolderViewModel>(); mFolders.Add(string.Empty, new FolderViewModel(string.Empty, FSItemType.DummyEntry)); mVolumeLabel = null; }
public RealtimeOrderBookClient(string ProductString, CBAuthenticationContainer auth = null) { this.ProductString = ProductString; this.productOrderBookClient = new ProductOrderBookClient(auth); Sells = new ObservableSortedDictionary <decimal, ObservableLinkedList <BidAskOrder> >(new DescendingComparer <decimal>()); Buys = new ObservableSortedDictionary <decimal, ObservableLinkedList <BidAskOrder> >(new DescendingComparer <decimal>()); this.RealtimeOrderBookSubscription = new RealtimeOrderBookSubscription(ProductString, auth); this.RealtimeOrderBookSubscription.RealtimeOpen += OnOpen; this.RealtimeOrderBookSubscription.RealtimeDone += OnDone; this.RealtimeOrderBookSubscription.RealtimeMatch += OnMatch; this.RealtimeOrderBookSubscription.RealtimeChange += OnChange; //await ResetStateWithFullOrderBook(); }
public void SourceManipulationSorted() { var numbers = new ObservableSortedDictionary <int, int>(Enumerable.Range(0, 10).ToDictionary(i => i)); using var query = numbers.ActiveValueForOrDefault(9); Assert.IsNull(query.OperationFault); Assert.AreEqual(9, query.Value); numbers.Remove(9); Assert.IsNull(query.OperationFault); Assert.AreEqual(0, query.Value); numbers.Add(9, 30); Assert.IsNull(query.OperationFault); Assert.AreEqual(30, query.Value); numbers[9] = 15; Assert.IsNull(query.OperationFault); Assert.AreEqual(15, query.Value); }
/// <summary> /// Construct dummy folder /// </summary> /// <param name="path"></param> /// <param name="type"></param> protected FolderViewModel(string path, FSItemType type) { // Names of Logical drives cannot be changed with this if (type == FSItemType.LogicalDrive) { this.IsReadOnly = true; } mIsExpanded = mIsSelected = false; mModel = new PathModel(path, type); // Add dummy folder by default to make tree view show expander by default mFolders = new ObservableSortedDictionary <string, IFolderViewModel>(); mVolumeLabel = null; }
/// <summary> /// Get all child entries for a given path entry /// </summary> /// <param name="childFolders"></param> /// <param name="path"></param> /// <returns></returns> private static IFolderViewModel Expand(ObservableSortedDictionary <string, IFolderViewModel> childFolders, string path) { if (string.IsNullOrEmpty(path) || childFolders.Count == 0) { return(null); } string folderName = path; if (path.Contains('/') || path.Contains('\\')) { int idx = path.IndexOfAny(new char[] { '/', '\\' }); folderName = path.Substring(0, idx); path = path.Substring(idx + 1); } else { path = null; } // bugfix: Folder names on windows are case insensitiv //var results = childFolders.Where<IFolderViewModel>(folder => string.Compare(folder.FolderName, folderName, true) == 0); IFolderViewModel results; childFolders.TryGetValue(folderName.ToLower(), out results); if (results != null) { IFolderViewModel fvm = results; var folder = fvm as FolderViewModel; // Cast this to access internal setter folder.IsExpanded = true; var retVal = BrowserViewModel.Expand(fvm.Folders, path); if (retVal != null) { return(retVal); } else { return(fvm); } } return(null); }
/// <summary> /// Standard class constructor /// </summary> protected BrowserViewModel() { DisplayMessage = new DisplayMessageViewModel(); BookmarkFolder = new AddFolderBookmark(); InitializeSpecialFolders(); mOpenInWindowsCommand = null; mCopyPathCommand = null; Folders = new ObservableSortedDictionary <string, IFolderViewModel>(); mExpandProcessor = ProcessFactory.CreateProcessViewModel(); mProcessor = ProcessFactory.CreateProcessViewModel(); InitialPath = string.Empty; _UpdateView = true; _IsBrowseViewEnabled = true; }