Example #1
0
        private void PlayLabel_Click(object sender, EventArgs e)
        {
            currentTab = AppTab.Player;
            AppDesignProvider.SetCurrentTab(this, (AppTheme)Properties.Settings.Default.ThemeIndex, currentTab);

            PlayerLayout.Visible = true;
            ShowsLayout.Visible  = SettingsLayout.Visible = SaveSettingsPanel.Visible = false;
            ErrorLabel.Visible   = RefreshLabel.Visible = AutoplayButton.Visible = false;
        }
Example #2
0
        private void OnlineLabel_Click(object sender, EventArgs e)
        {
            // Change label font to border & backcolor, hide refresh labels, and populate list from internal list (onlineCartoons)
            currentTab = AppTab.Online;
            AppDesignProvider.SetCurrentTab(this, (AppTheme)Properties.Settings.Default.ThemeIndex, currentTab);

            ShowsLayout.Visible  = true;
            PlayerLayout.Visible = SettingsLayout.Visible = SaveSettingsPanel.Visible = false;
            ErrorLabel.Visible   = RefreshLabel.Visible = AutoplayButton.Visible = false;

            LoadFromOnline();
        }
Example #3
0
        private void HardDriveLabel_Click(object sender, EventArgs e)
        {
            // Change label border & backcolor, and populate list from hard drive
            currentTab = AppTab.HardDrive;
            AppDesignProvider.SetCurrentTab(this, (AppTheme)Properties.Settings.Default.ThemeIndex, currentTab);

            ShowsLayout.Visible  = AutoplayButton.Visible = true;
            PlayerLayout.Visible = SettingsLayout.Visible = SaveSettingsPanel.Visible = false;
            Refresh();

            LoadFromDrive();
        }
        public static void SetCurrentTab(MainForm form, AppTheme theme, AppTab currentTab)
        {
            Label HardDriveLabel = form.Controls.Find("HardDriveLabel", true).FirstOrDefault() as Label,
                  PlayLabel      = form.Controls.Find("PlayLabel", true).FirstOrDefault() as Label,
                  OnlineLabel    = form.Controls.Find("OnlineLabel", true).FirstOrDefault() as Label,
                  SettingsLabel  = form.Controls.Find("SettingsLabel", true).FirstOrDefault() as Label,
                  TitleLabel     = form.Controls.Find("TitleLabel", true).FirstOrDefault() as Label;

            if (theme == AppTheme.Azure)
            {
                HardDriveLabel.Image = Properties.Resources.hard_drive_icon;
                PlayLabel.Image      = Properties.Resources.play_icon;
                OnlineLabel.Image    = Properties.Resources.online_icon;
                SettingsLabel.Image  = Properties.Resources.settings_icon;
            }
            else if (theme == AppTheme.Forest || theme == AppTheme.Ghost)
            {
                HardDriveLabel.Image = currentTab == AppTab.HardDrive ? Properties.Resources.hard_drive_icon_alt : Properties.Resources.hard_drive_icon;
                PlayLabel.Image      = currentTab == AppTab.Player ? Properties.Resources.play_icon_alt : Properties.Resources.play_icon;
                OnlineLabel.Image    = currentTab == AppTab.Online ? Properties.Resources.online_icon_alt : Properties.Resources.online_icon;
                SettingsLabel.Image  = currentTab == AppTab.Settings ? Properties.Resources.settings_icon_alt : Properties.Resources.settings_icon;
            }
            else if (theme == AppTheme.Monolith)
            {
                HardDriveLabel.Image = currentTab == AppTab.HardDrive ? Properties.Resources.hard_drive_icon : Properties.Resources.hard_drive_icon_alt;
                PlayLabel.Image      = currentTab == AppTab.Player ? Properties.Resources.play_icon : Properties.Resources.play_icon_alt;
                OnlineLabel.Image    = currentTab == AppTab.Online ? Properties.Resources.online_icon : Properties.Resources.online_icon_alt;
                SettingsLabel.Image  = currentTab == AppTab.Settings ? Properties.Resources.settings_icon : Properties.Resources.settings_icon_alt;
            }

            HardDriveLabel.BackColor = PlayLabel.BackColor = OnlineLabel.BackColor = SettingsLabel.BackColor = Color.Transparent;
            switch (currentTab)
            {
            case AppTab.HardDrive:
                HardDriveLabel.BackColor = Properties.Settings.Default.AppColourHighlight;
                TitleLabel.Text          = "Drive";
                break;

            case AppTab.Player:
                PlayLabel.BackColor = Properties.Settings.Default.AppColourHighlight;
                break;

            case AppTab.Online:
                OnlineLabel.BackColor = Properties.Settings.Default.AppColourHighlight;
                TitleLabel.Text       = "Online";
                break;

            case AppTab.Settings:
                SettingsLabel.BackColor = Properties.Settings.Default.AppColourHighlight;
                break;
            }
        }
