private void btnRefreshList_Click(object sender, RoutedEventArgs e) { Binding myBinding = new Binding("RefreshingServers"); myBinding.Source = this.DataContext; btnRefreshList.SetBinding(Button.ContentProperty, myBinding); btnRefreshList.IsEnabled = false; ServiceMaker myServiceMaker = new ServiceMaker(); LauncherData.LauncherDataClient myClient = myServiceMaker.GetServiceClient(); myClient.BeginGetServers(new AsyncCallback(GetServersCompleted), myClient); }
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); }
/// <summary> /// Asynnchronously checks the files and compares them against the set of standard MD5 checksums /// </summary> /// <param name="theServerInfo">ServerInfo onject of the server to patch for</param> public void PatchClient(ServerInfo theServerInfo) { //cache the ol' server info cachedServerInfo = theServerInfo; if (string.IsNullOrEmpty(SWGANHPAth)) { return; } //get a list of the custom TRE's ServiceMaker myServiceMaker = new ServiceMaker(); LauncherData.LauncherDataClient myClient = myServiceMaker.GetServiceClient(); CustomeTreCallObject theObject = new CustomeTreCallObject { TheClient = myClient, Server = theServerInfo }; myClient.BeginGetCustomTre(theServerInfo.ServerId, new AsyncCallback(FinishedGettingTRE), theObject); if (PatchStepFired != null) { PatchStepFired(this, new PatchingEventArgs(myVariables.GettingCustomTre, true)); } }