partial void HandleBtnSaveTouch(MonoTouch.Foundation.NSObject sender)
 {
     this._task.Name  = this.txtName.Text;
     this._task.Notes = this.txtNote.Text;
     TaskManager.SaveTask(this._task);
     this.NavigationController.PopViewControllerAnimated(true);
 }
Beispiel #2
0
 partial void cancelTerms(MonoTouch.Foundation.NSObject sender)
 {
     if (TermsDismissedEvent != null)
     {
         TermsDismissedEvent(false);
     }
 }
Beispiel #3
0
 partial void btnBackPressed(MonoTouch.Foundation.NSObject sender)
 {
     if (webViewMain.CanGoBack)
     {
         webViewMain.GoBack();
     }
 }
Beispiel #4
0
 partial void acceptTerms(MonoTouch.Foundation.NSObject sender)
 {
     if (TermsDismissedEvent != null)
     {
         TermsDismissedEvent(true);
     }
 }
Beispiel #5
0
 partial void btnForwardPressed(MonoTouch.Foundation.NSObject sender)
 {
     if (webViewMain.CanGoForward)
     {
         webViewMain.GoForward();
     }
 }
        /// <summary>
        /// Event handler when the user clicks the Take a Photo button
        /// </summary>
        /// <param name='sender'>
        /// Sender
        /// </param>
        partial void takePhotoBtnClicked(MonoTouch.Foundation.NSObject sender)
        {
            Console.WriteLine("takePhotoBtnClicked");

            picker = new MediaPicker();

            // Check if a camera is available and photos are supported on this device
            if (!picker.IsCameraAvailable || !picker.PhotosSupported)
            {
                ShowUnsupported();
                return;
            }

            // Call TakePhotoAsync, which gives us a Task<MediaFile>
            picker.TakePhotoAsync(new StoreCameraMediaOptions
            {
                Name      = "test.jpg",
                Directory = "MediaPickerSample"
            })
            .ContinueWith(t =>              // Continue when the user has taken a photo
            {
                if (t.IsCanceled)           // The user canceled
                {
                    return;
                }

                // Show the photo the user took
                InvokeOnMainThread(delegate {
                    UIImage image        = UIImage.FromFile(t.Result.Path);
                    this.imageView.Image = image;
                });
            });
        }
        /// <summary>
        /// Event handler when the user clicks the Pick a Photo button
        /// </summary>
        /// <param name='sender'>
        /// Sender
        /// </param>
        partial void pickPhotoBtnClicked(MonoTouch.Foundation.NSObject sender)
        {
            Console.WriteLine("pickPhotoBtnClicked");

            picker = new MediaPicker();

            // Check if photos are supported on this device
            if (!picker.PhotosSupported)
            {
                ShowUnsupported();
                return;
            }

            // Call PickPhotoAsync, which gives us a Task<MediaFile>
            picker.PickPhotoAsync()
            .ContinueWith(t =>              // Continue when the user has picked a photo
            {
                if (t.IsCanceled)           // The user canceled
                {
                    return;
                }

                // Show the photo the user selected
                InvokeOnMainThread(delegate {
                    UIImage image        = UIImage.FromFile(t.Result.Path);
                    this.imageView.Image = image;
                });
            });
        }
        /// <summary>
        /// Event handler when the user clicks the pick a video button
        /// </summary>
        /// <param name='sender'>
        /// Sender
        /// </param>
        partial void pickVideoBtnClicked(MonoTouch.Foundation.NSObject sender)
        {
            Console.WriteLine("pickVideoBtnClicked");

            picker = new MediaPicker();

            // Check that videos are supported on this device
            if (!picker.VideosSupported)
            {
                ShowUnsupported();
                return;
            }

            //
            // Call PickideoAsync, which returns a Task<MediaFile>
            picker.PickVideoAsync()
            .ContinueWith(t =>              // Continue when the user has picked a video
            {
                if (t.IsCanceled)           // The user canceled
                {
                    return;
                }

                // Play the video the user picked
                InvokeOnMainThread(delegate {
                    moviePlayer = new MPMoviePlayerViewController(NSUrl.FromFilename(t.Result.Path));
                    moviePlayer.MoviePlayer.UseApplicationAudioSession = true;
                    this.PresentMoviePlayerViewController(moviePlayer);
                });
            });
        }
        /// <summary>
        /// Event handler when the user clicks the Take a Video button
        /// </summary>
        /// <param name='sender'>
        /// Sender
        /// </param>
        partial void takeVideoBtnClicked(MonoTouch.Foundation.NSObject sender)
        {
            Console.WriteLine("takeVideoBtnClicked");

            picker = new MediaPicker();

            // Check if a camera is available and videos are supported on this device
            if (!picker.IsCameraAvailable || !picker.VideosSupported)
            {
                ShowUnsupported();
                return;
            }

            // Call TakeVideoAsync, which returns a Task<MediaFile>.
            picker.TakeVideoAsync(new StoreVideoOptions
            {
                Quality       = VideoQuality.Medium,
                DesiredLength = new TimeSpan(0, 0, 30)
            })
            .ContinueWith(t =>              // Continue when the user has finished recording
            {
                if (t.IsCanceled)           // The user canceled
                {
                    return;
                }

                // Play the video the user recorded
                InvokeOnMainThread(delegate {
                    moviePlayer = new MPMoviePlayerViewController(NSUrl.FromFilename(t.Result.Path));
                    moviePlayer.MoviePlayer.UseApplicationAudioSession = true;
                    this.PresentMoviePlayerViewController(moviePlayer);
                });
            });
        }
        async partial void doIt(MonoTouch.Foundation.NSObject sender)
        {
            var client = new HttpClient(new AFNetworkHandler());

            currentToken = new CancellationTokenSource();
            var st = new Stopwatch();

            st.Start();
            try {
                var url = "https://github.com/paulcbetts/ModernHttpClient/releases/download/0.9.0/ModernHttpClient-0.9.zip";
                //var url = "https://github.com/downloads/nadlabak/android/cm-9.1.0a-umts_sholes.zip";

                resp = await client.GetAsync(url, HttpCompletionOption.ResponseHeadersRead, currentToken.Token);

                result.Text = "Got the headers!";

                var bytes = await resp.Content.ReadAsByteArrayAsync();

                result.Text = String.Format("Read {0} bytes", bytes.Length);

                var md5       = MD5.Create();
                var md5Result = md5.ComputeHash(bytes);
                md5sum.Text = ToHex(md5Result, false);
            } catch (Exception ex) {
                result.Text = ex.ToString();
            } finally {
                st.Stop();
                result.Text = (result.Text ?? "") + String.Format("\n\nTook {0} milliseconds", st.ElapsedMilliseconds);
            }
        }
 partial void twentyPosts(MonoTouch.Foundation.NSObject sender)
 {
     for (int i = 0; i < 20; i++)
     {
         PostAsync();
     }
 }
 partial void toggleWrap(MonoTouch.Foundation.NSObject sender)
 {
     Console.WriteLine("toggleWrap touched");
     wrap = !wrap;
     wrapBarItem.Title = wrap ? "Wrap: ON" : "Wrap: OFF";
     carousel.ReloadData();
 }
        partial void Action(MonoTouch.Foundation.NSObject sender)
        {
            var expr     = SimpleExpressions.TestConstant(count++);
            var variable = SimpleExpressions.TestVariable();

            Label.Text = string.Format("Expression: {0} - {1}", expr, variable);
        }
 partial void showWindow(MonoTouch.Foundation.NSObject sender)
 {
     hud = BindingLibrarySDK.MBProgressHUD.ShowHUDAddedTo(this.View, true);
     hud.Show(true);
     hud.LabelText = "加载中...";
     hud.Hide(true, 1);             // hide hud after 1s
 }
