public GroupSelect(MainWindow main, Group group) { InitializeComponent(); this.main = main; this.parentGroup = group; this.addAccounts(); }
private void Window_Loaded(object sender, RoutedEventArgs e) { if (Properties.Settings.Default.evePath.Length == 0) { string path = null; string appdata = Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData); foreach (string dir in Directory.EnumerateDirectories(Path.Combine(appdata, "CCP", "EVE"), "*_tranquility")) { string[] split = dir.Split(new char[] { '_' }, 2); string drive = split[0].Substring(split[0].Length - 1); path = split[1].Substring(0, split[1].Length - "_tranquility".Length).Replace('_', Path.DirectorySeparatorChar); path = drive.ToUpper() + Path.VolumeSeparatorChar + Path.DirectorySeparatorChar + path; break; } if (path != null && File.Exists(Path.Combine(path, "bin", "ExeFile.exe"))) { Properties.Settings.Default.evePath = path; Properties.Settings.Default.Save(); } } this.txtEvePath.Text = EvePath; this.tray = new System.Windows.Forms.NotifyIcon(); this.tray.Icon = System.Drawing.Icon.ExtractAssociatedIcon(Application.ResourceAssembly.Location); this.tray.Text = this.Title; this.tray.ContextMenu = new System.Windows.Forms.ContextMenu(); this.tray.MouseClick += new System.Windows.Forms.MouseEventHandler(this.tray_Click); this.contextMenuClick = new EventHandler(this.contextMenu_Click); this.tray.ContextMenu.MenuItems.Add("launch all", this.contextMenuClick); this.tray.ContextMenu.MenuItems.Add("-"); if (Properties.Settings.Default.accounts != null) { foreach (string credentials in Properties.Settings.Default.accounts) { Account account = new Account(this); string[] split = credentials.Split(new char[] { ':' }, 4); account.username.Text = split[0]; account.password.Password = this.decryptPass(rjm, split[1]); if (split.Length > 2) { account.accountID.Text = split[2]; } if (split.Length > 3) { string[] chars = split[3].Split(new char[] { ':' }); foreach (string character in chars) { if (character != "") { account.charIDs.Add(Convert.ToInt32(character)); } } } this.accountsPanel.Children.Add(account); } } this.tray.ContextMenu.MenuItems.Add("-"); if (Properties.Settings.Default.groups != null) { foreach (string gp in Properties.Settings.Default.groups) { Group G = new Group(this); string[] split = gp.Split(new char[] { ':' }); foreach (string s in split) { if (s == split[0]) { G.groupname.Text = s; } else { foreach (Account account in this.accountsPanel.Children) { if (s == account.username.Text) { G.addAccount(account); } } } } this.groupsPanel.Children.Add(G); } } this.popContextMenu(); this.tray.Visible = true; this.saveAccounts = true; this.startUpdateCheck(); }
private void addGroup_Click(object sender, RoutedEventArgs e) { Group group = new Group(this); this.groupsPanel.Children.Add(group); }