public CodeControl(AuthKey key, AuthKeyConfig config) { InitializeComponent(); _authKey = key; _config = config; }
public void Load(string filename) { if (string.IsNullOrWhiteSpace(filename)) { filename = "gauthUI.config"; } _filename = filename; _keys.CollectionChanged -= AuthKeys_CollectionChanged; if (!System.IO.File.Exists(filename)) { Save(); } using (var reader = new StreamReader(filename)) { AuthKeyConfig tmp = JsonConvert.DeserializeObject <AuthKeyConfig>(reader.ReadToEnd()); this.Keys.Clear(); _keysSet.Clear(); foreach (var t in tmp.Keys) { _keysSet.Add(t.Name); this.Keys.Add(t); } } _keys.CollectionChanged += AuthKeys_CollectionChanged; }
public AddCodeWindow(AuthKeyConfig config) { InitializeComponent(); if (config == null) { throw new ArgumentNullException("config"); } _config = config; }
private void Window_Loaded(object sender, RoutedEventArgs e) { _config = new AuthKeyConfig(); _config.Keys.CollectionChanged += new NotifyCollectionChangedEventHandler(AuthKeys_CollectionChanged); _config.Load(_filename); }