private void twitter_Click(object sender, EventArgs e)
 {
     ShareStatusTask shareLinkTask = new ShareStatusTask();
     // shareLinkTask.Title = this.PageTitle.Text;
     shareLinkTask.Status = ContentText.Text;
     shareLinkTask.Show();
 }
 private void fb_Click(object sender, EventArgs e)
 {
     ShareStatusTask shareLinkTask = new ShareStatusTask();
     shareLinkTask.Status = ContentText.Text;
     //shareLinkTask.Message = ContentText.Text;
     shareLinkTask.Show();
 }
 public void send(string message)
 {
     var status = JsonHelper.Deserialize<string[]>(message)[0];
     var shareStatusTask = new ShareStatusTask { Status = status };
     shareStatusTask.Show();
     DispatchCommandResult(new PluginResult(PluginResult.Status.OK));
 }
Esempio n. 4
0
        public void share(string jsonArgs)
        {
            var options = JsonHelper.Deserialize<string[]>(jsonArgs);

            var message = options[0];
            var title = options[1];
            var files = JsonHelper.Deserialize<string[]>(options[2]);
            var link = options[3];

            if (link != null && !"null".Equals(link))
            {
                ShareLinkTask shareLinkTask = new ShareLinkTask();
                shareLinkTask.Title = title;
                shareLinkTask.LinkUri = new System.Uri(link, System.UriKind.Absolute);
                shareLinkTask.Message = message;
                shareLinkTask.Show();
            }
            else if (files != null && files.Length > 0)
            {
                ShareLinkTask shareLinkTask = new ShareLinkTask();
                shareLinkTask.Title = title;
                shareLinkTask.LinkUri = new System.Uri(files[0], System.UriKind.Absolute);
                shareLinkTask.Message = message;
                shareLinkTask.Show();
            }
            else
            {
                var shareStatusTask = new ShareStatusTask { Status = message };
                shareStatusTask.Show();
            }
            // unfortunately, there is no way to tell if something was shared, so just invoke the successCallback
            DispatchCommandResult(new PluginResult(PluginResult.Status.OK));
        }
Esempio n. 5
0
        public void ShareMessage(string message)
        {
            ShareStatusTask shareStatusTask = new ShareStatusTask();
            shareStatusTask.Status = message;

            shareStatusTask.Show();
        }
Esempio n. 6
0
        private void ApplicationBarIconButton_Click(object sender, EventArgs e)
        {
            ShareStatusTask shareStatusTask = new ShareStatusTask();

            shareStatusTask.Status = item.Title + ": "+item.Link;

            shareStatusTask.Show();
        }
Esempio n. 7
0
        private void SocialTextBlock_Tap(object sender, System.Windows.Input.GestureEventArgs e)
        {
            ShareStatusTask shareStatusTask = new ShareStatusTask();

            shareStatusTask.Status = shareText;

            shareStatusTask.Show();
        }
 private CurrentTasks()
 {
     shareStatusTask = new ShareStatusTask();
     emailComposeTask = new EmailComposeTask
     {
         Subject = "VidaDeProgramador", To = "*****@*****.**"
     };
 }
 private void ShareButton_Click(object sender, EventArgs e)
 {
     ShareStatusTask shareStatusTask = new ShareStatusTask();
     shareStatusTask.Status = "Checking out " + 
                              ((ItemDescriptionViewModel)DataContext).SelectedItem.Title +
                              " on " + AppSettings.ApplicationName;
     shareStatusTask.Show();
 }
Esempio n. 10
0
 public void shareStatus(string serializedMessage)
 {
     string message = JSON.JsonHelper.Deserialize<string>(serializedMessage);
     ShareStatusTask shareStatusTask = new ShareStatusTask();
     shareStatusTask.Status = message;
     shareStatusTask.Show();
     this.DispatchCommandResult();
 }
 private void Compartilhar()
 {
     var shareStatusTask = new ShareStatusTask
     {
         Status = string.Format("Vou conferir a palestra {0} no #qcon12sp", Palestra.Nome)
     };
     shareStatusTask.Show();
 }
        protected void shareStatus(string msg)
        {
            ShareStatusTask shareStatusTask = new ShareStatusTask();
            shareStatusTask.Status = msg;
            shareStatusTask.Show();

            this.DispatchCommandResult();
        }
Esempio n. 13
0
    public void ShareText(string text)
    {
      var task = new ShareStatusTask
      {
        Status = text
      };

      task.Show();
    }
