public override void GetCurrentTimelineEntry(CLKComplication complication, Action <CLKComplicationTimelineEntry> handler)
        {
            // Call the handler with the current timeline entry
            System.Diagnostics.Debug.WriteLine("GetCurrentTimelineEntry");

            CLKComplicationTimelineEntry entry = null;

            try
            {
                var minutesPastHour = DateTime.Now.Minute.ToString();

                if (complication.Family == CLKComplicationFamily.ModularSmall)
                {
                    var textTemplate1 = new CLKComplicationTemplateModularSmallSimpleText();
                    textTemplate1.TextProvider = CLKSimpleTextProvider.FromText("OWCE");
                    entry = CLKComplicationTimelineEntry.Create(NSDate.Now, textTemplate1);
                }
                else if (complication.Family == CLKComplicationFamily.GraphicCircular)
                {
                    var graphicTemplate = new CLKComplicationTemplateGraphicCircularImage();
                    graphicTemplate.ImageProvider = new CLKFullColorImageProvider(UIImage.FromBundle("OWCELogo"));

                    entry = CLKComplicationTimelineEntry.Create(NSDate.Now, graphicTemplate);
                }
            }
            catch (Exception x)
            {
                System.Diagnostics.Debug.WriteLine("Exception " + x);
            }
            handler(entry);
        }
Ejemplo n.º 2
0
        private CLKComplicationTemplate CreateComplicationTemplate(CLKComplicationFamily complicationFamily, string complicationText)
        {
            CLKComplicationTemplate template = null;

            switch (complicationFamily)
            {
            case CLKComplicationFamily.ModularSmall:
                template = new CLKComplicationTemplateModularSmallRingText()
                {
                    TextProvider = CLKSimpleTextProvider.FromText(complicationText),
                    FillFraction = 0.75f,
                    RingStyle    = CLKComplicationRingStyle.Open
                };
                break;

            case CLKComplicationFamily.ModularLarge:
                template = new CLKComplicationTemplateModularLargeStandardBody()
                {
                    HeaderTextProvider = CLKSimpleTextProvider.FromText("My Complication"),
                    Body1TextProvider  = CLKSimpleTextProvider.FromText(complicationText),
                    Body2TextProvider  = CLKTimeTextProvider.FromDate(NSDate.Now)
                };
                break;
            }

            return(template);
        }
		public override void GetPlaceholderTemplate (CLKComplication complication, Action<CLKComplicationTemplate> handler)
		{
			Console.WriteLine ("GetPlaceholderTemplate");
			CLKComplicationTemplate template = null;
			if (complication.Family == CLKComplicationFamily.ModularSmall) {
				var textTemplate = new CLKComplicationTemplateModularSmallRingText ();
				textTemplate.TextProvider = CLKSimpleTextProvider.FromText ("XAM1");
				template = textTemplate;
			} else if (complication.Family == CLKComplicationFamily.UtilitarianSmall) {
				var textTemplate = new CLKComplicationTemplateUtilitarianSmallFlat ();
				textTemplate.TextProvider = CLKSimpleTextProvider.FromText ("XAM2");
				template = textTemplate;
			} else if (complication.Family == CLKComplicationFamily.UtilitarianLarge) {
				var textTemplate = new CLKComplicationTemplateUtilitarianLargeFlat ();
				textTemplate.TextProvider = CLKSimpleTextProvider.FromText ("XAM3");
				template = textTemplate;
			} else if (complication.Family == CLKComplicationFamily.CircularSmall) {
				var textTemplate = new CLKComplicationTemplateCircularSmallRingText ();
				textTemplate.TextProvider = CLKSimpleTextProvider.FromText ("XS");
				template = textTemplate;
			}
			else	 
			{
				Console.WriteLine ("GetPlaceholderTemplate: Complication not supported");
			}

			handler (template);
		}
