Example #1
0
 private async void StreamerLoginButton_Click(object sender, RoutedEventArgs e)
 {
     await this.RunAsyncOperation(async() =>
     {
         if (this.ExistingStreamerComboBox.SelectedIndex >= 0)
         {
             SettingsV3Model setting = (SettingsV3Model)this.ExistingStreamerComboBox.SelectedItem;
             if (setting.ID != Guid.Empty)
             {
                 if (await this.ExistingSettingLogin(setting))
                 {
                     LoadingWindowBase newWindow = null;
                     if (ChannelSession.Settings.ReRunWizard)
                     {
                         newWindow = new NewUserWizardWindow();
                     }
                     else
                     {
                         newWindow = new MainWindow();
                     }
                     ShowMainWindow(newWindow);
                     this.Hide();
                     this.Close();
                     return;
                 }
             }
         }
         else
         {
             await DialogHelper.ShowMessage(MixItUp.Base.Resources.LoginErrorNoStreamerAccount);
         }
     });
 }
Example #2
0
        protected override async Task OnLoaded()
        {
            GlobalEvents.OnShowMessageBox += GlobalEvents_OnShowMessageBox;

            this.Title += " - v" + Assembly.GetEntryAssembly().GetName().Version.ToString();

            this.ExistingStreamerComboBox.ItemsSource = streamerSettings;

            await this.CheckForUpdates();

            foreach (SettingsV3Model setting in (await ChannelSession.Services.Settings.GetAllSettings()).OrderBy(s => s.Name))
            {
                this.streamerSettings.Add(setting);
            }

            if (this.streamerSettings.Count > 0)
            {
                this.ExistingStreamerComboBox.Visibility = Visibility.Visible;
                this.StreamerLoginButton.IsEnabled       = true;
                if (this.streamerSettings.Count == 1)
                {
                    this.ExistingStreamerComboBox.SelectedIndex = 0;
                }
            }

            if (ChannelSession.AppSettings.AutoLogInID != Guid.Empty)
            {
                var             allSettings       = this.streamerSettings.ToList();
                SettingsV3Model autoLogInSettings = allSettings.FirstOrDefault(s => s.ID == ChannelSession.AppSettings.AutoLogInID);
                if (autoLogInSettings != null)
                {
                    await Task.Delay(5000);

                    if (!updateFound)
                    {
                        if (await this.ExistingSettingLogin(autoLogInSettings))
                        {
                            LoadingWindowBase newWindow = null;
                            if (ChannelSession.Settings.ReRunWizard)
                            {
                                newWindow = new NewUserWizardWindow();
                            }
                            else
                            {
                                newWindow = new MainWindow();
                            }
                            ShowMainWindow(newWindow);
                            this.Hide();
                            this.Close();
                            return;
                        }
                    }
                }
            }

            await base.OnLoaded();
        }
 private async void ReRunWizardSettingsButton_Click(object sender, RoutedEventArgs e)
 {
     if (await MessageBoxHelper.ShowConfirmationDialog("This will re-run the New User Wizard and allow you to re-import your data, which could duplicate and overwrite your Commands & User data. Are you sure you wish to do this?"))
     {
         NewUserWizardWindow window = new NewUserWizardWindow();
         window.Show();
         this.Window.Close();
     }
 }
 private async Task <bool> NewStreamerLogin()
 {
     if (await this.EstablishConnection(ChannelSession.StreamerScopes, channelName: null))
     {
         NewUserWizardWindow window = new NewUserWizardWindow();
         window.Show();
         this.Close();
         return(true);
     }
     return(false);
 }