Esempio n. 14
0
        private void SocialNetwork_OnTap(object sender, GestureEventArgs e)
        {
            var shareStatusTask = new ShareStatusTask
            {
                Status = _infoSharing.Quote
            };

            shareStatusTask.Show();
        }
 /// <summary>
 /// Share
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void ApplicationBarIconButton_Click_1(object sender, EventArgs e)
 {
     if (selectedItem != null)
     {
         ShareStatusTask shareStatusTask = new ShareStatusTask();
         shareStatusTask.Status = selectedItem.dc_description;
         shareStatusTask.Show();
     }
 }
        /// <summary>
        /// Shares a title and content text.
        /// </summary>
        /// <param name="title"></param>
        /// <param name="content"></param>
        public void ShareText(string title, string content)
        {
            var shareStatusTask = new ShareStatusTask
            {
                Status = title + " : " + content
            };

            shareStatusTask.Show();
        }
        private void ButtonShare_Click(object sender, RoutedEventArgs e)
        {
            var task = new ShareStatusTask
            {
                Status = "I just completed the #XamarinEvolve Quest and scored an awesome prize!"
            };

            task.Show();
        }
Esempio n. 18
0
        /// <summary>
        /// Simply share text on compatible services
        /// </summary>
        /// <param name="text">Text to share</param>
        /// <param name="title">Title of popup on share (not included in message)</param>
        /// <returns>awaitable Task</returns>
        public async Task Share(string text, string title = null)
        {
            var task = new ShareStatusTask
            {
                Status = text ?? string.Empty
            };

            Deployment.Current.Dispatcher.BeginInvoke(task.Show);
        }
        public async Task Share(string text, string title = null)
        {
            var task = new ShareStatusTask
            {
                Status = text
            };

            task.Show();
        }
Esempio n. 20
0
 private void ApplicationBarIconButton_Share(object sender, EventArgs e)
 {
     if (!_timer.IsEnabled)
     {
     TimeSpan runTime = TimeSpan.FromMilliseconds(System.Environment.TickCount - _startTime);
     ShareStatusTask shareStatusTask = new ShareStatusTask();
     shareStatusTask.Status = "J'ai parcouru " + string.Format("{0:f2} km", _kilometres) + " en " + runTime.ToString(@"hh\:mm\:ss") + " et perdu " + string.Format("{0:f0}", _kilometres * 65) + " calories ";
     shareStatusTask.Show();
     }
 }
        private void SocialNetworks_MenuItem_Click(object sender, RoutedEventArgs e)
        {
            string message = GenerateShareMessage(sender);

            if (!String.IsNullOrEmpty(message))
            {
                ShareStatusTask wbt = new ShareStatusTask()
                {
                    Status = message
                };
                wbt.Show();
            }
        }
Esempio n. 22
0
        private void BtnShareClick(object sender, EventArgs e)
        {
            if (BackgroundAudioPlayer.Instance.Track == null)
            {
                return;
            }
            ShareStatusTask share = new ShareStatusTask()
            {
                Status = String.Format("YOU ARE LISTENING {0} ON STEREO PESARO www.stereopesaro.it", BackgroundAudioPlayer.Instance.Track.Tag)
            };

            share.Show();
        }
Esempio n. 23
0
 private void ShareWeatherBtn_Click(object sender, EventArgs e)
 {
     WeatherViewModel WVM = WeatherViewModel.GetInstanse();
     City CurrentCity = WVM.GetCurrentCity();
     if (CurrentCity != null)
     {
         ShareStatusTask ShareWeatherStatus = new ShareStatusTask()
         {
             Status = "It's " + CurrentCity.CityCurrentWeather.Temperature + "(" + CurrentCity.CityCurrentWeather.WeatherDescription + ") at " + CurrentCity.CityName + "," + CurrentCity.CountryName  
         };
         ShareWeatherStatus.Show();
     }
 }
Esempio n. 24
0
 private async void MicButton_Tap(object sender, System.Windows.Input.GestureEventArgs e)
 {
     SpeechRecognizerUI sr = new SpeechRecognizerUI();
     sr.Settings.ListenText = "Let's go to the beach";
     sr.Settings.ReadoutEnabled = false;
     sr.Settings.ShowConfirmation = true;
     SpeechRecognitionUIResult result = await sr.RecognizeWithUIAsync();
     if (result.ResultStatus == SpeechRecognitionUIStatus.Succeeded)
     {
         ShareStatusTask task = new ShareStatusTask();
         task.Status = result.RecognitionResult.Text;
         task.Show();
     }
 }
Esempio n. 25
0
        private void appbar_share_click(object sender, EventArgs e)
        {
            try
            {
                ShareStatusTask shareStatusTask = new ShareStatusTask();
                shareStatusTask.Status = string.Format("{0} is now {1} weeks old! #proudparent #Rascals #WP8", _kid.Name, _info.GetWeeks(_kid.DateOfBirth));
                shareStatusTask.Show();
            }
            catch (Exception)
            {

                MessageBox.Show("Something went wrong, don't worry, we are on top of it.");
            }
        }
 public void ShareStatus(string status)
 {
     var task = new ShareStatusTask {Status = status};
     Device.BeginInvokeOnMainThread(() =>
         {
             try
             {
                 task.Show();
             }
             catch (Exception ex)
             {;
             }
         });
 }
