Esempio n. 1
0
 private void SetPreferredContentSize()
 {
     if (ExtensionContext.GetWidgetActiveDisplayMode() == NCWidgetDisplayMode.Compact)
     {
         PreferredContentSize = _collapsedSize;
     }
     else
     {
         var height = (!_data?.Any() ?? true) ? 100 : (_data.Count() * SessionsTable.SectionHeaderHeight) +
                      (_data.SelectMany(g => g.AsEnumerable()).Count() * SessionsTable.EstimatedRowHeight) +
                      SessionsTable.SectionFooterHeight + 70;
         Console.WriteLine($"Requesting widget height: {height}");
         PreferredContentSize = new CGSize(0, height);
     }
 }
Esempio n. 2
0
        public void WidgetPerformUpdate(Action <NCUpdateResult> completionHandler)
        {
            // Perform any setup necessary in order to update the view.

            // Take action based on the display mode
            switch (ExtensionContext.GetWidgetActiveDisplayMode())
            {
            case NCWidgetDisplayMode.Compact:
                //Content.Text = "Let's Monkey About!";
                break;

            case NCWidgetDisplayMode.Expanded:
                //Content.Text = "Gorilla!!!!";
                break;
            }

            // Report results
            // If an error is encoutered, use NCUpdateResultFailed
            // If there's no update required, use NCUpdateResultNoData
            // If there's an update, use NCUpdateResultNewData

            completionHandler(NCUpdateResult.NewData);
        }