Simple class to defin the settings from the skin XML file
        private void ResetSettings()
        {
            //Stop the animation
            sbFadeIn.Stop();
            sbFadeOut.Stop();

            //rest for to original values
            ResetForm();

            //make the setting obejct
            mySettings = new UISettings(myUserPrefs.CurrentSkin);

            List <string> lstPaths = mySettings.SetupMainForm(pthBorder, grdTitle, grdWindowControls, grdStatusBar, brdServerControls, null, formScale, brdMessageBox);

            if (lstPaths.Count > 0)
            {
                SetAnimation(lstPaths);
            }
        }
 public UserPreferences()
 {
     mySettings = new UISettings();
     LoadPreferences();
 }
Esempio n. 3
0
        private void InitiliseMyApp(Splash theSplashScreen)
        {
            //check for launcher updates first
            if (SectionStarted != null)
            {
                SectionStarted(this, new LoadingSectionStarted(LoadingType.Launcher));
            }
            UserPreferences myPrefs        = new UserPreferences();
            ServiceMaker    myServiceMaker = new ServiceMaker();

            LauncherData.LauncherDataClient myClient = myServiceMaker.GetServiceClient();

            ApplicationUpdates myApplicationUpdates = new ApplicationUpdates(myClient);

            List <LauncherData.LauncherVersion> lstLatestVersions = myApplicationUpdates.UpdateAvailable(this.Dispatcher);

            if (SectionLoaded != null)
            {
                SectionLoaded(this, new LoadingSectionCompleted(LoadingType.Launcher, lstLatestVersions.Count, ""));
            }

            //and skins
            if (SectionStarted != null)
            {
                SectionStarted(this, new LoadingSectionStarted(LoadingType.Skins));
            }
            UISettings mySettings = new UISettings();

            if (SectionLoaded != null)
            {
                SectionLoaded(this, new LoadingSectionCompleted(LoadingType.Skins, mySettings.GetAvailableSkins.Count, ""));
            }

            //and now the languages
            if (SectionStarted != null)
            {
                SectionStarted(this, new LoadingSectionStarted(LoadingType.Languages));
            }

            Locales myLocale = new Locales();

            if (SectionLoaded != null)
            {
                SectionLoaded(this, new LoadingSectionCompleted(LoadingType.Languages, myLocale.NumberLoaded, ""));
            }

            //finally, load the servers
            if (SectionStarted != null)
            {
                SectionStarted(this, new LoadingSectionStarted(LoadingType.Servers));
            }

            List <ServerInfo> lstServers = new List <ServerInfo>();


            try
            {
                List <LauncherData.ServerInfo> lstLiveServers = myClient.GetServers();



                var tmpServers = from ser in lstLiveServers
                                 select new ServerInfo
                {
                    Address      = ser.Address,
                    CharsCreated = ser.CharsCreated,
                    Description  = ser.Description,
                    LastUpdated  = ser.LastUpdated,
                    LauncherPort = ser.LauncherPort,
                    Population   = ser.Population,
                    Port         = ser.Port,
                    RSSFeedUrl   = ser.RSSFeedUrl,
                    ServerId     = ser.ServerId,
                    ServerName   = ser.ServerName
                };
                //update the preferecnes
                myPrefs.UpdateSettings(UserPreferences.SettingsType.CachedServers, tmpServers.ToList());
            }
            catch
            {
                //don't update the cached ones
            }

            if (SectionLoaded != null)
            {
                SectionLoaded(this, new LoadingSectionCompleted(LoadingType.Servers, lstServers.Count, ""));
            }

            //and get the list of standard TRE files
            try
            {
                List <LauncherData.StandardTre> lstLiveStandardTres = myClient.GetStandardTre();
                var tmpStandard = from stre in lstLiveStandardTres
                                  select new StandardTre
                {
                    Filename = stre.Filename,
                    MD5Hash  = stre.MD5Hash
                };

                myPrefs.UpdateSettings(UserPreferences.SettingsType.StandardTres, tmpStandard.ToList());
            }
            catch
            {
            }

            Dispatcher.BeginInvoke(new System.Windows.Forms.MethodInvoker(delegate()
            {
                MainWindow = new MainWindow(lstLatestVersions);
                MainWindow.Show();
            }), System.Windows.Threading.DispatcherPriority.Normal);
        }
        private void InitiliseMyApp(Splash theSplashScreen)
        {
            //check for launcher updates first
            if (SectionStarted != null)
            {
                SectionStarted(this, new LoadingSectionStarted(LoadingType.Launcher));
            }
            UserPreferences myPrefs = new UserPreferences();
            ServiceMaker myServiceMaker = new ServiceMaker();
            LauncherData.LauncherDataClient myClient = myServiceMaker.GetServiceClient();

            ApplicationUpdates myApplicationUpdates = new ApplicationUpdates(myClient);

            List<LauncherData.LauncherVersion> lstLatestVersions = myApplicationUpdates.UpdateAvailable(this.Dispatcher);

            if (SectionLoaded != null)
            {
                SectionLoaded(this, new LoadingSectionCompleted(LoadingType.Launcher, lstLatestVersions.Count, ""));
            }

            //and skins
            if (SectionStarted != null)
            {
                SectionStarted(this, new LoadingSectionStarted(LoadingType.Skins));
            }
            UISettings mySettings = new UISettings();

            if (SectionLoaded != null)
            {
                SectionLoaded(this, new LoadingSectionCompleted(LoadingType.Skins, mySettings.GetAvailableSkins.Count, ""));
            }

            //and now the languages
            if (SectionStarted != null)
            {
                SectionStarted(this, new LoadingSectionStarted(LoadingType.Languages));
            }

            Locales myLocale = new Locales();

            if (SectionLoaded != null)
            {
                SectionLoaded(this, new LoadingSectionCompleted(LoadingType.Languages, myLocale.NumberLoaded, ""));
            }

            //finally, load the servers
            if (SectionStarted != null)
            {
                SectionStarted(this, new LoadingSectionStarted(LoadingType.Servers));
            }

            List<ServerInfo> lstServers = new List<ServerInfo>();

            try
            {
                List<LauncherData.ServerInfo> lstLiveServers = myClient.GetServers();

                var tmpServers = from ser in lstLiveServers
                                 select new ServerInfo
                                 {
                                     Address = ser.Address,
                                     CharsCreated = ser.CharsCreated,
                                     Description = ser.Description,
                                     LastUpdated = ser.LastUpdated,
                                     LauncherPort = ser.LauncherPort,
                                     Population = ser.Population,
                                     Port = ser.Port,
                                     RSSFeedUrl = ser.RSSFeedUrl,
                                     ServerId = ser.ServerId,
                                     ServerName = ser.ServerName
                                 };
                //update the preferecnes
                myPrefs.UpdateSettings(UserPreferences.SettingsType.CachedServers, tmpServers.ToList());
            }
            catch
            {
                //don't update the cached ones
            }

            if (SectionLoaded != null)
            {
                SectionLoaded(this, new LoadingSectionCompleted(LoadingType.Servers, lstServers.Count, ""));
            }

            //and get the list of standard TRE files
            try
            {

                List<LauncherData.StandardTre> lstLiveStandardTres = myClient.GetStandardTre();
                var tmpStandard = from stre in lstLiveStandardTres
                                  select new StandardTre
                                  {
                                      Filename = stre.Filename,
                                      MD5Hash = stre.MD5Hash
                                  };

                myPrefs.UpdateSettings(UserPreferences.SettingsType.StandardTres, tmpStandard.ToList());

            }
            catch
            {

            }

            Dispatcher.BeginInvoke(new System.Windows.Forms.MethodInvoker(delegate()
            {
                MainWindow = new MainWindow(lstLatestVersions);
                MainWindow.Show();
            }), System.Windows.Threading.DispatcherPriority.Normal);
        }
Esempio n. 5
0
 public UserPreferences()
 {
     mySettings = new UISettings();
     LoadPreferences();
 }