Ejemplo n.º 4
0
        public override void GetCurrentTimelineEntry(CLKComplication complication, Action <CLKComplicationTimelineEntry> handler)
        {
            Console.WriteLine("GetCurrentTimelineEntry");

            CLKComplicationTimelineEntry entry = null;

            try
            {
                var txt = DateTime.Now.Minute.ToString();

                if (complication.Family == CLKComplicationFamily.ModularSmall)
                {
                    var textTemplate1 = new CLKComplicationTemplateModularSmallSimpleText();
                    textTemplate1.TextProvider = CLKSimpleTextProvider.FromText(txt);
                    entry = CLKComplicationTimelineEntry.Create(NSDate.Now, textTemplate1);
                }
                else if (complication.Family == CLKComplicationFamily.ModularLarge)
                {
                    var textTemplate = new CLKComplicationTemplateModularLargeStandardBody();
                    textTemplate.HeaderTextProvider = CLKSimpleTextProvider.FromText("Header" + txt, "XH", "```");

                    textTemplate.Body1TextProvider = CLKSimpleTextProvider.FromText("B1 " + txt, "X1", "~~~");
                    textTemplate.Body2TextProvider = CLKSimpleTextProvider.FromText("Body 2x", "X2", "---");

                    entry = CLKComplicationTimelineEntry.Create(NSDate.Now, textTemplate);
                }
                else if (complication.Family == CLKComplicationFamily.UtilitarianSmall)
                {
                    var textTemplate = new CLKComplicationTemplateUtilitarianSmallFlat();
                    textTemplate.TextProvider = CLKSimpleTextProvider.FromText("2Xam");
                    entry = CLKComplicationTimelineEntry.Create(NSDate.Now, textTemplate);
                }
                else if (complication.Family == CLKComplicationFamily.UtilitarianLarge)
                {
                    var textTemplate = new CLKComplicationTemplateUtilitarianLargeFlat();
                    textTemplate.TextProvider = CLKSimpleTextProvider.FromText("3Xam");
                    entry = CLKComplicationTimelineEntry.Create(NSDate.Now, textTemplate);
                }
                else if (complication.Family == CLKComplicationFamily.CircularSmall)
                {
                    var imgTemplate = new CLKComplicationTemplateCircularSmallRingImage();
                    imgTemplate.ImageProvider = CLKImageProvider.Create(UIImage.FromBundle("Circular"));
                    entry = CLKComplicationTimelineEntry.Create(NSDate.Now, imgTemplate);
                }
                else
                {
                    Console.WriteLine("GetCurrentTimelineEntry: Complication not supported (" + complication.Family + ")");
                }
            }
            catch (Exception x)
            {
                Console.WriteLine("Exception " + x);
            }
            handler(entry);
        }
        public override void GetCurrentTimelineEntry(CLKComplication complication, Action <CLKComplicationTimelineEntry> handler)
        {
            //			var entry = new CLKComplicationTimelineEntry () {
            //				Date = new NSDate (),
            //				ComplicationTemplate = new CLKComplicationTemplateCircularSmallRingText ()
            //			};
            //			handler (entry);
            //
            CLKComplicationTimelineEntry entry = null;

            if (complication.Family == CLKComplicationFamily.ModularSmall)
            {
                var textTemplate = new CLKComplicationTemplateModularSmallSimpleText();
                textTemplate.TextProvider = CLKSimpleTextProvider.FromText("Xamarin1");

                entry = CLKComplicationTimelineEntry.Create(NSDate.Now, textTemplate);
            }
            else if (complication.Family == CLKComplicationFamily.UtilitarianSmall)
            {
                var textTemplate = new CLKComplicationTemplateUtilitarianSmallFlat();
                textTemplate.TextProvider = CLKSimpleTextProvider.FromText("Xamarin2");

                entry = CLKComplicationTimelineEntry.Create(NSDate.Now, textTemplate);
            }
            else if (complication.Family == CLKComplicationFamily.UtilitarianLarge)
            {
                var textTemplate = new CLKComplicationTemplateUtilitarianLargeFlat();
                textTemplate.TextProvider = CLKSimpleTextProvider.FromText("Xamarin3");

                entry = CLKComplicationTimelineEntry.Create(NSDate.Now, textTemplate);
            }
            else if (complication.Family == CLKComplicationFamily.CircularSmall)
            {
                var imgTemplate = new CLKComplicationTemplateCircularSmallRingImage();

                imgTemplate.ImageProvider = CLKImageProvider.Create(UIImage.FromBundle("Circular"));

                entry = CLKComplicationTimelineEntry.Create(NSDate.Now, imgTemplate);
            }
            else
            {
                Console.WriteLine("GetCurrentTimelineEntry: Complication not supported");
            }

            handler(entry);
        }