Esempio n. 27
0
        private void AppbarMenuItem_Share_Click(object sender, EventArgs e)
        {
            string body = "" + System.Environment.NewLine + System.Environment.NewLine
                          + "Name: " + TextBox_Name.Text + System.Environment.NewLine
                          + "Location: " + TextBox_Latitude.Text + ", " + TextBox_Longitude.Text + System.Environment.NewLine
                          + "Address: " + TextBox_Address.Text + System.Environment.NewLine
                          + "Phone: " + TextBox_PhoneNum.Text + System.Environment.NewLine
                          + "Note:" + TextBox_Note.Text + System.Environment.NewLine;

            ShareStatusTask shareStatusTask = new ShareStatusTask();

            shareStatusTask.Status = body;
            shareStatusTask.Show();
        }
Esempio n. 28
0
 private void twit_click(object sender, EventArgs e)
 {
     if (textBox2.Text == "")
     {
         MessageBox.Show("Please enter some text and try again!", "TweetShort", MessageBoxButton.OK);
         textBox1.Text = "";
         //textBox1.Focus();
     }
     else
     {
         ShareStatusTask sharestat = new ShareStatusTask();
         sharestat.Status = textBox2.Text;
         sharestat.Show();
     }
 }
Esempio n. 29
0
        void wc_OpenReadCompleted(object sender, OpenReadCompletedEventArgs e)
        {
            Stream stream       = e.Result;
            var    reader       = new StreamReader(stream);
            var    shortenedUrl = reader.ReadToEnd();


            loadingBar.Visibility = Visibility.Collapsed;

            ShareStatusTask shareStatusTask = new ShareStatusTask();

            shareStatusTask.Status = String.Format("Check out this perk: {0}. More at {1}", Helper.venues[_currentVenueControlId].message, shortenedUrl);

            shareStatusTask.Show();
        }
 private void AppShow_Click(object sender, EventArgs e)
 {
     // Демо версия
     if (App.isTrial)
     {
         MessageBox.Show("Данная функция доступна в полной версии приложения.", "Поделиться головоломкой с другом", MessageBoxButton.OK);
     }
     else
     {
         ShareStatusTask sharedStatusTask = new ShareStatusTask()
         {
             Status = "[#Головоломки]\n" + App.ViewModel.Items[AppHelper.PageIndex].LineThree
         };
         sharedStatusTask.Show();
     }
 }
Esempio n. 31
0
        public void ShareStatus(string status)
        {
            var task = new ShareStatusTask {
                Status = status
            };

            Device.BeginInvokeOnMainThread(() =>
            {
                try
                {
                    task.Show();
                }
                catch (Exception ex)
                {; }
            });
        }
Esempio n. 32
0
 private void ShareArticle()
 {
     try
     {
         var shareStatusTask = new ShareStatusTask
         {
             Status = Article.Url.ToString()
         };
         shareStatusTask.Show();
     }
     catch (Exception exception)
     {
         if (Debugger.IsAttached)
         {
             Debug.WriteLine("ArticleViewModel:" + exception);
         }
     }
 }
Esempio n. 33
0
        private void ContextMenuItemShare_Tap(object sender, System.Windows.Input.GestureEventArgs e)
        {
            var holdedItem = (sender as MenuItem).DataContext as PushPinModel;

            CultureInfo cc   = Thread.CurrentThread.CurrentCulture;
            string      body = "" + System.Environment.NewLine + System.Environment.NewLine
                               + "Name: " + holdedItem.Name + System.Environment.NewLine
                               + "Location: " + holdedItem.Location.ToString() + System.Environment.NewLine
                               + "Address: " + holdedItem.Address + System.Environment.NewLine
                               + "Link: " + string.Format("http://maps.google.com/maps?q={0},{1}&hl={2}", holdedItem.Location.Latitude, holdedItem.Location.Longitude, cc.ToString())
                               + "Phone: " + holdedItem.PhoneNum + System.Environment.NewLine
                               + "Note:" + holdedItem.Note + System.Environment.NewLine;

            ShareStatusTask shareStatusTask = new ShareStatusTask();

            shareStatusTask.Status = body;
            shareStatusTask.Show();
        }