Example #5
0
        private void SettingsLabel_Click(object sender, EventArgs e)
        {
            MainDriveTextbox.Text = Properties.Settings.Default.MainDrivePath;
            Shortcut1Textbox.Text = Properties.Settings.Default.Shortcut1Path;
            Shortcut2Textbox.Text = Properties.Settings.Default.Shortcut2Path;

            currentTab = AppTab.Settings;
            AppDesignProvider.SetCurrentTab(this, (AppTheme)Properties.Settings.Default.ThemeIndex, currentTab);

            AppDesignProvider.SetThemeLabelFont(this, (AppTheme)Properties.Settings.Default.ThemeIndex);

            ShowsLayout.Visible    = PlayerLayout.Visible = ErrorLabel.Visible = RefreshLabel.Visible = false;
            SettingsLayout.Visible = SaveSettingsPanel.Visible = true;
        }
Example #6
0
        private void OnLoaded(object sender, RoutedEventArgs e)
        {
            try
            {
                var uiConfig = SkinLib.UIHandler.Current.UIConfiguration;

                if (uiConfig == null)
                    return;

                var fileName = uiConfig.FileName;

                if (String.IsNullOrWhiteSpace(fileName))
                    return;

                XmlDocument configuration = new XmlDocument();
                configuration.Load(fileName);

                var node = configuration.SelectSingleNode(@"Configuration/Tabs");

                if (node != null)
                {
                    List<AppTab> tabs = new List<AppTab>();
                    foreach (XmlNode child in node.ChildNodes)
                    {
                        var appTab = new AppTab() { ProcessConfig = new ProcessConfig() };

                        var tabNode = child.ChildNodes[0];
                        var configNode = child.ChildNodes[1];

                        appTab.DisplayName = tabNode.FirstChild.Value;

                        if (configNode.HasChildNodes)
                        {
                            if (configNode["FileName"] != null)
                                appTab.ProcessConfig.FileName = configNode["FileName"].FirstChild.Value;
                            if (configNode["Arguments"] != null)
                                appTab.ProcessConfig.Arguments = configNode["Arguments"].FirstChild.Value;
                            if (configNode["WorkingDirectory"] != null)
                                appTab.ProcessConfig.WorkingDirectory = configNode["WorkingDirectory"].FirstChild.Value;
                        }

                        tabs.Add(appTab);
                    }

                    tabs.ForEach(x =>
                        {
                            var newTab = new TabItem();
                            newTab.PreviewMouseUp += (s, ea) =>
                            {
                                var appTab = (ea.Source as FrameworkElement).DataContext as AppTab;
                                if (appTab != null)
                                {
                                    ea.Handled = true;
                                    try
                                    {
                                        var processFileName = appTab.ProcessConfig.FileName;
                                        var arguments = appTab.ProcessConfig.Arguments;
                                        var workingDirectory = appTab.ProcessConfig.WorkingDirectory;

                                        ProcessStartInfo si = new ProcessStartInfo();
                                        si.FileName = !String.IsNullOrWhiteSpace(processFileName) ? Environment.ExpandEnvironmentVariables(processFileName) : processFileName;
                                        si.Arguments = !String.IsNullOrWhiteSpace(arguments) ? Environment.ExpandEnvironmentVariables(arguments) : arguments;
                                        si.WorkingDirectory = !String.IsNullOrWhiteSpace(workingDirectory) ? Environment.ExpandEnvironmentVariables(workingDirectory) : workingDirectory;
                                        Process.Start(si);
                                    }
                                    catch
                                    { }
                                }
                            };

                            newTab.PreviewKeyDown += (s, ea) => { ea.Handled = true; };
                            newTab.PreviewMouseDown += (s, ea) => { ea.Handled = true; };
                            newTab.DataContext = x;
                            newTab.Focusable = false;
                            newTab.Header = x.DisplayName;
                            this.SelectionTab.Items.Add(newTab);
                        });
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.ToString(), "Error", MessageBoxButton.OK, MessageBoxImage.Error);
            }
        }
 public UpdateTabAction(AppTab appTab)
 {
     NewTab = appTab;
 }