示例#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);
         }
     });
 }
 public async Task Initialize(LoadingWindowBase window)
 {
     this.Window = window;
     await this.Window.RunAsyncOperation(async() =>
     {
         await this.InitializeInternal();
         await this.OnVisibilityChanged();
     });
 }
示例#3
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();
        }
示例#4
0
        public ServicesGroupBoxControl(LoadingWindowBase window, ServicesControlBase serviceControl)
        {
            this.window         = window;
            this.serviceControl = serviceControl;
            this.serviceControl.Initialize(this);

            InitializeComponent();

            this.InnerContentControl.Content = serviceControl;
        }
示例#5
0
        public ServiceContainerControl(LoadingWindowBase window, ServiceControlBase serviceControl)
        {
            this.window         = window;
            this.serviceControl = serviceControl;
            this.serviceControl.Initialize(this);
            this.DataContext = this.serviceControl.ViewModel;

            InitializeComponent();

            this.InnerContentControl.Content = serviceControl;
        }
 private static DialogHost GetDialogHost(LoadingWindowBase window)
 {
     if (window != null)
     {
         object obj = window.FindName("MDDialogHost");
         if (obj != null)
         {
             return((DialogHost)obj);
         }
     }
     return(null);
 }
示例#7
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();
                    }
                }
            });
        }
示例#8
0
        public void Initialize(LoadingWindowBase window, PreMadeChatCommand command)
        {
            this.window      = window;
            this.DataContext = this.command = command;
            this.PermissionsComboBox.SelectedItem = this.command.PermissionsString;

            this.setting = ChannelSession.Settings.PreMadeChatCommandSettings.FirstOrDefault(c => c.Name.Equals(this.command.Name));
            if (this.setting == null)
            {
                this.setting = new PreMadeChatCommandSettings(this.command);
                ChannelSession.Settings.PreMadeChatCommandSettings.Add(this.setting);
            }
        }
示例#9
0
        public void Initialize(LoadingWindowBase window, PreMadeChatCommand command)
        {
            this.window      = window;
            this.DataContext = this.command = command;

            this.PermissionsComboBox.SelectedItem = this.command.UserRoleRequirementString;
            this.CooldownTextBox.Text             = this.command.Requirements.Cooldown.Amount.ToString();

            this.setting = ChannelSession.Settings.PreMadeChatCommandSettings.FirstOrDefault(c => c.Name.Equals(this.command.Name));
            if (this.setting == null)
            {
                this.setting = new PreMadeChatCommandSettings(this.command);
                ChannelSession.Settings.PreMadeChatCommandSettings.Add(this.setting);
            }
        }
示例#10
0
 public async Task Initialize(LoadingWindowBase window)
 {
     this.Window = window;
     await this.InitializeInternal();
 }
 public static void SetLastActiveWindow(LoadingWindowBase window)
 {
     WPFDialogShower.lastActiveWindow = window;
 }
示例#12
0
 public static void SetLastActiveWindow(LoadingWindowBase window)
 {
     MessageBoxHelper.lastActiveWindow = window;
 }
示例#13
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();
        }
示例#14
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();
        }