Esempio n. 34
0
        private void TargetLocationContextMenuItemShare_Tap(object sender, System.Windows.Input.GestureEventArgs e)
        {
            if (Target == null)
            {
                return;
            }

            string etaString;

            if (double.IsNaN(ETA) == true)
            {
                etaString = "--";
            }
            else
            {
                etaString = (DateTime.Now + TimeSpan.FromSeconds((int)ETA)).ToLongTimeString();
            }

            CultureInfo cc   = Thread.CurrentThread.CurrentCulture;
            string      body = "" + System.Environment.NewLine + System.Environment.NewLine
                               + "To: " + System.Environment.NewLine
                               + " Name: " + Target.Name + System.Environment.NewLine
                               + " Location: " + Target.Location.ToString() + System.Environment.NewLine
                               + " Address: " + Target.Address + System.Environment.NewLine
                               + " Distance: " + Utility.ConvertDistanceWithUnit(Distance) + System.Environment.NewLine
                               + " ETA: " + etaString + "(" + Utility.ConvertETAWithUnit(ETA) + ")" + System.Environment.NewLine
                               + "Link: " + string.Format("http://maps.google.com/maps?q={0},{1}&hl={2}", Target.Location.Latitude, Target.Location.Longitude, cc.ToString())
                               + System.Environment.NewLine
                               + "From: " + System.Environment.NewLine
                               + " Location: " + Sensor.Location.ToString() + System.Environment.NewLine
                               + " Date/Time: " + DateTime.Now.ToString() + System.Environment.NewLine
                               + "Link: " + string.Format("http://maps.google.com/maps?q={0},{1}&hl={2}", Sensor.Latitude, Sensor.Longitude, cc.ToString())
                               + "Phone: " + Target.PhoneNum + System.Environment.NewLine
                               + System.Environment.NewLine;


            ShareStatusTask shareStatusTask = new ShareStatusTask();

            shareStatusTask.Status = body;
            shareStatusTask.Show();
        }
Esempio n. 35
0
        public void Status(Point location, string address, string shortUrl)
        {
            ShareStatusTask shareStatusTask = new ShareStatusTask();

            if (address != "")
            {
                shareStatusTask.Status = "My current location: " + address + "\n";
            }
            if (shortUrl != "")
            {
                shareStatusTask.Status += shortUrl + "&form=LMLTCC" + "\n";
            }
            if (location != null)
            {
                if (location.X != INVALID_X_Y && location.Y != INVALID_X_Y)
                {
                    shareStatusTask.Status = shareStatusTask.Status + "Latitude:" + location.X + " Longitude: " + location.Y + "\n";
                }
            }
            shareStatusTask.Show();
        }
Esempio n. 36
0
        /// <summary>
        /// Share a message with compatible services
        /// </summary>
        /// <param name="message">Message to share</param>
        /// <param name="options">Platform specific options</param>
        /// <returns>True if the operation was successful, false otherwise</returns>
        public Task <bool> Share(ShareMessage message, ShareOptions options = null)
        {
            if (message == null)
            {
                throw new ArgumentNullException(nameof(message));
            }

            try
            {
                if (message.Url == null)
                {
                    // ShareStatusTask
                    var task = new ShareStatusTask
                    {
                        Status = message.Text ?? string.Empty
                    };

                    Deployment.Current.Dispatcher.BeginInvoke(task.Show);
                }
                else
                {
                    // ShareLinkTask
                    var task = new ShareLinkTask
                    {
                        Title   = message.Title ?? string.Empty,
                        Message = message.Text ?? string.Empty,
                        LinkUri = new Uri(message.Url)
                    };

                    Deployment.Current.Dispatcher.BeginInvoke(task.Show);
                }

                return(Task.FromResult(true));
            }
            catch (Exception ex)
            {
                Console.WriteLine("Unable to share: " + ex.Message);
                return(Task.FromResult(false));
            }
        }
Esempio n. 37
0
        public void Share(byte[] data, string dataFilename, string text, string title, string desc, SocialShareDataTypes type)
        {
                        #if WINDOWS_PHONE
            if (data != null)
            {
                string filename;
                using (var m = new MediaLibrary())
                    using (var image = m.SavePicture(dataFilename + (type == SocialShareDataTypes.Image_PNG ? ".png" : ".jpg"), data))
                    {
                        filename = MediaLibraryExtensions.GetPath(image);
                    }

                var shareTask = new ShareMediaTask();
                shareTask.FilePath = filename;
                shareTask.Show();
            }
            else if (!string.IsNullOrEmpty(text))
            {
                var shareTask = new ShareStatusTask();
                shareTask.Status = text;
                shareTask.Show();
            }
                        #else
            shareText  = text;
            shareTitle = title;
            shareDesc  = desc;
            if (data != null)
            {
                shareImage        = true;
                shareDataFilename = dataFilename + (type == SocialShareDataTypes.Image_PNG ? ".png" : ".jpg");
                StreamManager.SaveFile(shareDataFilename, data, FolderLocations.Storage, imageSavedCallback);
            }
            else
            {
                imageSavedCallback(true);
            }
                        #endif
        }
