private MenuItem QuickLaunchMenu_CreateClientItem(string clientName, Mubox.Configuration.ProfileSettings profile) { RoutedEventHandler clientStartEventHandler = (sender, e) => { var clientSettings = profile.Clients.GetExisting(clientName); if (clientSettings != null) { Mubox.Configuration.MuboxConfigSection.Default.Profiles.ActiveProfile = profile; Mubox.Configuration.MuboxConfigSection.Save(); ClientState clientState = new ClientState(clientSettings, profile); Mubox.View.Client.ClientWindow clientWindow = new Mubox.View.Client.ClientWindow(clientState); clientWindow.Show(); } }; RoutedEventHandler clientDeleteEventHandler = (sender, e) => { // TODO: add confirmation dialog to avoid accidental deletions if (profile.Clients.Remove(clientName)) { // TODO: we need to clean up the sandbox account as well Mubox.Configuration.MuboxConfigSection.Default.Profiles.ActiveProfile = profile; Mubox.Configuration.MuboxConfigSection.Save(); } }; MenuItem clientMenuItem = new MenuItem(); clientMenuItem.Header = clientName; // clientMenuItem.Click += clientLaunchEventHandler; MenuItem clientLaunchMenuItem = new MenuItem(); clientLaunchMenuItem.Header = "_Start"; clientLaunchMenuItem.Click += clientStartEventHandler; MenuItem clientDeleteMenuItem = new MenuItem(); clientDeleteMenuItem.Header = "_Remove From List"; clientDeleteMenuItem.Click += clientDeleteEventHandler; clientMenuItem.ItemsSource = new object[] { clientLaunchMenuItem, clientDeleteMenuItem }; return(clientMenuItem); }
private static void LaunchProfileClients(Mubox.Configuration.ProfileSettings profile) { Mubox.Configuration.MuboxConfigSection.Default.Profiles.ActiveProfile = profile; foreach (var o in profile.Clients) { var character = o as Mubox.Configuration.ClientSettings; if (character.CanLaunch) { if (Mubox.View.Client.ClientWindowCollection.Instance.Count((dlg) => dlg.ClientState.Settings.Name.ToUpper().Equals(character.Name.ToUpper(), StringComparison.InvariantCultureIgnoreCase)) == 0) { Mubox.View.Client.ClientWindow clientWindow = new Mubox.View.Client.ClientWindow(new Mubox.Model.ClientState(character, profile)); clientWindow.Show(); } } } }
public ClientState(Mubox.Configuration.ClientSettings settings, Mubox.Configuration.ProfileSettings profile) : this() { Settings = settings; Profile = profile; }