Beispiel #1
0
 public string getNewSpelling(int year, string phrase)
 {
     Years y = new Years();
     if (year == 0)
         return phrase;
     string[] p = phrase.Split(' ');
     switch (year)
     {
         case 1:
             y.Year1(p);
             break;
         case 2:
             y.Year1(p);
             y.Year2(p);
             break;
         case 3:
             y.Year1(p);
             y.Year2(p);
             y.Year3(p);
             break;
         case 4:
             y.Year1(p);
             y.Year2(p);
             y.Year3(p);
             y.Year4(p);
             break;
         case 5:
             y.Year1(p);
             y.Year2(p);
             y.Year3(p);
             y.Year4(p);
             y.Year5(p);
             break;
         case 6:
             y.Year1(p);
             y.Year2(p);
             y.Year3(p);
             y.Year4(p);
             y.Year5(p);
             y.Year6(p);
             break;
         case 7:
             y.Year1(p);
             y.Year2(p);
             y.Year3(p);
             y.Year4(p);
             y.Year5(p);
             y.Year6(p);
             y.Year7(p);
             break;
     }
     string result = "";
     for (int i = 0; i < p.Length; i++)
     {
         result += p[i] + " ";
     }
     result = result.Remove(result.Length - 1, 1);
     return result;
 }
Beispiel #2
0
        public async void ReadMyXML()
        {
            Uri uriYears = ToAbsoluteUri("xmlyears.aspx");

            App app = (App)Application.Current;
            if (app.BackgroundDownloader != null)
            {
                if (app.BackgroundDownloader.Status == TaskStatus.RanToCompletion)
                {
                    bool b = await app.BackgroundDownloader;
                    if (b)
                    {
                        try
                        {
                            var y = Windows.Storage.ApplicationData.Current.LocalFolder;
                            string subdir = BasicFileDownloader.UriToSubDirectory(uriYears);
                            string fname = BasicFileDownloader.UriToFilename(uriYears);
                            string backupfname = BasicFileDownloader.UriToFilename(uriYears) + ".bak";

                            var sf = await y.GetFileAsync(subdir + "\\" + fname);
                            await sf.DeleteAsync();
                            sf = await y.GetFileAsync(subdir + "\\" + backupfname);
                            await sf.RenameAsync(fname);
                        }
                        catch { }
                    }
                }
            } 
                    
            Years = new Years();

            Progress<int> progress = new Progress<int>((p) => { ProgressPercent = p; });

            BasicFileDownloader bidl = new BasicFileDownloader(uriYears);
            IRandomAccessStream s = await bidl.DownloadAsync(progress);

            XmlReaderSettings settings = new XmlReaderSettings();
            settings.ConformanceLevel = ConformanceLevel.Fragment;
            settings.IgnoreWhitespace = true;
            settings.IgnoreComments = true;
            settings.Async = true;
            XmlReader reader = XmlReader.Create(s.AsStream(), settings);
            reader.ReadStartElement("Model");
            reader.ReadStartElement("Years");
            Count = 0;
            while (reader.IsStartElement())
            {
                string year = reader[0];
                string str = reader[1];
                str = str.Replace("_s.jpg", "");
                if (!String.IsNullOrEmpty(str))
                {
                    uint count = 0;
                    if (uint.TryParse(reader[2], out count))
                    {
                        Year y = new Year(year, str, count);
                        if (FirstYear == null)
                            FirstYear = y;
                        else
                            Years.Add(y);
                        Count += y.Count;
                    }
                }
                await reader.ReadAsync();
            }

            s.Dispose();

            BasicFileDownloader bfdlForce = new BasicFileDownloader(uriYears);
            app.BackgroundDownloader = bfdlForce.DownloadAsyncForce(null);
        }
Beispiel #3
0
 public NavisworksClientInformation_Model(Years year, Enums.Versions version) : base(Products.NAVIS, year)
 {
     Version = version;
 }
Beispiel #4
0
        } // FindDay

        // ----------------------------------------------------------------------
        protected override bool EnterYears(Years years, DaySeekerContext context)
        {
            return(!context.IsFinished);
        } // EnterYears