Esempio n. 38
0
		public void Share(byte[] data, string dataFilename, string text, string title, string desc, SocialShareDataTypes type)
		{
			#if WINDOWS_PHONE
			if (data != null)
			{
				string filename;
				using (var m = new MediaLibrary())
				using (var image = m.SavePicture(dataFilename + (type == SocialShareDataTypes.Image_PNG ? ".png" : ".jpg"), data))
				{
					filename = MediaLibraryExtensions.GetPath(image);
				}

				var shareTask = new ShareMediaTask();
				shareTask.FilePath = filename;
				shareTask.Show();
			}
			else if (!string.IsNullOrEmpty(text))
			{
				var shareTask = new ShareStatusTask();
				shareTask.Status = text;
				shareTask.Show();
			}
			#else
			shareText = text;
			shareTitle = title;
			shareDesc = desc;
			if (data != null)
			{
				shareImage = true;
				shareDataFilename = dataFilename + (type == SocialShareDataTypes.Image_PNG ? ".png" : ".jpg");
				StreamManager.SaveFile(shareDataFilename, data, FolderLocations.Storage, imageSavedCallback);
			}
			else
			{
				imageSavedCallback(true);
			}
			#endif
		}
        public void ShareLink(string title = "", string status = "", string link = "")
        {

            Uri uriResult;
            bool isUriValid = Uri.TryCreate(link, UriKind.Absolute, out uriResult) && uriResult.Scheme == Uri.UriSchemeHttp;

            if (isUriValid)
            {
                ShareLinkTask shareLinkTask = new ShareLinkTask();
                shareLinkTask.Title = title;
                shareLinkTask.Message = status;
                shareLinkTask.LinkUri = new Uri(link, UriKind.Absolute);
                shareLinkTask.Show();

            }
            else
            {
                ShareStatusTask shareStatusTask = new ShareStatusTask();
                shareStatusTask.Status = title + status;
                shareStatusTask.Show();
            }

        }
Esempio n. 40
0
        private void Share(object sender, EventArgs e)
        {
            ShareTaskBase shareTask;

            if (string.IsNullOrWhiteSpace(_radioTaxi.Url))
            {
                shareTask = new ShareStatusTask
                {
                    Status = string.Format("Radio Taxi {0}. Teléfono: {1}", _radioTaxi.Nombre, _radioTaxi.Telefono),
                };
            }
            else
            {
                shareTask = new ShareLinkTask
                {
                    Title   = "Radio Taxi " + _radioTaxi.Nombre,
                    Message = string.Format("Teléfono: {0}, Web: {1}", _radioTaxi.Telefono, _radioTaxi.Url),
                    LinkUri = new Uri(_radioTaxi.Url, UriKind.Absolute)
                };
            }

            shareTask.Show();
        }
Esempio n. 41
0
        private void OnSelected()
        {
            ArticleContent ca    = APIManager.GetInstance().currentArticle;
            String         share = ca.title + " - 阅FM http://yue.fm/" + ca.short_id;

            switch (list[this.listBox.SelectedIndex].name)
            {
            case "weibo":
            case "tencent":
            case "douban":
                String uri = "/SocialStatusPage.xaml?type=" + list[this.listBox.SelectedIndex].name + "&share=" + share;
                (Application.Current.RootVisual as PhoneApplicationFrame).Navigate(new Uri(uri, UriKind.Relative));
                break;

            case "mail":
                EmailComposeTask ect = new EmailComposeTask();
                ect.Body = share;
                ect.Show();
                break;

            case "sms":
                SmsComposeTask sct = new SmsComposeTask();
                sct.Body = share;
                sct.Show();
                break;

            default:
                ShareStatusTask sst = new ShareStatusTask();
                sst.Status = share;
                sst.Show();
                break;
            }

            action();

            LayoutRootOutStoryboard.Begin();
        }
Esempio n. 42
0
        private void CurrentLocationContextMenuItemShare_Tap(object sender, System.Windows.Input.GestureEventArgs e)
        {
            /*
             * if (Sensor.GpsStatus != GeoPositionStatus.Ready)
             *  return;
             */
            if (Sensor.Location.IsUnknown)
            {
                return;
            }

            CultureInfo cc   = Thread.CurrentThread.CurrentCulture;
            string      body = "" + System.Environment.NewLine + System.Environment.NewLine
                               + "I'm Here Now: " + System.Environment.NewLine
                               + " Location: " + Sensor.Location.ToString() + System.Environment.NewLine
                               + " Date/Time: " + DateTime.Now.ToString() + System.Environment.NewLine
                               + "Link: " + string.Format("http://maps.google.com/maps?q={0},{1}&hl={2}", Sensor.Latitude, Sensor.Longitude, cc.ToString())
                               + System.Environment.NewLine;

            ShareStatusTask shareStatusTask = new ShareStatusTask();

            shareStatusTask.Status = body;
            shareStatusTask.Show();
        }
