Beispiel #1
0
        public MainWindow()
        {
            InitializeComponent();

            Globals.LogBox = LogBox;

            _lastFocusedTextBox = PlayingTopLineFormatTextBox;

            _bridge = new DiscordBridge("383816327850360843");

            _notifyIcon = new NotifyIcon {
                Text = "iTunesRichPresence", Visible = false, Icon = System.Drawing.Icon.ExtractAssociatedIcon(Assembly.GetExecutingAssembly().Location)
            };
            _notifyIcon.MouseDoubleClick += (sender, args) => { WindowState = WindowState.Normal; };

            ThemeComboBox.ItemsSource  = ThemeManager.Accents.Select(accent => accent.Name);
            ThemeComboBox.SelectedItem = Settings.Default.Accent;

            ThemeManager.ChangeAppStyle(Application.Current,
                                        ThemeManager.GetAccent(Settings.Default.Accent),
                                        ThemeManager.GetAppTheme("BaseLight"));

            RunOnStartupCheckBox.IsChecked      = Settings.Default.RunOnStartup;
            PlayingTopLineFormatTextBox.Text    = Settings.Default.PlayingTopLine;
            PlayingBottomLineFormatTextBox.Text = Settings.Default.PlayingBottomLine;
            PausedTopLineFormatTextBox.Text     = Settings.Default.PausedTopLine;
            PausedBottomLineFormatTextBox.Text  = Settings.Default.PausedBottomLine;
            PlaybackDurationCheckBox.IsChecked  = Settings.Default.DisplayPlaybackDuration;
            ExperimentsCheckBox.IsChecked       = Settings.Default.ExperimentsEnabled;
            ExperimentsButton.Visibility        =
                Settings.Default.ExperimentsEnabled ? Visibility.Visible : Visibility.Collapsed;

            var gitHubClient = new GitHubClient(new ProductHeaderValue("iTunesRichPresence"));

            _latestRelease = gitHubClient.Repository.Release.GetLatest("nint8835", "iTunesRichPresence").Result;
            if (!Assembly.GetExecutingAssembly().GetName().Version.ToString().StartsWith(_latestRelease.Name.Substring(1)))
            {
                UpdateButton.Visibility = Visibility.Visible;
            }

            PopulateToolbox();
        }
Beispiel #2
0
        public MainWindow()
        {
            InitializeComponent();

            Globals.LogBox = LogBox;

            _lastFocusedTextBox = PlayingTopLineFormatTextBox;

            _notifyIcon = new NotifyIcon {
                Text = "iTunesRichPresence", Visible = false, Icon = System.Drawing.Icon.ExtractAssociatedIcon(Assembly.GetExecutingAssembly().Location)
            };
            _notifyIcon.MouseDoubleClick += (sender, args) => {
                SetVisibility(true);
            };

            ThemeComboBox.ItemsSource  = ThemeManager.Accents.Select(accent => accent.Name);
            ThemeComboBox.SelectedItem = Settings.Default.Accent;

            ThemeManager.ChangeAppStyle(Application.Current,
                                        ThemeManager.GetAccent(Settings.Default.Accent),
                                        ThemeManager.GetAppTheme("BaseLight"));

            RunOnStartupCheckBox.IsChecked      = Settings.Default.RunOnStartup;
            PlayingTopLineFormatTextBox.Text    = Settings.Default.PlayingTopLine;
            PlayingBottomLineFormatTextBox.Text = Settings.Default.PlayingBottomLine;
            PausedTopLineFormatTextBox.Text     = Settings.Default.PausedTopLine;
            PausedBottomLineFormatTextBox.Text  = Settings.Default.PausedBottomLine;
            PlaybackDurationCheckBox.IsChecked  = Settings.Default.DisplayPlaybackDuration;
            ClearOnPauseCheckBox.IsChecked      = Settings.Default.ClearOnPause;
            ExperimentsCheckBox.IsChecked       = Settings.Default.ExperimentsEnabled;
            MinimizeOnStartupCheckBox.IsChecked = Settings.Default.MinimizeOnStartup;
            ExperimentsButton.Visibility        =
                Settings.Default.ExperimentsEnabled ? Visibility.Visible : Visibility.Collapsed;

            AppNameComboBox.Items.Add("iTunes");
            AppNameComboBox.Items.Add("Apple Music");
            try {
                CreateBridge();
            }
            catch (COMException) {
                _bridge = null;
            }



            AppNameComboBox.SelectedItem = Settings.Default.AppName;

            try {
                var gitHubClient = new GitHubClient(new ProductHeaderValue("iTunesRichPresence"));
                _latestRelease = gitHubClient.Repository.Release.GetLatest("nint8835", "iTunesRichPresence").Result;
                if (!Assembly.GetExecutingAssembly().GetName().Version.ToString().StartsWith(_latestRelease.Name.Substring(1)))
                {
                    UpdateButton.Visibility = Visibility.Visible;
                }
            }
            catch {
                // Occurs when it fails to check for updates, so we can safely ignore it
            }


#if DEBUG
            PatreonEmailLabel.Visibility   = Visibility.Visible;
            PatreonEmailTextBox.Visibility = Visibility.Visible;
            PatreonStatusLabel.Visibility  = Visibility.Visible;
            AlbumArtCheckBox.Visibility    = Visibility.Visible;
#else
            PatreonEmailLabel.Visibility   = Visibility.Hidden;
            PatreonEmailTextBox.Visibility = Visibility.Hidden;
            PatreonStatusLabel.Visibility  = Visibility.Hidden;
            AlbumArtCheckBox.Visibility    = Visibility.Hidden;
#endif

            PopulateToolbox();

            if (Settings.Default.MinimizeOnStartup)
            {
                SetVisibility(false);
            }
        }
Beispiel #3
0
 private void CreateBridge()
 {
     _bridge?.Shutdown();
     _bridge = (string)AppNameComboBox.SelectedItem == "iTunes" ? new DiscordBridge("764108100436361247") : new DiscordBridge("529435150472183819");
 }
 private void CreateBridge()
 {
     _bridge?.Shutdown();
     _bridge = (string)AppNameComboBox.SelectedItem == "ON" ? new DiscordBridge("787380729268273202") : new DiscordBridge("529435150472183819");
 }
 private void CreateBridge()
 {
     _bridge?.Shutdown();
     _bridge = (string)AppNameComboBox.SelectedItem == "iTunes" ? new DiscordBridge("383816327850360843") : new DiscordBridge("529435150472183819");
 }