internal void Setup(string uuid) { Keyfile keyfile = this.KeyControl.GetKeyfile(uuid); List <KeyCommandViewModel> keys = new List <KeyCommandViewModel>(); foreach (KeyCommand key in keyfile.keys) { string commandString = this.KeyControl.GetCommandStringForCommand(key); List <string> normalizedAdjustmentNames = new List <string>(); foreach (KeyValuePair <string, object> adj in key.adj) { KeyCommandViewModel newKey = new KeyCommandViewModel(); string normalAdjustmentName = (string)this.KeyControl.adjustmentMapping[adj.Key]; if (normalizedAdjustmentNames.Contains(normalAdjustmentName)) { continue; } normalizedAdjustmentNames.Add(normalAdjustmentName); newKey.Command = commandString; newKey.Adjustment = normalAdjustmentName; newKey.Amount = (adj.Key == Constants.KEYFILE_ADJUSTMENT_REMAP_NODENAME) ? this.KeyControl.GetCommandStringForCommand((KeyCommand)adj.Value) : (string)adj.Value; keys.Add(newKey); } } this.Keys = new ObservableCollection <KeyCommandViewModel>(keys); }
internal void Setup(string uuid) { Keyfile keyfile = this.KeyControl.GetKeyfile(uuid); List<KeyCommandViewModel> keys = new List<KeyCommandViewModel>(); foreach (KeyCommand key in keyfile.keys) { string commandString = this.KeyControl.GetCommandStringForCommand(key); List<string> normalizedAdjustmentNames = new List<string>(); foreach (KeyValuePair<string, object> adj in key.adj) { KeyCommandViewModel newKey = new KeyCommandViewModel(); string normalAdjustmentName = (string)this.KeyControl.adjustmentMapping[adj.Key]; if (normalizedAdjustmentNames.Contains(normalAdjustmentName)) { continue; } normalizedAdjustmentNames.Add(normalAdjustmentName); newKey.Command = commandString; newKey.Adjustment = normalAdjustmentName; newKey.Amount = (adj.Key == Constants.KEYFILE_ADJUSTMENT_REMAP_NODENAME) ? this.KeyControl.GetCommandStringForCommand((KeyCommand)adj.Value) : (string)adj.Value; keys.Add(newKey); } } this.Keys = new ObservableCollection<KeyCommandViewModel>(keys); }
internal void Setup(string uuid) { this.Keyfile = this.KeyControl.GetKeyfile(uuid); List<KeyCommandViewModel> keys = new List<KeyCommandViewModel>(); foreach (KeyCommand key in this.Keyfile.keys) { string commandString = this.KeyControl.GetCommandStringForCommand(key); List<string> normalizedAdjustmentNames = new List<string>(); foreach (KeyValuePair<string, object> adj in key.adj) { KeyCommandViewModel newKey = new KeyCommandViewModel(); string normalAdjustmentName = this.KeyControl.adjustmentMapping[adj.Key]; if (normalizedAdjustmentNames.Contains(normalAdjustmentName)) { continue; } normalizedAdjustmentNames.Add(normalAdjustmentName); newKey.Command = commandString; newKey.Adjustment = normalAdjustmentName; newKey.Amount = (adj.Key == Constants.KEYFILE_ADJUSTMENT_REMAP_NODENAME) ? this.KeyControl.GetCommandStringForCommand((KeyCommand)adj.Value) : (string)adj.Value; keys.Add(newKey); } } this.Keys = new ObservableCollection<KeyCommandViewModel>(keys); this.ViewSource = new ListCollectionView(keys); this.ViewSource.Filter = (o) => { if (string.IsNullOrWhiteSpace(this.Filter)) { return true; } KeyCommandViewModel command = o as KeyCommandViewModel; string filter = this.Filter.ToLowerInvariant(); if (command != null && (command.Command.ToLowerInvariant().Contains(filter) || command.Adjustment.ToLowerInvariant().Contains(filter) || command.Amount.ToLowerInvariant().Contains(filter))) { return true; } return false; }; this.PropertyChanged += new System.ComponentModel.PropertyChangedEventHandler(DetailViewModel_PropertyChanged); if (File.Exists(this.GetKeyfilePdfPath())) { this.DownloadAmount = 100; } else { this.DownloadAmount = 0; } }
internal void Setup(string uuid) { this.Keyfile = this.KeyControl.GetKeyfile(uuid); List <KeyCommandViewModel> keys = new List <KeyCommandViewModel>(); foreach (KeyCommand key in this.Keyfile.keys) { string commandString = this.KeyControl.GetCommandStringForCommand(key); List <string> normalizedAdjustmentNames = new List <string>(); foreach (KeyValuePair <string, object> adj in key.adj) { KeyCommandViewModel newKey = new KeyCommandViewModel(); string normalAdjustmentName = this.KeyControl.adjustmentMapping[adj.Key]; if (normalizedAdjustmentNames.Contains(normalAdjustmentName)) { continue; } normalizedAdjustmentNames.Add(normalAdjustmentName); newKey.Command = commandString; newKey.Adjustment = normalAdjustmentName; newKey.Amount = (adj.Key == Constants.KEYFILE_ADJUSTMENT_REMAP_NODENAME) ? this.KeyControl.GetCommandStringForCommand((KeyCommand)adj.Value) : (string)adj.Value; keys.Add(newKey); } } this.Keys = new ObservableCollection <KeyCommandViewModel>(keys); this.ViewSource = new ListCollectionView(keys); this.ViewSource.Filter = (o) => { if (string.IsNullOrWhiteSpace(this.Filter)) { return(true); } KeyCommandViewModel command = o as KeyCommandViewModel; string filter = this.Filter.ToLowerInvariant(); if (command != null && (command.Command.ToLowerInvariant().Contains(filter) || command.Adjustment.ToLowerInvariant().Contains(filter) || command.Amount.ToLowerInvariant().Contains(filter))) { return(true); } return(false); }; this.PropertyChanged += new System.ComponentModel.PropertyChangedEventHandler(DetailViewModel_PropertyChanged); if (File.Exists(this.GetKeyfilePdfPath())) { this.DownloadAmount = 100; } else { this.DownloadAmount = 0; } }