Esempio n. 43
0
 private void AppBarShare(object sender, EventArgs e)
 {
     ShareStatusTask status = new ShareStatusTask();
     status.Status = TranslationLabel.Text + Environment.NewLine + Environment.NewLine + "Transformé par HTML Translator";
     status.Show();
 }
Esempio n. 44
0
 private void AskToShare(object sender, EventArgs e)
 {
     ShareStatusTask shareStatusTask = new ShareStatusTask();
     shareStatusTask.Status = "Va retirer de l'argent!";
     shareStatusTask.Show();
 }
Esempio n. 45
0
        private void shareIdeaSocialNetworks_Click(object sender, EventArgs e)
        {
            ShareStatusTask shareStatusTask = new ShareStatusTask();

            shareStatusTask.Status = "Saved my " + (DataContext as IdeaViewModel).SelectedIdea.Title + " idea via Ideas http://www.windowsphone.com/en-US/apps/f18161dd-b3cf-4b7b-baf1-e161454939c1?fb_ref=wpcwam";
            shareStatusTask.Status += ". You interested?";
            shareStatusTask.Show();
        }
Esempio n. 46
0
        private void TwitterItemOnClick(object sender, EventArgs eventArgs)
        {
            try
            {
                ShareStatusTask shareStatusTask = new ShareStatusTask();
                string message = string.Empty;
                string name = string.Empty;
                if (MainPagePivot.SelectedIndex == 0)
                {
                    message = CalculateSinceBirth(_appSettings.Birthday1DateSetting,
                                            _appSettings.Birthday1TimeSetting,
                                            _appSettings.UseTime1CheckBoxSetting).GetDescription();
                    name = _appSettings.Birthday1NameSetting;
                }
                else if (MainPagePivot.SelectedIndex == 1)
                {
                    if (_appSettings.UsePerson2CheckBoxSetting)
                    {
                        message = CalculateSinceBirth(_appSettings.Birthday2DateSetting,
                                            _appSettings.Birthday2TimeSetting,
                                            _appSettings.UseTime2CheckBoxSetting).GetDescription();
                        name = _appSettings.Birthday2NameSetting;
                    }
                    else
                    {
                        MessageBox.Show("Please enable this person before trying to share their age.", "Not Enabled.", MessageBoxButton.OK);
                        return;
                    }
                }
                else if (MainPagePivot.SelectedIndex == 2)
                {
                    if (_appSettings.UsePerson3CheckBoxSetting)
                    {
                        message = CalculateSinceBirth(_appSettings.Birthday3DateSetting,
                                            _appSettings.Birthday3TimeSetting,
                                            _appSettings.UseTime3CheckBoxSetting).GetDescription();
                        name = _appSettings.Birthday3NameSetting;
                    }
                    else
                    {
                        MessageBox.Show("Please enable this person before trying to share their age.", "Not Enabled.", MessageBoxButton.OK);
                        return;
                    }
                }
                shareStatusTask.Status = name + " is " + message + " old right now. \n\nSent by the Age Tracker app for Windows Phone.";
                shareStatusTask.Show();
            }
            catch (InvalidOperationException ex)
            {

                //throw;
            }
        }
        public void Execute(object parameter)
        {
            RadDataBoundListBox listBox = ElementTreeHelper.FindVisualAncestor <RadDataBoundListBox>(parameter as DependencyObject);
            RadContextMenu      menu    = RadContextMenu.GetContextMenu(listBox);

            RadDataBoundListBoxItem item = ElementTreeHelper.FindVisualAncestor <RadDataBoundListBoxItem>(parameter as DependencyObject);

            int    chapterNo = 0;
            int    verseNo   = 0;
            string quranText = "";
            string verseText = "";

            if (item.Content is Verse)
            {
                Verse verse = (item.Content as Verse);

                int result = (Application.Current as App).db.SetLastRead(verse.chapter_id, verse.verse_id);

                if (result == 0)
                {
                    MessageBox.Show("Last Read upadate Failed.");
                }
                else
                {
                    //MessageBox.Show("Last Read Saved.");
                }
            }

            if (menu.Name == "menuVerse")
            {
                Verse verse = (item.Content as Verse);

                chapterNo = verse.chapter_id;
                verseNo   = verse.verse_id;
                quranText = verse.AyahText;
                verseText = verse.verse_text;
            }
            else if (menu.Name == "menuVerseCompare")
            {
                VerseCompare verse = (item.Content as VerseCompare);

                chapterNo = verse.SuraID;
                verseNo   = verse.VerseID;
                //quranText = verse.AyahText;
                verseText = verse.AyahText;
            }
            else if (menu.Name == "menuIndexItem")
            {
                IndexItem verse = (item.Content as IndexItem);

                chapterNo = verse.chapter_id;
                verseNo   = verse.verse_id;
                quranText = verse.AyahText;
                verseText = verse.VerseText;
            }
            else if (menu.Name == "menuTopicItem")
            {
                TopicItem verse = (item.Content as TopicItem);

                chapterNo = verse.chapter_id;
                verseNo   = verse.verse_id;
                quranText = verse.AyahText;
                verseText = verse.VerseText;
            }
            else if (menu.Name == "menuBookMark")
            {
            }
            else if (menu.Name == "menuSearchTerm")
            {
            }
            else
            {
                Verse verse = (item.Content as Verse);

                chapterNo = verse.chapter_id;
                verseNo   = verse.verse_id;
                quranText = verse.AyahText;
                verseText = verse.verse_text;
            }

            if (this.Name == "CopyCompleteCommand")
            {
                string shareTextArabTrans = quranText + " | '" + verseText + "' (" + chapterNo + ":" + verseNo + ")";
                //string shareTextTrans = "'"+verseText+"' (" + chapterNo + ":" + verseNo + ")";

                Clipboard.SetText(shareTextArabTrans);
                //MessageBox.Show("Copied to Clipboard: " + shareTextArabTrans);
            }
            else if (this.Name == "CopyCommand")
            {
                //string shareTextArabTrans = quranText + "  '" + verseText + "' (" + chapterNo + ":" + verseNo + ")";
                string shareTextTrans = "'" + verseText + "' (" + chapterNo + ":" + verseNo + ")";

                Clipboard.SetText(shareTextTrans);
                //MessageBox.Show("Copied to Clipboard: " + shareTextTrans);
            }
            else if (this.Name == "ShareCommand")
            {
                //string shareTextArabTrans = quranText + "  '" + verseText + "' (" + chapterNo + ":" + verseNo + ")";
                string shareTextTrans = "'" + verseText + "' (" + chapterNo + ":" + verseNo + ")";

                ShareStatusTask shareStatusTask = new ShareStatusTask();
                shareStatusTask.Status = shareTextTrans;
                shareStatusTask.Show();
            }
            else if (this.Name == "TweetCommand")
            {
                //string shareTextArabTrans = quranText + "  '" + verseText + "' (" + chapterNo + ":" + verseNo + ")";
                string shareTextTrans = "'" + verseText + "' (" + chapterNo + ":" + verseNo + ")";

                //http://web.quran360.com/site/verse/tr/26/ch/1/v/1

                shareTextTrans = shareTextTrans.Substring(0, 90);
                shareTextTrans = shareTextTrans + "... (cont) http://web.quran360.com/site/verse/tr/" + AppSettings.TransSetting + "/ch/" + chapterNo + "/v/" + verseNo;

                ShareStatusTask shareStatusTask = new ShareStatusTask();
                shareStatusTask.Status = shareTextTrans;
                shareStatusTask.Show();
            }
            else if (this.Name == "EmailCommand")
            {
                string shareSubject = "Quran360 Share | Quran (" + chapterNo + ":" + verseNo + ")";

                string shareTextArabTrans = quranText + "  '" + verseText + "' (" + chapterNo + ":" + verseNo + ")";
                //string shareTextTrans = "'" + verseText + "' (" + chapterNo + ":" + verseNo + ")";

                Microsoft.Phone.Tasks.EmailComposeTask email = new Microsoft.Phone.Tasks.EmailComposeTask();
                email.Subject = shareSubject;
                email.Body    = shareTextArabTrans;
                email.Show();
            }
            else if (this.Name == "SmsCommand")
            {
                string shareSubject = "Read Quran: (" + chapterNo + ":" + verseNo + ")";

                //string shareTextArabTrans = quranText + "  '" + verseText + "' (" + chapterNo + ":" + verseNo + ")";
                string shareTextTrans = "'" + verseText + "' (" + chapterNo + ":" + verseNo + ")";

                Microsoft.Phone.Tasks.SmsComposeTask sms = new Microsoft.Phone.Tasks.SmsComposeTask();
                sms.Body = shareTextTrans;
                sms.Show();
            }
            else if (this.Name == "SetCheckPointCommand")
            {
                try
                {
                    //int chapterNo = (item.Content as Verse).chapter_id;
                    //int verseNo = (item.Content as Verse).verse_id;
                    int result = (Application.Current as App).db.SetBookMark(chapterNo, verseNo, -1);

                    if (result == 0)
                    {
                        MessageBox.Show("ReadPoint Failed.");
                    }
                    else
                    {
                        //MessageBox.Show("ReadPoint Saved.");
                    }
                }
                catch (Exception ex)
                {
                    System.Diagnostics.Debug.WriteLine("SetCheckPointCommand failed: " + ex.StackTrace);
                }
            }
            else if (this.Name == "SetBookmarkCommand")
            {
                try
                {
                    //int chapterNo = (item.Content as Verse).chapter_id;
                    //int verseNo = (item.Content as Verse).verse_id;
                    int result = (Application.Current as App).db.SetBookMark(chapterNo, verseNo, (verseNo - 1));

                    if (result == 0)
                    {
                        MessageBox.Show("BookMark Failed.");
                    }
                    else
                    {
                        //MessageBox.Show("BookMark Saved.");
                    }
                }
                catch (Exception ex)
                {
                    System.Diagnostics.Debug.WriteLine("SetBookmarkCommand failed: " + ex.StackTrace);
                }
            }
            else if (this.Name == "PlayCommand")
            {
                Verse verse = (item.Content as Verse);

                String url = "http://web.quran360.com/audio/v_saad_al_ghaamidi/00" + verse.chapter_id + "/00" + verse.chapter_id + "00" + verse.verse_id + ".mp3";
            }
            else if (this.Name == "PauseCommand")
            {
            }
            else if (this.Name == "StopCommand")
            {
            }
            else if (this.Name == "DeleteBookMarkCommand")
            {
                BookMark bookMark = (item.Content as BookMark);
                int      result   = (Application.Current as App).db.DeleteBookMark(bookMark.id);

                if (result == 0)
                {
                    MessageBox.Show("Delete BookMark Failed.");
                }
                else if (result == 2)
                {
                    MessageBox.Show("Cannot Delete ReadPoint.");
                }
                else
                {
                    //MessageBox.Show("Delete BookMark Success.");
                }
            }
            else if (this.Name == "DeleteSearchTermCommand")
            {
                SearchTerm searchTerm = (item.Content as SearchTerm);
                int        result     = (Application.Current as App).db.DeleteSearchTerm(searchTerm.id);

                if (result == 0)
                {
                    MessageBox.Show("Delete Search Failed.");
                }
                else
                {
                    //MessageBox.Show("Delete Search Success.");
                }
            }
            //this.ScheduleNotification(menu, item);
        }
