ClientLauncher.UISettings.SetNewPallette C# (CSharp) Method

SetNewPallette() public method

public SetNewPallette ( Pallette thePallette ) : void
thePallette Pallette
return void
        public void SetNewPallette(Pallette thePallette)
        {
            ColorConverter cv = new ColorConverter();
            App.Current.Resources["LightFill"] = new SolidColorBrush((Color)cv.ConvertFrom(thePallette.LightFill));
            App.Current.Resources["DarkText"] = new SolidColorBrush((Color)cv.ConvertFrom(thePallette.DarkText));
            App.Current.Resources["DarkFill"] = new SolidColorBrush((Color)cv.ConvertFrom(thePallette.DarkFill));
            App.Current.Resources["TitleArea"] = new SolidColorBrush((Color)cv.ConvertFrom(thePallette.TitleArea));
            App.Current.Resources["MouseOver"] = new SolidColorBrush((Color)cv.ConvertFrom(thePallette.MouseOver));
            App.Current.Resources["ControlArea"] = new SolidColorBrush((Color)cv.ConvertFrom(thePallette.ControlArea));
            App.Current.Resources["TitleText"] = new SolidColorBrush((Color)cv.ConvertFrom(thePallette.TitleText));
            App.Current.Resources["StatusArea"] = new SolidColorBrush((Color)cv.ConvertFrom(thePallette.StatusArea));
            GradientStopCollection dark = new GradientStopCollection();
            dark.Add(new GradientStop
            {
                Color = (Color)cv.ConvertFrom(thePallette.DarkAreaFill[0]),
                Offset = 0
            });
            dark.Add(new GradientStop
            {
                Color = (Color)cv.ConvertFrom(thePallette.DarkAreaFill[1]),
                Offset = 1
            });
            GradientStopCollection light = new GradientStopCollection();
            light.Add(new GradientStop
            {
                Color = (Color)cv.ConvertFrom(thePallette.LightAreaFill[0]),
                Offset = 0
            });
            light.Add(new GradientStop
            {
                Color = (Color)cv.ConvertFrom(thePallette.LightAreaFill[1]),
                Offset = 1
            });

            App.Current.Resources["DarkAreaFill"] = new RadialGradientBrush(dark);
            App.Current.Resources["LightAreaFill"] = new RadialGradientBrush(light);
        }

Same methods

UISettings::SetNewPallette ( string strPalletteName ) : void

Usage Example

        void MainWindow_Loaded(object sender, RoutedEventArgs e)
        {
            ResetSettings();

            mySettings.SetNewPallette(myUserPrefs.CurrentPallette);
            mySettings.SetGhostFont(myUserPrefs.CurrentGhostFont.Name);

            if (lstLatestVersions.Count > 0)
            {
                //combine the patch notes
                string strPatchNotes = "";
                foreach (LauncherData.LauncherVersion theVersion in lstLatestVersions)
                {
                    strPatchNotes += theVersion.VersionNumber + " (" + theVersion.DateCreated.ToString("yyyy-MM-dd HH:mm:ss") + ")" + Environment.NewLine;
                    strPatchNotes += theVersion.PatchNotes + Environment.NewLine + Environment.NewLine;
                }

                this.Dispatcher.BeginInvoke(new System.Windows.Forms.MethodInvoker(delegate()
                {
                    lblMessage.Text          = myLocales.CurrentLocale.DownloadingUpdateOne + Environment.NewLine + myLocales.CurrentLocale.DownloadingUpdateTwo;
                    lblMessage.Text         += Environment.NewLine + Environment.NewLine + strPatchNotes;
                    brdMessageBox.Visibility = Visibility.Visible;

                    messageboxOK.Visibility                  = Visibility.Collapsed;
                    ServiceMaker myServiceMaker              = new ServiceMaker();
                    ApplicationUpdates myApplicationUpdates  = new ApplicationUpdates(myServiceMaker.GetServiceClient());
                    myApplicationUpdates.OnDownloadProgress += new EventHandler <ApplicationUpdates.DownloadProgressEventArgs>(myApplicationUpdates_OnDownloadProgress);
                    myApplicationUpdates.OnDownloadComplete += new EventHandler <ApplicationUpdates.DownloadCompleteEventArgs>(myApplicationUpdates_OnDownloadComplete);
                    myApplicationUpdates.UpdateToLatestVersion(this.Dispatcher, lstLatestVersions.First());
                    prgDownload.Visibility = Visibility.Visible;
                    prgDownload.Maximum    = lstLatestVersions.First().FileSize;
                    prgDownload.Value      = 0;
                }), System.Windows.Threading.DispatcherPriority.Normal);
            }
            else
            {
                if ((myUserPrefs.DefaultServer != Guid.Empty) && (myUserPrefs.DefaultServerInformation != null))
                {
                    //chek the game launcher, by default
                    scGameLauncher.IsChecked = true;
                }
                else
                {
                    scChooseGalaxy.IsChecked = true;
                }
            }
        }