private void Test_Load(object sender, EventArgs e) { _attType = typeof(AsyncStateMachineAttribute); _assemblies = AppDomain.CurrentDomain.GetAssemblies(); _ignoreList = new[] { "Equals", "GetHashCode", "GetType", "ToString" }; _cboCategories = new Dictionary<int, string> { { 1, "EF" }, { 2, "RPC" }, { 3, "BAL" } }; cboCategories.DataSource = new BindingSource(_cboCategories, null); cboCategories.DisplayMember = "Value"; cboCategories.ValueMember = "Key"; //cboCategories.SelectedIndex = 0; _state = new State(); var uow = new TekTak.iLoop.UOW.UnitOfWork(); _constorInfo = new ConstructorInfo { ConstorParamType = new[] { uow.GetServices().GetType() }, ConstorParams = new object[] { uow.GetServices() } }; LoadState(); _samples = API.SampleConfig.GetSamples(); cboClasses.SelectedIndex = cboClasses.Items.Count >= _state.Combo ? _state.Combo : 0; if (treeMethods.Nodes.Count > 0) treeMethods.SelectedNode = treeMethods.Nodes.Count > _state.Node ? treeMethods.Nodes[_state.Node] : treeMethods.Nodes[0]; treeMethods.Focus(); }
private void LoadState() { if (File.Exists(Path.Combine(Application.StartupPath, "iLoopDesktopState.txt"))) using (var sr = new StreamReader(Path.Combine(Application.StartupPath, "iLoopDesktopState.txt"))) { try { _state = JsonConvert.DeserializeObject<State>(sr.ReadToEnd()); cboCategories.SelectedIndex = cboCategories.Items.Count >= _state.Category ? _state.Category : 0; //cboClasses.SelectedIndex = cboClasses.Items.Count >= _state.Combo ? _state.Combo : 0; //treeMethods.SelectedNode = treeMethods.Nodes.Count > _state.Node ? treeMethods.Nodes[_state.Node] : treeMethods.Nodes[0]; //treeMethods.Focus(); txtAuth.Text = _state.Token; WindowState = _state.IsMaximized ? FormWindowState.Maximized : FormWindowState.Normal; spltMajor.SplitterDistance = _state.SplitMajor; spltResults.SplitterDistance = _state.SplitMinor; } catch (Exception) { } } }