public void SendToast(string toast) { Utils.EnsureInvokedOnMainThread(() => { var notificationView = new GCDiscreetNotificationView(toast, false, GCDNPresentationMode.Bottom, UIApplication.SharedApplication.KeyWindow.RootViewController.View); notificationView.ShowAndDismissAfter(3); }); }
public void SendMessage(string message, string title = null) { var notificationView = new GCDiscreetNotificationView( text: message, activity: false, presentationMode: GCDNPresentationMode.Bottom, view: UIApplication.SharedApplication.KeyWindow ); notificationView.ShowAndDismissAfter(3); }
public void SendToast(string message) { var notificationView = new GCDiscreetNotificationView( text: message, activity: false, presentationMode: GCDNPresentationMode.Bottom, view: UIApplication.SharedApplication.KeyWindow ); notificationView.ShowAndDismissAfter(4); }
public override void ViewDidLoad() { base.ViewDidLoad(); // Perform any additional setup after loading the view, typically from a nib. Button.AccessibilityIdentifier = "myButton"; Button.SetCommand("TouchUpInside", VM.GetPeopleCommand); unBind = this.SetBinding(() => VM.Username, () => TextUsername.Text, BindingMode.TwoWay) .UpdateTargetTrigger("EditingChanged"); passBind = this.SetBinding(() => VM.Password, () => TextPassword.Text, BindingMode.TwoWay) .UpdateTargetTrigger("EditingChanged"); combBind = this.SetBinding(() => VM.ComboDisplay, () => LabelCombo.Text, BindingMode.OneWay); busyBind = this.SetBinding(() => VM.IsBusy).WhenSourceChanges(() => { Button.Enabled = !VM.IsBusy; if (VM.IsBusy) { ProgressBar.StartAnimating(); } else { ProgressBar.StopAnimating(); } }); updatedBind = this.SetBinding(() => VM.People) .WhenSourceChanges(() => { notificationView = new GCDiscreetNotificationView( text: "There are " + VM.People.Count + " people", activity: false, presentationMode: GCDNPresentationMode.Bottom, view: View ); notificationView.ShowAndDismissAfter(1); }); }
public void SendToast(string message) { Utils.EnsureInvokedOnMainThread(() => { var notificationView = new GCDiscreetNotificationView( text: message, activity: false, presentationMode: GCDNPresentationMode.Bottom, view: UIApplication.SharedApplication.KeyWindow ); notificationView.ShowAndDismissAfter(4); }); }
void ViewModel_People_CollectionChanged(object sender, System.Collections.Specialized.NotifyCollectionChangedEventArgs e) { InvokeOnMainThread(async() => { notificationView = new GCDiscreetNotificationView( text: "There are " + viewModel.People.Count + " people", activity: false, presentationMode: GCDNPresentationMode.Bottom, view: View ); notificationView.ShowAndDismissAfter(1); }); }
public override void ViewDidLoad() { base.ViewDidLoad(); // Perform any additional setup after loading the view, typically from a nib. Button.AccessibilityIdentifier = "myButton"; Button.SetCommand("TouchUpInside", VM.GetPeopleCommand); unBind = this.SetBinding(() => VM.Username, () => TextUsername.Text, BindingMode.TwoWay) .UpdateTargetTrigger("EditingChanged"); passBind = this.SetBinding(() => VM.Password, () => TextPassword.Text, BindingMode.TwoWay) .UpdateTargetTrigger("EditingChanged"); combBind = this.SetBinding(() => VM.ComboDisplay, () => LabelCombo.Text, BindingMode.OneWay); busyBind = this.SetBinding(() => VM.IsBusy).WhenSourceChanges(() => { Button.Enabled = !VM.IsBusy; if(VM.IsBusy) ProgressBar.StartAnimating(); else ProgressBar.StopAnimating(); }); updatedBind = this.SetBinding(() => VM.People) .WhenSourceChanges(() => { notificationView = new GCDiscreetNotificationView ( text: "There are " + VM.People.Count + " people", activity: false, presentationMode: GCDNPresentationMode.Bottom, view: View ); notificationView.ShowAndDismissAfter (1); }); }
public override async void ViewDidLoad() { var notificationView = new GCDiscreetNotificationView ( text: "sync todo list", activity: true, presentationMode: GCDNPresentationMode.Top, view: View ); //notificationView.TintColor = UIColor.Blue; notificationView.Show (animated: true); notificationView.Hide(true); base.ViewDidLoad(); }
public override async void ViewDidLoad() { base.ViewDidLoad(); this.Title = VM.GroupName; EdgesForExtendedLayout = UIRectEdge.None; notificationView = new GCDiscreetNotificationView( text: "Loading Stats...", activity: true, presentationMode: GCDNPresentationMode.Bottom, view: View ); VM.IsBusyChanged = (busy) => { if (busy) { notificationView.Show(animated: true); } else { notificationView.HideAnimated(); } }; barChart = new BarChartView(); barChart.BarOffset = 20f; barChart.BarWidth = 45f; barChart.MinimumValue = 0; barChart.BarCaptionInnerColor = UIColor.Black; barChart.BarCaptionInnerShadowColor = UIColor.White; barChart.BarCaptionOuterColor = UIColor.Black; barChart.BarCaptionOuterShadowColor = UIColor.White; barChart.Frame = View.Frame; View.AddSubview(barChart); var up = UIColor.FromRGB(119, 208, 101); var down = UIColor.FromRGB(180, 85, 182); barChart.ItemsSource = await MeetupManager.Core.Helpers.BarHelper.GenerateData(VM, up, down); // Perform any additional setup after loading the view, typically from a nib. }
public override bool FinishedLaunching(UIApplication app, NSDictionary options) { window = new UIWindow(UIScreen.MainScreen.Bounds); var root = new RootElement("Discreet Sample") { new Section("Settings") { (text2Show = new EntryElement("Text2Show:", "Some text here", "I'm so Discreet")), new StringElement("Show", Show) { Alignment = UITextAlignment.Center }, new StringElement("Hide", Hide) { Alignment = UITextAlignment.Center }, new StringElement("Hide after 1 second", HideAfter1sec) { Alignment = UITextAlignment.Center }, (topBottom = new BooleanElement("Top / Bottom", true)), (showActivity = new BooleanElement("Show Activity?", true)) } }; dvc = new DialogViewController(root); navController = new UINavigationController(dvc); window.RootViewController = navController; window.MakeKeyAndVisible(); notificationView = new GCDiscreetNotificationView(text: text2Show.Value, activity: showActivity.Value, presentationMode: topBottom.Value ? GCDNPresentationMode.Top : GCDNPresentationMode.Bottom, view: dvc.View); showActivity.ValueChanged += ChangeActivity; topBottom.ValueChanged += ChangeTopBottom; text2Show.Changed += HandleChanged; return(true); }
public override async void ViewDidLoad() { base.ViewDidLoad(); this.Title = VM.GroupName; EdgesForExtendedLayout = UIRectEdge.None; notificationView = new GCDiscreetNotificationView( text: "Loading Stats...", activity: true, presentationMode: GCDNPresentationMode.Bottom, view: View ); VM.IsBusyChanged = (busy) => { if (busy) notificationView.Show(animated: true); else notificationView.HideAnimated(); }; barChart = new BarChartView(); barChart.BarOffset = 20f; barChart.BarWidth = 45f; barChart.MinimumValue = 0; barChart.BarCaptionInnerColor = UIColor.Black; barChart.BarCaptionInnerShadowColor = UIColor.White; barChart.BarCaptionOuterColor = UIColor.Black; barChart.BarCaptionOuterShadowColor = UIColor.White; barChart.Frame = View.Frame; View.AddSubview(barChart); var up = UIColor.FromRGB(119, 208, 101); var down = UIColor.FromRGB(180, 85, 182); barChart.ItemsSource = await MeetupManager.Core.Helpers.BarHelper.GenerateData(VM, up, down); // Perform any additional setup after loading the view, typically from a nib. }
public override void ViewDidLoad() { base.ViewDidLoad(); stationsRepository = new WebStationRepository(); var centerPoint = Station.TroncalRouteCenter; var centerCoordinate = new CLLocationCoordinate2D(centerPoint.Y, centerPoint.X); var bounds = UIScreen.MainScreen.Bounds; CameraPosition cameraPosition = CameraPosition.FromCamera(centerCoordinate, 14.0f); var map = MapView.FromCamera(new RectangleF(0, 64, bounds.Width, bounds.Height - 60), cameraPosition); map.MyLocationEnabled = true; map.MapType = MapViewType.Normal; map.Settings.MyLocationButton = true; this.mapView = map; if (UIDevice.CurrentDevice.CheckSystemVersion(7, 0)) { NavigationBar.Frame = new RectangleF(NavigationBar.Frame.X, NavigationBar.Frame.Y, NavigationBar.Frame.Width, 64.0f); } var item = new UINavigationItem("CHART"); UIBarButtonItem button = new UIBarButtonItem(MainViewController.ResizedImageIcon(UIImage.FromFile("menu.png")), UIBarButtonItemStyle.Bordered, delegate { navigation.ToggleMenu(); }); UIBarButtonItem closestStationButton = new UIBarButtonItem("Cercana", UIBarButtonItemStyle.Bordered, delegate { FindClosestStation(); }); item.LeftBarButtonItem = button; item.HidesBackButton = true; item.RightBarButtonItem = closestStationButton; NavigationBar.PushNavigationItem(item, false); notificationView = new GCDiscreetNotificationView("Buscando estación cercana...", true, GCDNPresentationMode.Bottom, mapView); this.View.AddSubview(map); LoadMapInfo(); }
public override bool FinishedLaunching(UIApplication app, NSDictionary options) { window = new UIWindow (UIScreen.MainScreen.Bounds); var root = new RootElement ("Discreet Sample") { new Section ("Settings") { (text2Show = new EntryElement ("Text2Show:", "Some text here", "I'm so Discreet")), new StringElement ("Show", Show) { Alignment = UITextAlignment.Center }, new StringElement ("Hide", Hide) { Alignment = UITextAlignment.Center }, new StringElement ("Hide after 1 second", HideAfter1sec) { Alignment = UITextAlignment.Center }, (topBottom = new BooleanElement ("Top / Bottom", true)), (showActivity = new BooleanElement ("Show Activity?", true)) } }; dvc = new DialogViewController (root); navController = new UINavigationController (dvc); window.RootViewController = navController; window.MakeKeyAndVisible (); notificationView = new GCDiscreetNotificationView (text:text2Show.Value, activity: showActivity.Value, presentationMode: topBottom.Value ? GCDNPresentationMode.Top : GCDNPresentationMode.Bottom, view: dvc.View); showActivity.ValueChanged += ChangeActivity; topBottom.ValueChanged += ChangeTopBottom; text2Show.Changed += HandleChanged; return true; }
public override void ViewDidLoad () { base.ViewDidLoad (); stationsRepository = new WebStationRepository (); var centerPoint = Station.TroncalRouteCenter; var centerCoordinate = new CLLocationCoordinate2D (centerPoint.Y, centerPoint.X); var bounds = UIScreen.MainScreen.Bounds; CameraPosition cameraPosition = CameraPosition.FromCamera (centerCoordinate, 14.0f); var map = MapView.FromCamera (new RectangleF (0, 64, bounds.Width, bounds.Height - 60), cameraPosition); map.MyLocationEnabled = true; map.MapType = MapViewType.Normal; map.Settings.MyLocationButton = true; this.mapView = map; if (UIDevice.CurrentDevice.CheckSystemVersion(7,0)) { NavigationBar.Frame = new RectangleF (NavigationBar.Frame.X, NavigationBar.Frame.Y, NavigationBar.Frame.Width, 64.0f); } var item = new UINavigationItem ("CHART"); UIBarButtonItem button = new UIBarButtonItem (MainViewController.ResizedImageIcon(UIImage.FromFile("menu.png")), UIBarButtonItemStyle.Bordered, delegate { navigation.ToggleMenu(); }); UIBarButtonItem closestStationButton = new UIBarButtonItem ("Cercana", UIBarButtonItemStyle.Bordered, delegate { FindClosestStation(); }); item.LeftBarButtonItem = button; item.HidesBackButton = true; item.RightBarButtonItem = closestStationButton; NavigationBar.PushNavigationItem (item, false); notificationView = new GCDiscreetNotificationView ("Buscando estación cercana...", true, GCDNPresentationMode.Bottom, mapView); this.View.AddSubview (map); LoadMapInfo (); }
public async Task POSTTodoEntry (TKDataForm dataForm) { if (false == Monitor.TryEnter(TodoDataEntry.POSTLock)) { return; } var json = new Json(); var data = new Dictionary<string, string>(); data["title"] = ((NSString)((TKDataFormEntityDataSource)dataForm.DataSource).EntityModel.PropertyWithName ("Title").Value).ToString(); data["content"] = ((NSString)((TKDataFormEntityDataSource)dataForm.DataSource).EntityModel.PropertyWithName ("Content").Value).ToString(); data["api_key"] = Globals.theSettings.API_Key; data["username"] = Globals.theSettings.username; if (String.IsNullOrWhiteSpace(data["title"])) { DisplayAlert ("Alert", "Title required", "OK"); Monitor.Exit (TodoDataEntry.POSTLock); return; } if (String.IsNullOrWhiteSpace(data["content"])) { DisplayAlert ("Alert", "Content required", "OK"); Monitor.Exit (TodoDataEntry.POSTLock); return; } var appDelegate = UIApplication.SharedApplication.Delegate as AppDelegate; var notificationView = new GCDiscreetNotificationView ( text: "Saving todo", activity: false, presentationMode: GCDNPresentationMode.Bottom, view: appDelegate.navigationController.View ); notificationView.SetShowActivity(true, true); notificationView.Show (true); json.ContentType = "application/json"; try { json.PostData = Newtonsoft.Json.JsonConvert.SerializeObject (data); var endpoint = String.Concat(Globals.EndpointBase, "/api/v1/account/add_todo"); await json.PostAsync(endpoint); json.XPath = "/json/status"; if ("\"success\"" == json.XText) { appDelegate.navigationController.PopViewController(true); await TodoListView._kludge.LoadTodo(); TodoListView._kludge.dataSource.ReloadData(); TodoListView._kludge.listView.ReloadData(); } else { json.XPath = "/json/data/message"; var newStr = json.XText.Replace("\"", ""); DisplayAlert("Alert", newStr, "OK"); } } catch (Exception e) { Application.Debug(e.Message); DisplayAlert ("Alert", "Unable to POST the todo", "OK"); } notificationView.Hide (true); Monitor.Exit(TodoDataEntry.POSTLock); }
public async Task POSTRequest(string action, TKDataForm dataForm) { if (false == Monitor.TryEnter(LoginView.POSTLock)) { return; } var json = new Json(); var inUsername = (NSString)((TKDataFormEntityDataSource)dataForm.DataSource).EntityModel.PropertyWithName ("Username").Value.ToString(); var inPassword = (NSString)((TKDataFormEntityDataSource)dataForm.DataSource).EntityModel.PropertyWithName ("Password").Value.ToString(); var inVerify = (NSString)((TKDataFormEntityDataSource)dataForm.DataSource).EntityModel.PropertyWithName ("Verify").Value.ToString(); var mode = ((NSNumber)((TKDataFormEntityDataSource)dataForm.DataSource).EntityModel.PropertyWithName ("Mode").Value).Int32Value; var inQuestion = (NSString)((TKDataFormEntityDataSource)dataForm.DataSource).EntityModel.PropertyWithName ("Question").Value.ToString(); var inAnswer = (NSString)((TKDataFormEntityDataSource)dataForm.DataSource).EntityModel.PropertyWithName ("Answer").Value.ToString(); var isRegister = 1 == mode ? true : false; if (String.IsNullOrWhiteSpace(inUsername)) { DisplayAlert ("Alert", "Username required", "OK"); Monitor.Exit(LoginView.POSTLock); return; } if (String.IsNullOrWhiteSpace(inPassword)) { DisplayAlert ("Alert", "Password required", "OK"); Monitor.Exit(LoginView.POSTLock); return; } if (isRegister) { if (String.IsNullOrWhiteSpace(inVerify)) { DisplayAlert ("Alert", "Verify required", "OK"); Monitor.Exit(LoginView.POSTLock); return; } if (inVerify != inPassword) { DisplayAlert ("Alert", "Passwords much match", "OK"); Monitor.Exit(LoginView.POSTLock); return; } if (null == inQuestion) { DisplayAlert ("Alert", "Please select a security question", "OK"); Monitor.Exit(LoginView.POSTLock); return; } if (String.IsNullOrWhiteSpace(inQuestion)) { DisplayAlert ("Alert", "Please select a security question", "OK"); Monitor.Exit(LoginView.POSTLock); return; } if (String.IsNullOrWhiteSpace (inAnswer)) { DisplayAlert ("Alert", "Security answer required", "OK"); Monitor.Exit(LoginView.POSTLock); return; } } var appDelegate = UIApplication.SharedApplication.Delegate as AppDelegate; var notificationView = new GCDiscreetNotificationView ( text: isRegister ? "Signing up" : "Logging in", activity: false, presentationMode: GCDNPresentationMode.Bottom, view: appDelegate.navigationController.View ); notificationView.SetShowActivity(true, true); notificationView.Show (true); json.ContentType = "application/json"; var data = new Dictionary<string, string>(); data ["username"] = inUsername; data ["password"] = inPassword; if (isRegister) { data ["question"] = inQuestion; data ["answer"] = inAnswer; } try { json.PostData = Newtonsoft.Json.JsonConvert.SerializeObject (data); var endpoints = new Dictionary<string, string>(); endpoints.Add("signin", String.Concat(Globals.EndpointBase, "/api/v1/account/signin")); endpoints.Add("register", String.Concat(Globals.EndpointBase, "/api/v1/account/register")); var endpoint = endpoints[action]; await json.PostAsync(endpoint); json.XPath = "/json/status"; if ("\"success\"" == json.XText) { json.XPath = "/json/data/api_key"; var s = new Settings { API_Key = json.XText.Replace("\"", ""), username = inUsername, }; Globals.SQLite.Insert (s); var settings = Globals.SQLite.Table<Settings>().Where (v => v.API_Key != null); Globals.theSettings = settings.First(); appDelegate.navigationController.PopToRootViewController(true); appDelegate.navigationController.ViewControllers = new List<UIViewController> { new TodoListView() }.ToArray(); } else { json.XPath = "/json/data/message"; var newStr = json.XText.Replace("\"", ""); DisplayAlert("Alert", newStr, "OK"); } } catch (Exception e) { var msgs = new Dictionary<string, string>(); msgs.Add("signin", "Unable to signin"); msgs.Add("register", "Unable to register"); var msg = msgs[action]; DisplayAlert ("Alert", msg, "OK"); } notificationView.Hide (true); Monitor.Exit(LoginView.POSTLock); }
public async Task LoadTodo () { var notificationView = new GCDiscreetNotificationView ( text: "Loading todos", activity: false, presentationMode: GCDNPresentationMode.Bottom, view: this.View ); notificationView.SetShowActivity(true, true); notificationView.Show (true); try { var json = new Json (); var data = new Dictionary<string, string> (); data ["api_key"] = Globals.theSettings.API_Key; data ["username"] = Globals.theSettings.username; json.PostData = Newtonsoft.Json.JsonConvert.SerializeObject (data); await json.PostAsync (String.Concat (Globals.EndpointBase, "/api/v1/account/get_todos")); this.dataSource.LoadDataFromJSONString(json.TransferredData, "todos"); } catch (Exception ex) { Application.Debug (ex.Message); } notificationView.Hide(true); }
void ViewModel_People_CollectionChanged (object sender, System.Collections.Specialized.NotifyCollectionChangedEventArgs e) { InvokeOnMainThread(async () => { notificationView = new GCDiscreetNotificationView ( text: "There are " + viewModel.People.Count + " people", activity: false, presentationMode: GCDNPresentationMode.Bottom, view: View ); notificationView.ShowAndDismissAfter (1); }); }
public async Task POSTDeleteTodo (NSNumber todo_id) { if (false == Monitor.TryEnter(TodoListView.POSTLock)) { return; } var json = new Json(); var data = new Dictionary<string, string>(); data["todo_id"] = todo_id.ToString(); data["api_key"] = Globals.theSettings.API_Key; data["username"] = Globals.theSettings.username; var appDelegate = UIApplication.SharedApplication.Delegate as AppDelegate; var notificationView = new GCDiscreetNotificationView ( text: "Deleting todo", activity: false, presentationMode: GCDNPresentationMode.Bottom, view: appDelegate.navigationController.View ); notificationView.SetShowActivity(true, true); notificationView.Show (true); json.ContentType = "application/json"; try { json.PostData = Newtonsoft.Json.JsonConvert.SerializeObject (data); var endpoint = String.Concat(Globals.EndpointBase, "/api/v1/account/del_todo"); await json.PostAsync(endpoint); json.XPath = "/json/status"; if ("\"success\"" == json.XText) { await TodoListView._kludge.LoadTodo(); TodoListView._kludge.dataSource.ReloadData(); TodoListView._kludge.listView.ReloadData(); } else { json.XPath = "/json/data/message"; var newStr = json.XText.Replace("\"", ""); DisplayAlert("Alert", newStr, "OK"); } } catch (Exception e) { Application.Debug(e.Message); DisplayAlert ("Alert", "Unable to delete the todo", "OK"); } notificationView.Hide (true); Monitor.Exit(TodoListView.POSTLock); }