/* private void Button_Click(object sender, RoutedEventArgs e) { LoadPlanFile(); } */ #if HAW_NATIVE private void LoadPlanFile() { var tWrk = new BackgroundWorker(); tWrk.DoWork += (tWrkSender, tWrkE) => { Status = "Lade Stundenplan. Dauert 'nen Augenblick."; Progress = true; PlanFile.Initialize(); string[] urls; if (LittleHelpers.Helper.HasInternetConnection) { urls = new HAWClient().Schedules(); new Settings().ScheduleFiles = String.Join(" ", urls); } else { urls = new Settings().ScheduleFiles.Split(' '); } foreach (var tURL in urls) { try { if (tURL != String.Empty && Uri.IsWellFormedUriString(tURL, UriKind.Absolute)) { Status = "Lade URL: " + tURL; PlanFile.LoadTxt(new Uri(tURL)); } else { MessageBox.Show(String.Format("URL {0} ist nicht gültig", tURL)); } } catch { MessageBox.Show(String.Format("Ein Fehler trat beim Parsen der URL {0} auf", tURL)); tWrkE.Cancel = true; } } // PlanFile.LoadGoogle(); PlanFile.Instance.LoadComplete(); }; tWrk.RunWorkerCompleted += (tWrkSender, tWrkE) => { if (!tWrkE.Cancelled) { Progress = false; Status = "Fertig!"; DataContext = PlanFile.Instance; } }; tWrk.RunWorkerAsync(); }
private void LoadPlanFile() { DataContext = PlanFile.Instance; var semGroupsCvs = (CollectionViewSource)FindResource("seminarGroupsCollectionView"); var cnt = new HAWClient(); var schedules = cnt.Schedules(); // Parallel.ForEach(schedules, (schedule) => PlanFile.Instance.LoadSchedule(schedule)); PlanFile.Instance.LoadSchedules(schedules); PlanFile.Instance.AllSchedulesLoaded += (x, y) => PlanFile.Instance.LoadCouchEvents(); }
private void LoadSettings() { var tWrk = new BackgroundWorker(); tWrk.DoWork += (x, y) => { try { string tVerStr = new HAWClient().Version(); if (tVerStr == null) return; var tVer = new Version(tVerStr); var tMe = Assembly.GetExecutingAssembly().GetName().Version; if (tMe.IsNewerThan(tVer)) { Dispatcher.Invoke(new Action(() => new NewVersionNotify().ShowDialog())); } } catch (Exception) { } }; tWrk.RunWorkerAsync(); version.Content = String.Format("Version {0}", Assembly.GetExecutingAssembly().GetName().Version); var tSet = new Settings(); SetValue(IsGroupFilterActiveProperty, tSet.FilterByGroup); }