Esempio n. 1
0
        /// <summary>
        /// Updates the presence from the app settings.
        /// </summary>
        public static void UpdateFromSettings()
        {
            if (!RichPresenceHelper.IsInitialized)
            {
                RichPresenceHelper.Initialize(Properties.Settings.Default.AppId);
            }

            if (RichPresenceHelper.IsInitialized)
            {
                RichPresenceHelper.Update(new RichPresence()
                {
                    Details    = Properties.Settings.Default.GameDetails,
                    State      = Properties.Settings.Default.GameState,
                    Timestamps = new Timestamps()
                    {
                        Start = Properties.Settings.Default.StartTimestamp == 0 ? null : (RichPresenceViewModel.GetDateTime(Properties.Settings.Default.StartTimestamp)),
                        End   = Properties.Settings.Default.EndTimestamp == 0 ? null : (RichPresenceViewModel.GetDateTime(Properties.Settings.Default.EndTimestamp)),
                    },
                    Assets = new Assets()
                    {
                        LargeImageKey  = Properties.Settings.Default.LargeImageKey ?? null,
                        LargeImageText = Properties.Settings.Default.LargeImageText ?? null,
                        SmallImageKey  = Properties.Settings.Default.SmallImageKey ?? null,
                        SmallImageText = Properties.Settings.Default.SmallImageText ?? null,
                    }
                });
            }
        }
Esempio n. 2
0
 /// <summary>
 /// Handles the startup of the app.
 /// </summary>
 private void AppStart(object sender, StartupEventArgs e)
 {
     RichPresenceHelper.Initialize(DiscordPresenceUI.Properties.Settings.Default.AppId);
     RichPresenceHelper.UpdateFromSettings();
     SettingsHelper.SetLocale();
     SettingsHelper.CheckForInstances();
     SettingsHelper.SetStartupSettings();
     SettingsHelper.SetTheme();
     TaskbarIconHelper.InitializeTaskbarIcon();
 }