private void OpCombo_SelectedIndexChanged(object sender, EventArgs e) { if (OpCombo.SelectedItem is OpComboItem) { OpComboItem item = OpCombo.SelectedItem as OpComboItem; //item.UpdateSplash(); TextPassword.Enabled = File.Exists(item.Fullpath); TextPassword.Text = ""; TextPassword.Select(); CheckLoginButton(); return; } else { TextPassword.Enabled = ButtonLoad.Enabled = false; } if (OpCombo.SelectedItem is string) { //SplashBox.Image = InterfaceRes.splash; BrowseLink_LinkClicked(); } }
private void BrowseLink_LinkClicked() { try { OpenFileDialog open = new OpenFileDialog(); open.InitialDirectory = LastBrowse; open.Filter = "DeOps Identity (*.dop)|*.dop"; if (open.ShowDialog() == DialogResult.OK) { OpComboItem select = null; foreach (object item in OpCombo.Items) { if (item is OpComboItem) { if (((OpComboItem)item).Fullpath == open.FileName) { select = item as OpComboItem; break; } } } if (select == null) { select = new OpComboItem(this, open.FileName); OpCombo.Items.Insert(0, select); } OpCombo.SelectedItem = select; LastBrowse = open.FileName; TextPassword.Text = ""; TextPassword.Select(); } else { OpCombo.Text = ""; } } catch (Exception ex) { MessageBox.Show(this, ex.Message); } }
public LoginForm(AppContext app, string arg) { App = app; Context = app.Context; Arg = arg; InitializeComponent(); Text = "DeOps Alpha v" + DeOpsContext.CoreVersion; //+ app.Context.LocalSeqVersion.ToString(); //SplashBox.Image = InterfaceRes.splash; if (Context.Sim != null) // prevent sim recursion { EnterSimLink.Visible = false; } LastBrowse = Application.StartupPath; LastOpened = (arg != "") ? arg : App.Settings.LastOpened; // each profile (.rop) is in its own directory // /root/profiledirs[]/profile.rop if (App.Context.Sim == null) { LoadProfiles(Application.StartupPath); // if started with file argument, load profiles around the same location if (File.Exists(arg)) { LoadProfiles(Path.GetDirectoryName(Path.GetDirectoryName(arg))); } } else { LoadProfiles(App.Context.Sim.Internet.LoadedPath); } OpComboItem select = null; if (LastOpened != null) { foreach (OpComboItem item in OpCombo.Items) { if (item.Fullpath == LastOpened) { select = item; } } } if (select != null) { OpCombo.SelectedItem = select; } else if (OpCombo.Items.Count > 0) { OpCombo.SelectedIndex = 0; } OpCombo.Items.Add("Browse..."); if (OpCombo.SelectedItem != null) { TextPassword.Select(); } }