コード例 #1
0
 public void ShowDetail(int currentMonth, int day, SampleDataItem item)
 {
     PanchangData pdata = item.GetPanchangData(currentMonth, day);
     DateTime dateTime = new DateTime(item.Year, currentMonth, day);
     DateTextBlock.Text = dateTime.ToString("d");
     SunriseTextBlock.Text= pdata._fieldValues[(int)FieldType.Sunrise];
     SunsetTextBlock.Text = pdata._fieldValues[(int)FieldType.Sunset];
     MoonRiseTextBlock.Text = pdata._fieldValues[(int)FieldType.Moonrise];
     TamilYearTextBlock.Text = (pdata._fieldValues[(int)FieldType.TamilYear] == null) ? "None" : pdata._fieldValues[(int)FieldType.TamilYear];
     NorthYearTextBlock.Text = pdata._fieldValues[(int)FieldType.NorthYear];
     GujaratYearTextBlock.Text = pdata._fieldValues[(int)FieldType.GujaratYear];
     AyanaTextBlock.Text = pdata._fieldValues[(int)FieldType.Ayana];
     RituTextBlock.Text = pdata._fieldValues[(int)FieldType.Ritu];
     VedicRituTextBlock.Text = pdata._fieldValues[(int)FieldType.VedicRitu];
     TamilMonthTextBlock.Text = pdata._fieldValues[(int)FieldType.TamilMonth];
     // there is a whitespace in front of this string
     SanskritMonthTextBlock.Text = (pdata._fieldValues[(int)FieldType.SanskritMonth]).Trim();
     PakshaTextBlock.Text = (pdata._fieldValues[(int)FieldType.Paksha]).Trim();
     TithiTextBlock.Text = pdata._fieldValues[(int)FieldType.Tithi];
     NakshatraTextBlock.Text = pdata._fieldValues[(int)FieldType.Nakshatra];
     YogaTextBlock.Text = pdata._fieldValues[(int)FieldType.Yoga];
     KaranaTextBlock.Text = pdata._fieldValues[(int)FieldType.Karana];
     SunRasiTextBlock.Text = pdata._fieldValues[(int)FieldType.SunRasi];
     MoonRasiTextBlock.Text = pdata._fieldValues[(int)FieldType.MoonRasi];
     RahuKalamTextBlock.Text = pdata._fieldValues[(int)FieldType.RahuKalam];
     YamaKandamTextBlock.Text = pdata._fieldValues[(int)FieldType.YamaGandam];
     GulikaiTextBlock.Text = pdata._fieldValues[(int)FieldType.Gulikai];
     String festival = item.GetFestival(currentMonth, day);
     if (String.IsNullOrEmpty(festival))
     {
         festival = "No data";
     }
     FestivalTextBlock.Text = festival;
     PersonalEventListScroller.Visibility = Visibility.Collapsed;
     Separator.BorderThickness = new Thickness(0, 0, 0, 0);
     PersonalEventList.Items.Clear();
     if (_privateEvents != null)
     {
         List<PrivateEvent> privateEventList = _privateEvents.GetEventsForDate(dateTime);
         foreach (PrivateEvent evt in privateEventList)
         {
             AddPrivateEvent(dateTime, evt._eventText, false, evt);
         }
     }
 }
コード例 #2
0
        // Update tile for today
        private void UpdateTile( SampleDataItem item, DateTime dueTime, DateTime expiryTime)
        {
            DateTime date = dueTime;
            int month = date.Month;
            int day = date.Day;
            String festival;
            var notifier = TileUpdateManager.CreateTileUpdaterForApplication();

            Debug.WriteLine("Update tile {0} {1}", dueTime, expiryTime);
            festival = item.GetFestival(month, day);
            PanchangData pdata = item.GetPanchangData(month, day);
            // create the wide template
            ITileWideText01 tileContent = TileContentFactory.CreateTileWideText01();
            tileContent.TextHeading.Text = date.ToString("d");
            tileContent.TextBody1.Text = pdata._fieldValues[(int)FieldType.SanskritMonth];
            tileContent.TextBody2.Text = pdata._fieldValues[(int)FieldType.TamilMonth];
            tileContent.TextBody3.Text = festival;

            // create the square template and attach it to the wide template
            ITileSquareText01 squareContent = TileContentFactory.CreateTileSquareText01();
            squareContent.TextHeading.Text = date.ToString("d");
            squareContent.TextBody1.Text = pdata._fieldValues[(int)FieldType.SanskritMonth];
            squareContent.TextBody2.Text = pdata._fieldValues[(int)FieldType.TamilMonth];
            squareContent.TextBody3.Text = festival;
            tileContent.SquareContent = squareContent;

            // send the notification
            ScheduledTileNotification futureTile = new ScheduledTileNotification(tileContent.GetXml(), dueTime);
            futureTile.ExpirationTime = expiryTime;
            notifier.AddToSchedule(futureTile);


            // Send another notification. this gives a nice animation in mogo
            tileContent.TextBody1.Text = pdata._fieldValues[(int)FieldType.Paksha];
            tileContent.TextBody2.Text = pdata._fieldValues[(int)FieldType.Tithi];
            tileContent.TextBody3.Text = pdata._fieldValues[(int)FieldType.Nakshatra];
            futureTile = new ScheduledTileNotification(tileContent.GetXml(), dueTime);
            futureTile.ExpirationTime = expiryTime;
            notifier.AddToSchedule(futureTile);
            Debug.WriteLine("Count of scheduled notifications {0}", notifier.GetScheduledTileNotifications().Count);
        }