Beispiel #15
0
        public void ShareText(string text, string title = null)
        {
            var obj            = new MonoTouch.Foundation.NSObject[] { new NSString(text) };
            var viewController = new UIActivityViewController(obj, null);

            UIApplication.SharedApplication.KeyWindow.RootViewController.PresentViewControllerAsync(viewController, true);
        }
 partial void twoGets(MonoTouch.Foundation.NSObject sender)
 {
     for (int i = 0; i < 2; i++)
     {
         GetAsync();
     }
 }
Beispiel #17
0
        async partial void SearchForTrips(MonoTouch.Foundation.NSObject sender)
        {
            showLoading();
            await search();

            dismissLoading();
        }
Beispiel #18
0
        partial void Action(MonoTouch.Foundation.NSObject sender)
        {
            RunTests();

            var number = power.Compute(++current);

            Label.Text = string.Format("{0} is the power!", number);
        }
Beispiel #19
0
 partial void cancelIt(MonoTouch.Foundation.NSObject sender)
 {
     this.currentToken.Cancel();
     if (resp != null)
     {
         resp.Content.Dispose();
     }
 }
        partial void OnAddAnimalsClick(MonoTouch.Foundation.NSObject sender)
        {
            var sheet = new UIActionSheet("Add Animals");

            sheet.AddButton("Add Dog");
            sheet.AddButton("Add Kitten");
            sheet.Clicked += HandleAddAnimalClicked;
            sheet.ShowInView(this.View);
        }
        partial void HandleBtnCancelTouch(MonoTouch.Foundation.NSObject sender)
        {
            if (this._task.ID != 0)
            {
                TaskManager.DeleteTask(this._task.ID);
            }

            this.NavigationController.PopViewControllerAnimated(true);
        }
        partial void insertItem(MonoTouch.Foundation.NSObject sender)
        {
            Console.WriteLine("insertItem touched");
            int index   = Math.Max(0, carousel.CurrentItemIndex);
            var newItem = items.Count.ToString();

            items.Insert(index, newItem);
            carousel.InsertItemAtIndex(index, true);
        }