Ejemplo n.º 6
0
        public override void GetPlaceholderTemplate(CLKComplication complication, Action <CLKComplicationTemplate> handler)
        {
            // This method will be called once per supported complication, and the results will be cached
            Console.WriteLine("GetPlaceholderTemplate for " + complication);

            CLKComplicationTemplate template = null;

            if (complication.Family == CLKComplicationFamily.ModularSmall)
            {
                var textTemplate = new CLKComplicationTemplateModularSmallSimpleText();
                textTemplate.TextProvider = CLKSimpleTextProvider.FromText("X1");
                template = textTemplate;
            }
            else if (complication.Family == CLKComplicationFamily.ModularLarge)
            {
                var textTemplate = new CLKComplicationTemplateModularLargeStandardBody();
                textTemplate.HeaderTextProvider = CLKSimpleTextProvider.FromText("Header A", "A 2", "~~~");
                textTemplate.Body1TextProvider  = CLKSimpleTextProvider.FromText("Body B", "B 2", "~~~");
                template = textTemplate;
            }
            else if (complication.Family == CLKComplicationFamily.UtilitarianSmall)
            {
                var textTemplate = new CLKComplicationTemplateUtilitarianSmallFlat();
                textTemplate.TextProvider = CLKSimpleTextProvider.FromText("XAM2");
                template = textTemplate;
            }
            else if (complication.Family == CLKComplicationFamily.UtilitarianLarge)
            {
                var textTemplate = new CLKComplicationTemplateUtilitarianLargeFlat();
                textTemplate.TextProvider = CLKSimpleTextProvider.FromText("XAM3");
                template = textTemplate;
            }
            else if (complication.Family == CLKComplicationFamily.CircularSmall)
            {
                var textTemplate = new CLKComplicationTemplateCircularSmallRingText();
                textTemplate.TextProvider = CLKSimpleTextProvider.FromText("s");
                template = textTemplate;
            }
            else
            {
                Console.WriteLine("GetPlaceholderTemplate: Complication not supported (" + complication + ")");
            }

            handler(template);
        }
Ejemplo n.º 7
0
        public override void GetPlaceholderTemplate(CLKComplication complication, Action <CLKComplicationTemplate> handler)
        {
            // Only support .modularLarge currently.
            if (complication.Family == CLKComplicationFamily.ModularLarge)
            {
                // Display a random number string on the body.
                var tallBody = new CLKComplicationTemplateModularLargeTallBody
                {
                    HeaderTextProvider = CLKSimpleTextProvider.FromText("SimpleWC"),
                    BodyTextProvider   = CLKSimpleTextProvider.FromText("Random")
                };

                // Pass the template to ClockKit.
                handler(tallBody);
            }
            else
            {
                handler(null);
            }
        }
        public override void GetPlaceholderTemplate(CLKComplication complication, Action <CLKComplicationTemplate> handler)
        {
            // This method will be called once per supported complication, and the results will be cached
            System.Diagnostics.Debug.WriteLine("GetPlaceholderTemplate for " + complication);

            CLKComplicationTemplate template = null;

            if (complication.Family == CLKComplicationFamily.ModularSmall)
            {
                var textTemplate = new CLKComplicationTemplateModularSmallSimpleText();
                textTemplate.TextProvider = CLKSimpleTextProvider.FromText("OWCE");
                template = textTemplate;
            }
            else if (complication.Family == CLKComplicationFamily.GraphicCircular)
            {
                var graphicTemplate = new CLKComplicationTemplateGraphicCircularImage();
                graphicTemplate.ImageProvider = new CLKFullColorImageProvider(UIImage.FromBundle("OWCELogo"));
                template = graphicTemplate;
            }

            handler(template);
        }
