コード例 #1
0
        void HandleShareClick(object sender, EventArgs e)
        {
            var chb = FindViewById<CheckBox> (Resource.Id.checkMeet);
            var ti = new ShareSettings ();
            ti.CancelOnArrival = chb.Checked;
            ti.TimeoutMinutes = selectedTime;
            shareButton.Visibility = ViewStates.Gone;
            boxProgress.Visibility = ViewStates.Visible;

            ThreadPool.QueueUserWorkItem (delegate {
                try {
                    var trackUrl = TrackMeApp.PublishTarget (ti);
                    RunOnUiThread (delegate {
                        var intent = new Intent (Intent.ActionSend);
                        intent.SetType ("text/plain");
                        intent.PutExtra (Intent.ExtraSubject, Resources.GetString (Resource.String.shareSubject));
                        intent.PutExtra (Intent.ExtraText, trackUrl);
                        StartActivity (Intent.CreateChooser (intent, Resources.GetString (Resource.String.shareVia)));
                        Finish ();
                    });
                } catch (Exception ex) {
                    Console.WriteLine (ex);
                    RunOnUiThread (ShowError);
                }
            });
        }
コード例 #2
0
ファイル: TrackMeApp.cs プロジェクト: slluis/TrackMe
 public static string PublishTarget(ShareSettings timeoutInfo)
 {
     var ts = WebService.CreateLocationShare (TrackMeApp.LocalUser, timeoutInfo);
     lock (StatusLock) {
         Shares.Add (ts);
         SaveConfiguration ();
     }
     NotifySharesChanged ();
     return "https://app.trackme/" + ts.PublicId;
 }