Esempio n. 48
0
        private void Button2_Click(object sender, RoutedEventArgs e)
        {
            MediaLibrary _mediaLibrary = new MediaLibrary();

            using (IsolatedStorageFile myIsolatedStorage = IsolatedStorageFile.GetUserStoreForApplication())
            {
                try
                {
                    TextBlock newTextBox = new TextBlock();

                    newTextBox.FontSize            = 30;
                    newTextBox.Foreground          = new System.Windows.Media.SolidColorBrush(System.Windows.Media.Colors.White);
                    newTextBox.Text                = "ScoreSoccer8";
                    newTextBox.HorizontalAlignment = System.Windows.HorizontalAlignment.Right;
                    newTextBox.VerticalAlignment   = System.Windows.VerticalAlignment.Bottom;
                    newTextBox.FontWeight          = FontWeights.Bold;
                    newTextBox.Opacity             = 0.5;
                    newTextBox.Margin              = new Thickness(10);
                    BorderToSave.Children.Add(newTextBox);

                    var bitmap = new WriteableBitmap(Convert.ToInt32(BorderToSave.ActualWidth), Convert.ToInt32(BorderToSave.ActualHeight));
                    bitmap.Render(BorderToSave, null);
                    bitmap.Invalidate();

                    String tempJPEG = "logo.jpg";

                    IsolatedStorageFileStream fileStream = myIsolatedStorage.CreateFile(tempJPEG);

                    // Encode WriteableBitmap object to a JPEG stream.
                    Extensions.SaveJpeg(bitmap, fileStream, bitmap.PixelWidth, bitmap.PixelHeight, 0, 100);

                    fileStream.Close();
                    fileStream.Dispose();

                    IsolatedStorageFileStream stream = myIsolatedStorage.OpenFile(tempJPEG, FileMode.Open, FileAccess.Read);

                    //BitmapImage b = new BitmapImage();
                    //b.SetSource(stream);

                    //EmailComposeTask emailComposeTask = new EmailComposeTask();

                    //emailComposeTask.Subject = "Stats";
                    //emailComposeTask.Body = "Stats Of some game" + b.UriSource;
                    //emailComposeTask.To = "*****@*****.**";

                    //emailComposeTask.Show();

                    _mediaLibrary.SavePictureToCameraRoll("somefile.jpg", stream);

                    //ShareMediaTask shareMediaTask = new ShareMediaTask();
                    //shareMediaTask.FilePath = "somefile.jpg";
                    //shareMediaTask.Show();

                    ShareStatusTask shareStatusTask = new ShareStatusTask();
                    shareStatusTask.Status = "I'm developing a Windows Phone application!";
                    shareStatusTask.Show();

                    BorderToSave.Children.Remove(newTextBox);

                    stream.Close();
                    stream.Dispose();
                }
                catch (Exception ex)
                {
                    // Debug.WriteLine(ex.ToString());
                }
            }
        }