Ejemplo n.º 9
0
        public override void GetCurrentTimelineEntry(CLKComplication complication, Action <CLKComplicationTimelineEntry> handler)
        {
            // Only support .modularLarge currently.
            if (complication.Family == CLKComplicationFamily.ModularLarge)
            {
                var random = new Random();

                // Display a random number string on the body.
                var tallBody = new CLKComplicationTemplateModularLargeTallBody
                {
                    HeaderTextProvider = CLKSimpleTextProvider.FromText("SimpleWC"),
                    BodyTextProvider   = CLKSimpleTextProvider.FromText($"{random.Next(400)}")
                };

                // Pass the entry to ClockKit.
                var entry = CLKComplicationTimelineEntry.Create(new NSDate(), tallBody);
                handler(entry);
            }
            else
            {
                handler(null);
            }
        }
Ejemplo n.º 10
0
        public override void GetCurrentTimelineEntry(CLKComplication complication, Action <CLKComplicationTimelineEntry> handler)
        {
            // Call the handler with the current timeline entry
            Console.WriteLine("GetCurrentTimelineEntry");

            CLKComplicationTimelineEntry entry = null;

            try
            {
                var minutesPastHour = DateTime.Now.Minute.ToString();

                if (complication.Family == CLKComplicationFamily.ModularSmall)
                {
                    var textTemplate1 = new CLKComplicationTemplateModularSmallSimpleText();
                    textTemplate1.TextProvider = CLKSimpleTextProvider.FromText(minutesPastHour);
                    entry = CLKComplicationTimelineEntry.Create(NSDate.Now, textTemplate1);
                }
                else if (complication.Family == CLKComplicationFamily.ModularLarge)
                {
                    var textTemplate = new CLKComplicationTemplateModularLargeStandardBody();
                    textTemplate.HeaderTextProvider = CLKSimpleTextProvider.FromText("Set " + minutesPastHour + " mins past", "XH", "```");

                    textTemplate.Body1TextProvider = CLKSimpleTextProvider.FromText("Body text", "X1", "~~~");
                    textTemplate.Body2TextProvider = CLKSimpleTextProvider.FromText("Body 2", "X2", "---");

                    // if the user typed something in the app, show that in complication
                    var c = NSUserDefaults.StandardUserDefaults["complication"];
                    if (c != null)
                    {
                        textTemplate.Body1TextProvider = CLKSimpleTextProvider.FromText("You typed:", "You:", "~~~");
                        textTemplate.Body2TextProvider = CLKSimpleTextProvider.FromText(c.ToString(), c.ToString(), "---");
                    }


                    entry = CLKComplicationTimelineEntry.Create(NSDate.Now, textTemplate);
                }
                else if (complication.Family == CLKComplicationFamily.UtilitarianSmall)
                {
                    var textTemplate = new CLKComplicationTemplateUtilitarianSmallFlat();
                    textTemplate.TextProvider = CLKSimpleTextProvider.FromText(minutesPastHour + "m");
                    entry = CLKComplicationTimelineEntry.Create(NSDate.Now, textTemplate);
                }
                else if (complication.Family == CLKComplicationFamily.UtilitarianLarge)
                {
                    var textTemplate = new CLKComplicationTemplateUtilitarianLargeFlat();
                    textTemplate.TextProvider = CLKSimpleTextProvider.FromText(minutesPastHour + " past hour");
                    entry = CLKComplicationTimelineEntry.Create(NSDate.Now, textTemplate);
                }
                else if (complication.Family == CLKComplicationFamily.CircularSmall)
                {
                    var ringTemplate = new CLKComplicationTemplateCircularSmallRingText();
                    ringTemplate.TextProvider = CLKSimpleTextProvider.FromText(minutesPastHour);
                    ringTemplate.FillFraction = DateTime.Now.Minute / 60f;
                    entry = CLKComplicationTimelineEntry.Create(NSDate.Now, ringTemplate);
                }
                else
                {
                    Console.WriteLine("GetCurrentTimelineEntry: Complication not supported (" + complication.Family + ")");
                }
            }
            catch (Exception x)
            {
                Console.WriteLine("Exception " + x);
            }
            handler(entry);
        }