public override void ViewDidLoad() { base.ViewDidLoad(); // Init navigation items UIBarButtonItem update = new UIBarButtonItem( UIBarButtonSystemItem.Refresh, (s, e) => { RefreshLog(); } ); UIBarButtonItem trash = new UIBarButtonItem( UIBarButtonSystemItem.Trash, (s, e) => { // Empty log UserLog.Clear(); RefreshLog(); } ); // Add button to item array barButtonItems[0] = update; barButtonItems[1] = trash; // add navigation items to navigation bar NavigationItem.RightBarButtonItems = barButtonItems; // set data handler UserLog.NewEntryAdded += HandleUserLogNewEntry; // Perform any additional setup after loading the view, typically from a nib. tableView.SeparatorColor = StyleSettings.SubtleTextOnDarkColor(); //tableView.SetContentOffset (new CGPoint(0, float.MaxValue), false); UIView view = new UIView(new CGRect(0, 0, 1, 1)); tableView.TableFooterView = view; RefreshLog(); }
public override void ViewDidLoad() { base.ViewDidLoad(); // Localized texts String title = NSBundle.MainBundle.LocalizedString("Vernacular_P0_app_name", null).PrepareForLabel(); lblTitle.Text = title; lblTitle.TextColor = StyleSettings.TextOnDarkColor(); lblVersion.Text = String.Format("{0}.{1}", App.Version.Major, App.Version.Minor); lblVersion.TextColor = StyleSettings.ThemePrimaryColor(); String developed = NSBundle.MainBundle.LocalizedString("Vernacular_P0_about_developed_by", null).ToUpper().PrepareForLabel(); lblDeveloped.Text = developed; lblDeveloped.TextColor = StyleSettings.ThemePrimaryColor(); String developedWithC4rs = NSBundle.MainBundle.LocalizedString("Vernacular_P0_about_c4rs", null).PrepareForLabel(); lblDevelopedWith.Text = developedWithC4rs; lblDevelopedWith.TextColor = StyleSettings.TextOnDarkColor(); String university = NSBundle.MainBundle.LocalizedString("Vernacular_P0_about_author", null).PrepareForLabel(); lblUniversity.Text = university; lblUniversity.TextColor = StyleSettings.TextOnDarkColor(); String collaborators = NSBundle.MainBundle.LocalizedString("Vernacular_P0_about_contributors", null).ToUpper().PrepareForLabel(); lblCollaborators.Text = collaborators; lblCollaborators.TextColor = StyleSettings.ThemePrimaryColor(); String collaboratorList = NSBundle.MainBundle.LocalizedString("Vernacular_P0_about_authors", null).PrepareForLabel(); lblCollaboratorList.Text = collaboratorList; lblCollaboratorList.TextColor = StyleSettings.TextOnDarkColor(); String design = NSBundle.MainBundle.LocalizedString("Vernacular_P0_about_icon_design", null).ToUpper().PrepareForLabel(); lblDesign.Text = design; lblDesign.TextColor = StyleSettings.ThemePrimaryColor(); String designInfo = NSBundle.MainBundle.LocalizedString("Vernacular_P0_about_icon_design_text", null).PrepareForLabel(); lblDesignInfo.Text = designInfo; lblDesignInfo.TextColor = StyleSettings.TextOnDarkColor(); String comments = NSBundle.MainBundle.LocalizedString("Vernacular_P0_about_feedback", null).ToUpper().PrepareForLabel(); lblComments.Text = comments; lblComments.TextColor = StyleSettings.ThemePrimaryColor(); String email = NSBundle.MainBundle.LocalizedString("Vernacular_P0_mail_address", null).PrepareForLabel(); btnEmail.SetTitle(email, UIControlState.Normal); btnEmail.SetTitleColor(StyleSettings.TextOnDarkColor(), UIControlState.Normal); lblAppInfo.Text = App.ApplicationInformation + "."; lblAppInfo.TextColor = StyleSettings.SubtleTextOnDarkColor(); btnEmail.TouchUpInside += (object sender, EventArgs e) => { // Send Email MFMailComposeViewController mailController; if (MFMailComposeViewController.CanSendMail) { Log.Debug("opening mail controller"); // Set mail composer mailController = new MFMailComposeViewController(); // populate email mailController.SetToRecipients(new string[] { NSBundle.MainBundle.LocalizedString("Vernacular_P0_mail_address", null) }); mailController.SetSubject(NSBundle.MainBundle.LocalizedString("Vernacular_P0_app_name", null)); // activate send button mailController.Finished += (object s, MFComposeResultEventArgs args) => { Console.WriteLine(args.Result.ToString()); args.Controller.DismissViewController(true, null); }; // present view controller this.PresentViewController(mailController, true, null); } else { Log.Debug("failed opening mail controller"); String errorTitle = NSBundle.MainBundle.LocalizedString("Vernacular_P0_information_message_title_engine_error", null).PrepareForLabel(); String errorBody = NSBundle.MainBundle.LocalizedString("Vernacular_P0_error_send_mail_not_configured", null).PrepareForLabel(); //Create Alert var errorAlertController = UIAlertController.Create(errorTitle, errorBody, UIAlertControllerStyle.Alert); //Add Actions errorAlertController.AddAction(UIAlertAction.Create(NSBundle.MainBundle.LocalizedString("Vernacular_P0_dialog_ok", null), UIAlertActionStyle.Default, null)); //Present Alert PresentViewController(errorAlertController, true, null); } }; }
public override void ViewDidLoad() { base.ViewDidLoad(); UIBarButtonItem trash = new UIBarButtonItem( UIBarButtonSystemItem.Trash, (s, e) => { //Create Alert var title = NSBundle.MainBundle.LocalizedString("Vernacular_P0_title_queue", null).PrepareForLabel(); var body = NSBundle.MainBundle.LocalizedString("Vernacular_P0_dialog_queue_clear_description", null).PrepareForLabel(); var okCancelAlertController = UIAlertController.Create(title, body, UIAlertControllerStyle.Alert); //Add Actions var okString = NSBundle.MainBundle.LocalizedString("Vernacular_P0_dialog_queue_clear_delete_all", null).PrepareForLabel(); var cancelString = NSBundle.MainBundle.LocalizedString("Vernacular_P0_dialog_cancel", null).PrepareForLabel(); okCancelAlertController.AddAction(UIAlertAction.Create(okString, UIAlertActionStyle.Default, alert => { if (ViewModel != null) { ViewModel.ClearUploadQueueCommand.Execute(null); RefreshList(); } } )); okCancelAlertController.AddAction(UIAlertAction.Create(cancelString, UIAlertActionStyle.Cancel, null)); //Present Alert PresentViewController(okCancelAlertController, true, null); } ); // Add button to item array barButtonItems[0] = trash; // add navigation items to navigation bar NavigationItem.RightBarButtonItems = barButtonItems; // Perform any additional setup after loading the view, typically from a nib. tableView.SeparatorColor = StyleSettings.SubtleTextOnDarkColor(); UIView view = new UIView(new CGRect(0, 0, 1, 1)); tableView.TableFooterView = view; String noData = NSBundle.MainBundle.LocalizedString("Vernacular_P0_status_no_files_in_queue", null).PrepareForLabel(); lblNoData.Text = noData; String forceUpload = NSBundle.MainBundle.LocalizedString("Vernacular_P0_action_force_upload", null).PrepareForLabel().ToUpper(); btnPushData.SetTitle(forceUpload, UIControlState.Normal); btnPushData.BackgroundColor = StyleSettings.ThemePrimaryColor(); btnPushData.SetTitleColor(StyleSettings.TextOnDarkColor(), UIControlState.Normal); btnPushData.Layer.CornerRadius = 2; // Initialize data //View model setup ViewModel = new UploadQueueViewModel(); ViewModel.OnCreate(); ViewModel.UploadQueueUpdated += HandleUploadQueueUpdated; ViewModel.IsUploadingChanged += HandleIsUploadingChanged; ViewModel.RefreshQueueCommand.Execute(null); // Add table source tableSource = new DataTableSource(this.tableView, this); tableSource.data = ViewModel; tableView.Source = tableSource; // handle force upload button click btnPushData.TouchUpInside += (object sender, EventArgs e) => { TryDataUpload(); }; ViewModel.IsUploadingChanged += (object sender, EventArgs e) => { if (ViewModel.IsUploading) { btnPushData.Enabled = false; // derive the center x and y nfloat centerX = this.View.Frame.Width / 2; nfloat centerY = this.View.Frame.Height / 2; // create the activity spinner, center it horizontall and put it 5 points above center x activitySpinner = new UIActivityIndicatorView(UIActivityIndicatorViewStyle.WhiteLarge); activitySpinner.Frame = new RectangleF( (float)(centerX - (activitySpinner.Frame.Width / 2)), (float)(centerY - activitySpinner.Frame.Height - 20), (float)activitySpinner.Frame.Width, (float)activitySpinner.Frame.Height); activitySpinner.AutoresizingMask = UIViewAutoresizing.All; this.View.AddSubview(activitySpinner); activitySpinner.StartAnimating(); } else { btnPushData.Enabled = true; activitySpinner.RemoveFromSuperview(); } }; }