Beispiel #23
0
        partial void OnFriendsButtonPressed(MonoTouch.Foundation.NSObject sender)
        {
            var vc = this.Storyboard.InstantiateViewController("MenuFriendsViewController") as UIViewController;

            NavigationController.PushViewController(
                vc,
                true
                );
        }
 partial void removeItem(MonoTouch.Foundation.NSObject sender)
 {
     Console.WriteLine("removeItem touched");
     if (carousel.NumberOfItems > 0)
     {
         int index = carousel.CurrentItemIndex;
         items.RemoveAt(index);
         carousel.RemoveItemAtIndex(index, true);
     }
 }
Beispiel #25
0
 partial void deletePicture(MonoTouch.Foundation.NSObject sender)
 {
     if (item.imageKey != null)
     {
         string key = item.imageKey;
         BNRImageStore.deleteImageForKey(key);
         imageView.Image = null;
         item.imageKey   = null;
     }
 }
Beispiel #26
0
        partial void OnCreateButtonPressed(MonoTouch.Foundation.NSObject sender)
        {
            var vc = this.Storyboard.InstantiateViewController("MenuCreateViewController") as MenuCreateViewController;

            vc.IsFriendMatch = false;

            NavigationController.PushViewController(
                vc,
                true
                );
        }
Beispiel #27
0
 partial void btnReloadPressed(MonoTouch.Foundation.NSObject sender)
 {
     if (webViewMain.Request != null && webViewMain.Request.Url.AbsoluteString != textFieldUrl.Text)
     {
         LoadUrl(textFieldUrl.Text);
     }
     else
     {
         webViewMain.Reload();
     }
 }
Beispiel #28
0
        partial void btnOpenInSafariPressed(MonoTouch.Foundation.NSObject sender)
        {
            string link = textFieldUrl.Text;

            DismissModalViewControllerAnimated(false);

            // open in safari
            NSUrl url = new NSUrl(link);

            UIApplication.SharedApplication.OpenUrl(url);
        }
 partial void btnUpdatePressed(MonoTouch.Foundation.NSObject sender)
 {
     if (btnUpdate.Title == kButtonUpdateTitle)
     {
         SetCurrentView(ViewType.eUpdate);
     }
     else
     {
         LoadConfig();
     }
 }
Beispiel #30
0
 partial void boardButtonClick(MonoTouch.Foundation.NSObject sender)
 {
     try
     {
         playGameButton(sender as UIButton);
     }
     catch (GameException ex)
     {
         MessageBox.Show(ex.Message);
     }
 }
Beispiel #31
0
		private void ShowExtraMenu()
		{
			var changeset = ViewModel.Changeset;
			if (changeset == null)
				return;

			var sheet = MonoTouch.Utilities.GetSheet(Title);
			var addComment = sheet.AddButton("Add Comment".t());
			var copySha = sheet.AddButton("Copy Sha".t());
			var shareButton = sheet.AddButton("Share".t());
			//var showButton = sheet.AddButton("Show in GitHub".t());
			var cancelButton = sheet.AddButton("Cancel".t());
			sheet.CancelButtonIndex = cancelButton;
			sheet.DismissWithClickedButtonIndex(cancelButton, true);
			sheet.Clicked += (s, e) => 
			{
				try
				{
					// Pin to menu
					if (e.ButtonIndex == addComment)
					{
						AddCommentTapped();
					}
					else if (e.ButtonIndex == copySha)
					{
						UIPasteboard.General.String = ViewModel.Changeset.Sha;
					}
					else if (e.ButtonIndex == shareButton)
					{
						var item = new NSUrl(ViewModel.Changeset.Url);
						var activityItems = new MonoTouch.Foundation.NSObject[] { item };
						UIActivity[] applicationActivities = null;
						var activityController = new UIActivityViewController (activityItems, applicationActivities);
						PresentViewController (activityController, true, null);
					}
	//				else if (e.ButtonIndex == showButton)
	//				{
	//					ViewModel.GoToHtmlUrlCommand.Execute(null);
	//				}
				}
				catch
				{
				}
			};

			sheet.ShowInView(this.View);
		}