Example #5
0
        private async void StreamerLoginButton_Click(object sender, RoutedEventArgs e)
        {
            bool result = false;

            await this.RunAsyncOperation(async() =>
            {
                if (this.ExistingStreamerComboBox.Visibility == Visibility.Visible)
                {
                    if (this.ExistingStreamerComboBox.SelectedIndex >= 0)
                    {
                        IChannelSettings setting = (IChannelSettings)this.ExistingStreamerComboBox.SelectedItem;
                        if (setting.Channel.id == 0)
                        {
                            if (await this.ShowLicenseAgreement())
                            {
                                result = await this.NewStreamerLogin();
                            }
                        }
                        else
                        {
                            if (await this.ExistingSettingLogin(setting))
                            {
                                LoadingWindowBase newWindow = null;
                                if (ChannelSession.Settings.ReRunWizard)
                                {
                                    newWindow = new NewUserWizardWindow();
                                }
                                else
                                {
                                    newWindow = new MainWindow();
                                }
                                ShowMainWindow(newWindow);
                                this.Hide();
                                this.Close();
                                return;
                            }
                        }
                    }
                    else
                    {
                        await MessageBoxHelper.ShowMessageDialog("You must select a Streamer account to log in to");
                    }
                }
                else
                {
                    if (await this.ShowLicenseAgreement())
                    {
                        result = await this.NewStreamerLogin();
                    }
                }
            });
        }
Example #6
0
        protected override async Task OnLoaded()
        {
            GlobalEvents.OnShowMessageBox += GlobalEvents_OnShowMessageBox;

            this.Title += " - v" + Assembly.GetEntryAssembly().GetName().Version.ToString();

            this.ExistingStreamerComboBox.ItemsSource = streamerSettings;
            this.ModeratorChannelComboBox.ItemsSource = moderatorSettings;

            if (Environment.OSVersion.Version < minimumOSVersion)
            {
                await MessageBoxHelper.ShowMessageDialog("Thank you for using Mix It Up, but unfortunately we only support Windows 8 & higher. If you are running Windows 8 or higher and see this message, please contact Mix It Up support for assistance.");

                this.Close();
                return;
            }

            if (!App.AppSettings.InstallerFolderUpgradeAsked)
            {
                App.AppSettings.InstallerFolderUpgradeAsked = true;
                App.AppSettings.Save();

                string currentInstallDirectory = ChannelSession.Services.FileService.GetApplicationDirectory();
                if (!Logger.IsDebug && !currentInstallDirectory.Equals(InstallerHelpers.InstallDirectory))
                {
                    if (await MessageBoxHelper.ShowConfirmationDialog("We noticed you are not running Mix It Up from the default installation folder." +
                                                                      " We now have a full installer that puts Mix It Up into your Local App Data folder and creates a Start Menu shortcut for you to easily launch it." +
                                                                      Environment.NewLine + Environment.NewLine +
                                                                      "We can install the latest version of Mix It Up with the Start Menu shortcut, copy over your current settings over there for you, and keep this version of Mix It Up as is for backup purposes." +
                                                                      Environment.NewLine + Environment.NewLine +
                                                                      "The process should take no more than a miunute; would you like us to do this for you?"))
                    {
                        bool installationSuccessful = await Task.Run(() =>
                        {
                            try
                            {
                                return(InstallerHelpers.DownloadMixItUp() && InstallerHelpers.InstallMixItUp() && InstallerHelpers.CreateMixItUpShortcut());
                            }
                            catch (Exception ex) { Logger.Log(ex); }
                            return(false);
                        });

                        if (installationSuccessful)
                        {
                            await ChannelSession.Services.FileService.CopyDirectory(Path.Combine(currentInstallDirectory, "Settings"),
                                                                                    Path.Combine(InstallerHelpers.InstallDirectory, "Settings"));

                            await ChannelSession.Services.FileService.CopyDirectory(Path.Combine(currentInstallDirectory, "Counters"),
                                                                                    Path.Combine(InstallerHelpers.InstallDirectory, "Counters"));

                            await MessageBoxHelper.ShowMessageDialog("Mix It Up was successfully installed to your Local App Data folder and a shortcut was created on the Start Menu." +
                                                                     " We will now close this version of Mix It Up and launch your newly installed version.");

                            Process.Start(Path.Combine(InstallerHelpers.StartMenuDirectory, InstallerHelpers.ShortcutFileName));
                            this.Close();
                            return;
                        }
                        else
                        {
                            await MessageBoxHelper.ShowMessageDialog("The installation failed for an unknown reason");
                        }
                    }
                }
            }

            await this.CheckForUpdates();

            foreach (IChannelSettings setting in (await ChannelSession.Services.Settings.GetAllSettings()).OrderBy(s => s.Channel.user.username))
            {
                if (setting.IsStreamer)
                {
                    this.streamerSettings.Add(setting);
                }
                else
                {
                    this.moderatorSettings.Add(setting);
                }
            }

            if (this.streamerSettings.Count > 0)
            {
                this.ExistingStreamerComboBox.Visibility = Visibility.Visible;
                this.streamerSettings.Add(new DesktopChannelSettings()
                {
                    Channel = new ExpandedChannelModel()
                    {
                        id = 0, user = new UserModel()
                        {
                            username = "******"
                        }
                    }
                });
                if (this.streamerSettings.Count() == 2)
                {
                    this.ExistingStreamerComboBox.SelectedIndex = 0;
                }
            }

            if (this.moderatorSettings.Count == 1)
            {
                this.ModeratorChannelComboBox.SelectedIndex = 0;
            }

            if (App.AppSettings.AutoLogInAccount > 0)
            {
                var allSettings = this.streamerSettings.ToList();
                allSettings.AddRange(this.moderatorSettings);

                IChannelSettings autoLogInSettings = allSettings.FirstOrDefault(s => s.Channel.user.id == App.AppSettings.AutoLogInAccount);
                if (autoLogInSettings != null && autoLogInSettings.LicenseAccepted)
                {
                    await Task.Delay(5000);

                    if (!updateFound)
                    {
                        if (await this.ExistingSettingLogin(autoLogInSettings))
                        {
                            LoadingWindowBase newWindow = null;
                            if (ChannelSession.Settings.ReRunWizard)
                            {
                                newWindow = new NewUserWizardWindow();
                            }
                            else
                            {
                                newWindow = new MainWindow();
                            }
                            ShowMainWindow(newWindow);
                            this.Hide();
                            this.Close();
                            return;
                        }
                    }
                }
            }

            await base.OnLoaded();
        }
