Ejemplo n.º 1
0
        public CodeControl(AuthKey key, AuthKeyConfig config)
        {
            InitializeComponent();

            _authKey = key;
            _config  = config;
        }
Ejemplo n.º 2
0
        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;
        }
Ejemplo n.º 3
0
        public AddCodeWindow(AuthKeyConfig config)
        {
            InitializeComponent();

            if (config == null)
            {
                throw new ArgumentNullException("config");
            }

            _config = config;
        }
Ejemplo n.º 4
0
 private void Window_Loaded(object sender, RoutedEventArgs e)
 {
     _config = new AuthKeyConfig();
     _config.Keys.CollectionChanged += new NotifyCollectionChangedEventHandler(AuthKeys_CollectionChanged);
     _config.Load(_filename);
 }