Example #7
0
        protected override async Task OnLoaded()
        {
            GlobalEvents.OnShowMessageBox += GlobalEvents_OnShowMessageBox;

            this.Title += " - v" + Assembly.GetEntryAssembly().GetName().Version.ToString();

            this.ExistingStreamerComboBox.ItemsSource = streamerSettings;
            this.ModeratorChannelComboBox.ItemsSource = moderatorSettings;

            await this.CheckForUpdates();

            foreach (IChannelSettings setting in (await ChannelSession.Services.Settings.GetAllSettings()).OrderBy(s => s.Channel.token))
            {
                if (setting.IsStreamer)
                {
                    this.streamerSettings.Add(setting);
                }
                else
                {
                    this.moderatorSettings.Add(setting);
                }
            }

            if (this.streamerSettings.Count > 0)
            {
                this.ExistingStreamerComboBox.Visibility = Visibility.Visible;
                this.streamerSettings.Add(new DesktopChannelSettings()
                {
                    Channel = new ExpandedChannelModel()
                    {
                        id = 0, user = new UserModel()
                        {
                            username = "******"
                        }, token = "NEW STREAMER"
                    }
                });
                if (this.streamerSettings.Count() == 2)
                {
                    this.ExistingStreamerComboBox.SelectedIndex = 0;
                }
            }

            if (this.moderatorSettings.Count == 1)
            {
                this.ModeratorChannelComboBox.SelectedIndex = 0;
            }

            if (App.AppSettings.AutoLogInAccount > 0)
            {
                var allSettings = this.streamerSettings.ToList();
                allSettings.AddRange(this.moderatorSettings);

                IChannelSettings autoLogInSettings = allSettings.FirstOrDefault(s => s.Channel.user.id == App.AppSettings.AutoLogInAccount);
                if (autoLogInSettings != null && autoLogInSettings.LicenseAccepted)
                {
                    await Task.Delay(5000);

                    if (!updateFound)
                    {
                        if (await this.ExistingSettingLogin(autoLogInSettings))
                        {
                            LoadingWindowBase newWindow = null;
                            if (ChannelSession.Settings.ReRunWizard)
                            {
                                newWindow = new NewUserWizardWindow();
                            }
                            else
                            {
                                newWindow = new MainWindow();
                            }
                            ShowMainWindow(newWindow);
                            this.Hide();
                            this.Close();
                            return;
                        }
                    }
                }
            }

            await base.OnLoaded();
        }