private void DeleteClick(object sender, RoutedEventArgs e)
        {
	        PlatformFileAccess.DeleteFile(MyDataFileName);

			var prompt = new MessagePrompt { Title = "Deleted", Message = "data deleted" };
			prompt.Show();
        }
 public void Show(string message, bool isCancelVisibled = false)
 {
     //var currentAccentBrush = (System.Windows.Media.Brush)Application.Current.Resources["PhoneAccentBrush"];
     var messagePrompt = new MessagePrompt
     {
         Message = message + "\r\n",
         Background = new SolidColorBrush
         {
             Color = Colors.Black,
             //Color = Color.FromArgb(255, 102, 65, 33),
             Opacity = 0.5
         },
         FontSize = 30,
         Width = 400,
         HorizontalAlignment = HorizontalAlignment.Center,
         VerticalAlignment = VerticalAlignment.Center,
         IsCancelVisible = isCancelVisibled,
     };
     if (Body != null)
     {
         messagePrompt.Body = Body;
     }
     messagePrompt.Completed += messagePrompt_Completed;
     messagePrompt.Show();
 }
 //Show message box
 private void show_captcha()
 {
     MessagePrompt messagePrompt = new MessagePrompt();
     messagePrompt.Title = "Enter Captcha";
     messagePrompt.Body = new Captcha();
     messagePrompt.Completed += messagePrompt_Completed;
     messagePrompt.IsCancelVisible = true;
     messagePrompt.Show();
 }
		private void back_Click(object sender, RoutedEventArgs e)
		{
			var messagePrompt = new MessagePrompt
			{
				Title = "Advanced Message",
				Message = "When prompt is complete, i'll navigate back",
			};

			messagePrompt.Completed += navBack_Completed;

			messagePrompt.Show();
		}
		private void MessageClick(object sender, RoutedEventArgs e)
		{
			var messagePrompt = new MessagePrompt
			{
				Title = "Basic Message",
				Message = LongText,
			};

			messagePrompt.Completed += PopUpPromptStringCompleted;

			messagePrompt.Show();
		}
		private void newPage_Click(object sender, RoutedEventArgs e)
		{
			var messagePrompt = new MessagePrompt
			{
				Title = "Advanced Message",
				IsCancelVisible = true,
				Body = "Nav to MainPage on complete"
			};

			messagePrompt.Completed += navTo_Completed;

			messagePrompt.Show();
		}
Esempio n. 7
0
        public static void Show(string content, string title = "重要通知")
        {
            var bbs = new BBS(title, content);

            var messagePrompt = new MessagePrompt
            {
                Title = "公告栏",
                Body = bbs,
                IsCancelVisible = false
            };
            messagePrompt.Completed += messagePrompt_Completed;

            messagePrompt.Show();
        }
		private void NavToNewPageViaBodyButtonClick(object sender, RoutedEventArgs e)
		{
			var messagePrompt = new MessagePrompt
			{
				Title = "Advanced Message",
				IsCancelVisible = true,
			};

			var btn = new Button { Content = "Nav to MainPage" };
			btn.Click += (s, ee) => NavigationService.Navigate(new Uri("/MainPage.xaml", UriKind.Relative));
			messagePrompt.Body = btn;

			messagePrompt.Show();
		}
		private void MessageAdvancedClick(object sender, RoutedEventArgs e)
		{
			var messagePrompt = new MessagePrompt
			{
				Title = "Advanced Message",
				Message = "When complete, i'll navigate back",
				Overlay = _cornFlowerBlueSolidColorBrush,
				IsCancelVisible = true
			};

			messagePrompt.Completed += PopUpPromptStringCompleted;

			messagePrompt.Show();
		}
		private void InitializePrompt()
		{
			//var reuseObject = ReuseObject.IsChecked.GetValueOrDefault(false);

			if (_prompt != null)
			{
				_prompt.Completed -= PromptCompleted;
			}

			//if (!reuseObject || _prompt == null)
			{
				_prompt = new MessagePrompt();
			}

			_prompt.Completed += PromptCompleted;
		}
        public override void Alert(string message, string title, string okText, Action onOk) {
            this.Dispatch(() => {
                var alert = new MessagePrompt {
                    Title = title,
                    Message = message
                };
                var btn = new Button { Content = okText };
                btn.Click += (sender, args) => alert.Hide();

                if (onOk != null) { 
                    alert.Completed += (sender, args) => onOk();
                }
                alert.ActionPopUpButtons.Clear();
                alert.ActionPopUpButtons.Add(btn);
                alert.Show();
            });
        }
Esempio n. 12
0
        private async void Button_Click(object sender, RoutedEventArgs e)
        {

            if (!(textProblem.Text.Length > 0))
                MessageBox.Show(AppResources.MissingText);

            (FindName("Send") as Control).IsEnabled = false;
            SystemTray.SetProgressIndicator(this, new ProgressIndicator { IsVisible = true, IsIndeterminate = true, Text = "Sending..." });

            using (var webclient = new HttpClient(new OAuthProtectedResourceMessageHandler(t => { }) { ConsumerKey = "14a8a3b2e97716d92d21f1d66a58f6f3", ConsumerSecret = "f20f027623385fbafdb905622c78a5f18066ea00255390d3ffb61e16aa9b3dbe", AccessToken = "fd65690a317fbc6454dbbe15108160facc2b8d916889f2f88af9fd8656abe32a" }, true) { BaseAddress = new Uri("https://api.trello.com/1/") })
            {
                var result = await webclient.PostAsJsonAsync("cards",
                new
                {
                    name = textProblem.Text.Substring(0, 10),
                    desc = textProblem.Text.Substring(0, Math.Min(16384, textProblem.Text.Length)),
                    due = "null",
                    idList = "547c43fe357e27da9bf82d6c",
                    urlSource = "null",
                    labels = "blue"
                });

                try
                {
                    result.EnsureSuccessStatusCode();
                    var msg = new MessagePrompt() { Body = AppResources.RequestSent, Title = "SimInfo" };
                    msg.Completed += new EventHandler<PopUpEventArgs<string, PopUpResult>>((s, a) => { NavigationService.GoBack(); });
                    msg.Show();
                }
                catch (Exception)
                {
                    (new EmailComposeTask { To = "*****@*****.**", Subject = AppResources.TitleMailError, Body = textProblem.Text }).Show();
                }
                finally
                {
                    SystemTray.SetProgressIndicator(this, new ProgressIndicator { IsVisible = false });
                    (FindName("Send") as Control).IsEnabled = true;
                }

            }

        }
        private void SaveClick(object sender, RoutedEventArgs e)
        {
            var data = new TestSerializeClass();

            data.StringData = stringData.Text;

            int tempInt;
            int.TryParse(intData.Text, out tempInt);
            data.IntData = tempInt;

            if (dateTimeData.Value != null) 
                data.DateTimeData = dateTimeData.Value.Value;

            if (timeSpanData.Value != null) 
                data.TimeSpanData = timeSpanData.Value.Value;

            Serializer.Save(MyDataFileName, data);

            var prompt = new MessagePrompt {Title = "Saved", Message = "data saved"};
            prompt.Show();
        }
Esempio n. 14
0
		private void MessageCustomClick(object sender, RoutedEventArgs e)
		{
			var messagePrompt = new MessagePrompt
			{
				Title = "Custom Body Message",
				Background = _naturalBlueSolidColorBrush,
				Foreground = _aliceBlueSolidColorBrush,
				Overlay = _cornFlowerBlueSolidColorBrush,
				IsCancelVisible = true,

			};

			var btn = new Button { Content = "Msg Box" };
			btn.Click += (s, args) => resultBlock.Text = "Hi!";

			messagePrompt.Body = btn;

			messagePrompt.Completed += PopUpPromptStringCompleted;

			messagePrompt.Show();
		}
        public async Task<SyncOption> RequestSyncOption(SyncJobRequest request)
        {
            var tcs = new TaskCompletionSource<SyncOption>();

            var optionsControl = new SyncOptionsControl();
            var prompt = new MessagePrompt
            {
                Body = optionsControl
            };

            optionsControl.MessagePrompt = prompt;
            optionsControl.SetOptions(request);

            prompt.Completed += (sender, args) =>
            {
                if (args.PopUpResult == PopUpResult.Ok)
                {
                    var item = optionsControl.GetSelectedOption();
                    tcs.SetResult(item);
                }
                else
                {
                    tcs.SetCanceled();
                }
            };

            prompt.Show();

            try
            {
                var qualityResult = await tcs.Task;

                return qualityResult;
            }
            catch (TaskCanceledException)
            {
                return null;
            }
        }
Esempio n. 16
0
        private async void Add_Click(object sender, EventArgs e)
        {
            var prevData = await Storage.LoadAsync<byte[]>(IAPs.IAP_AdditionalLogin);
            if (prevData == null)
            {
                var msg = new MessagePrompt { Title = AppResources.NoAviableNumbersTitle, Message = AppResources.NoAviableNumbersMessage, IsCancelVisible = true };
                msg.Completed += msg_Completed;
                msg.Show();
                return;
            }
            var acc = BitConverter.ToInt32(ProtectedData.Unprotect(prevData, null), 0);

            if (acc <= 1 + (App.Current as App).currentInfoArray.Count())
            {
                var msg = new MessagePrompt { Title = AppResources.NoAviableNumbersTitle, Message = AppResources.NoAviableNumbersMessage, IsCancelVisible = true };
                msg.Completed += msg_Completed;
                msg.Show();
                return;
            }


            NavigationService.Navigate(new Uri("/MainPage.xaml?OtherLogin=1", UriKind.Relative));
        }
        public override void Confirm(string message, Action<bool> onConfirm, string title, string okText, string cancelText) {
            this.Dispatch(() => {
                var alert = new MessagePrompt {
                    Title = title,
                    Message = message
                };
                var btnYes = new Button { Content = okText };
                btnYes.Click += (sender, args) => {
                    alert.Hide();
                    onConfirm(true);
                };

                var btnNo = new Button { Content = cancelText };
                btnNo.Click += (sender, args) => {
                    alert.Hide();
                    onConfirm(false);
                };

                alert.ActionPopUpButtons.Clear();
                alert.ActionPopUpButtons.Add(btnYes);
                alert.ActionPopUpButtons.Add(btnNo);
                alert.Show();
            });
        }
Esempio n. 18
0
		private void MessageSuperClick(object sender, RoutedEventArgs e)
		{
			var messagePrompt = new MessagePrompt
			{
				Title = "Advanced Message",
				Background = _naturalBlueSolidColorBrush,
				Foreground = _aliceBlueSolidColorBrush,
				Overlay = _cornFlowerBlueSolidColorBrush,
			};

			var btnHide = new RoundButton { Content = "Hide" };
			btnHide.Click += (o, args) => messagePrompt.Hide();

			var btnComplete = new RoundButton { Content = "Complete" };
			btnComplete.Click += (o, args) => messagePrompt.OnCompleted(new PopUpEventArgs<string, PopUpResult> { PopUpResult = PopUpResult.Ok, Result = "You clicked the Complete Button" });

			messagePrompt.ActionPopUpButtons.Clear();
			messagePrompt.ActionPopUpButtons.Add(btnHide);
			messagePrompt.ActionPopUpButtons.Add(btnComplete);

			messagePrompt.Completed += PopUpPromptStringCompleted;

			messagePrompt.Show();
		}
        private void register()
        {

            bool isNetwork = NetworkInterface.GetIsNetworkAvailable();
            if (!isNetwork)
            {
                MessagePrompt prompt = new MessagePrompt();
                prompt.Title = "Error";

                prompt.Message = "Please check your internet connection";
                prompt.Show();

            }
            else
            {

                bool valid = true;
                if (!TextValidator.IsValidField(txtFirstname))
                {
                    MessagePrompt prompt = new MessagePrompt();
                    prompt.Title = "Error";

                    prompt.Message = "Please enter your firstname";
                    prompt.Show();
                    valid = false;
                }
                else if (!TextValidator.IsValidField(txtLastname))
                {

                    MessagePrompt prompt = new MessagePrompt();
                    prompt.Title = "Error";

                    prompt.Message = "Please enter your surname";
                    prompt.Show();
                    valid = false;


                }
                else if (!TextValidator.IsValidEmail(txtEmail.Text))
                {

                    MessagePrompt prompt = new MessagePrompt();
                    prompt.Title = "Error";

                    prompt.Message = "Please enter a valid email address";
                    prompt.Show();
                    
                    valid = false;


                }
                else if (!TextValidator.IsValdidPassword(txtPassword))
                {
                    MessagePrompt prompt = new MessagePrompt();
                    prompt.Title = "Error";

                    prompt.Message = "Please enter a password, minimum 5 chars";
                    prompt.Show();
                    
                    valid = false;


                }  

                if (valid)
                {
                    //register 
                    Dictionary<string, object> parameters = new Dictionary<string, object>();
                    parameters.Add("name", txtLastname.Text);
                    parameters.Add("email", txtEmail.Text);
                    parameters.Add("fname", txtLastname.Text);
                    parameters.Add("password", txtPassword.Text);
                    Language lang = (Language)languagePicker.SelectedItem;
                    
                    parameters.Add("language", lang.Taal);

                    if ((bool)chkNews.IsChecked)
                    {
                        parameters.Add("addtonews", 1);
                    }
                    else
                    {
                        parameters.Add("addtonews", 0);
                    }
                    
                    
                    PostClient proxy = new PostClient(parameters);
                    proxy.DownloadStringCompleted += proxy_DownloadStringCompleted;
                    String urlAddress = "http://bivoapp.eu01.aws.af.cm/rest/adduser";
                    proxy.DownloadStringAsync(new Uri(urlAddress, UriKind.Absolute));
                    pgrLoader.Visibility = Visibility.Visible;

                }
            }

        }
        void proxy_DownloadStringCompleted(object sender, WindowsPhonePostClient.DownloadStringCompletedEventArgs e)
        {
            LoginAntwoord antwoord = JsonConvert.DeserializeObject<LoginAntwoord>(e.Result);
            if (e.Error == null)
            {
                MessagePrompt prompt = new MessagePrompt();
                prompt.Title = "Success";
             
                prompt.Message = antwoord.Message;
                prompt.Show();

                prompt.Completed += prompt_Completed;

                
            }
            else
            {
                pgrLoader.Visibility = Visibility.Collapsed;
                MessagePrompt prompt = new MessagePrompt();
                prompt.Title = "Error";

                prompt.Message = antwoord.Message;
                prompt.Show();

            }
            
        }
Esempio n. 21
0
        void input_Completed(object sender, PopUpEventArgs<string, PopUpResult> e)
        {
            if (e.Result != null)
            {
                InputPrompt p = (InputPrompt)sender;

                if (TextValidator.IsValidEmail(p.Value))
                {
                    Dictionary<string, object> parameters = new Dictionary<string, object>();
                    parameters.Add("email", p.Value);

                    PostClient proxy = new PostClient(parameters);

                    proxy.DownloadStringCompleted += proxy_DownloadStringCompleted_SendMail;

                    String urlAddress = "http://bivoapp.eu01.aws.af.cm/rest/forgotpassword";
                    proxy.DownloadStringAsync(new Uri(urlAddress, UriKind.Absolute));
                }
                else
                {
              
                    MessagePrompt prompt = new MessagePrompt();
                    prompt.Title = "Error";
                    prompt.Message = "Please fill in a valid email address";
                    prompt.Show();
                }
            }
        }
Esempio n. 22
0
        private void Logout(object sender, RoutedEventArgs e)
        {
            MessagePrompt logoutPrompt = new MessagePrompt();
            logoutPrompt.Title = "Logout";
            logoutPrompt.Message = "Do you really want to logout?";
            logoutPrompt.IsCancelVisible = true;
            logoutPrompt.Completed += logoutPrompt_Completed;

            logoutPrompt.Show();



            
        }
Esempio n. 23
0
        void proxy_DownloadStringCompleted_Login(object sender, WindowsPhonePostClient.DownloadStringCompletedEventArgs e)
        {
            if (e.Error == null)
            {
                //Process the result... 
                string data = e.Result;

                LoginAntwoord antwoord = JsonConvert.DeserializeObject<LoginAntwoord>(data);

                if (antwoord.Success == "1")
                {
                    IsolatedStorageSettings settings = IsolatedStorageSettings.ApplicationSettings;
                    if (!settings.Contains("login"))
                    {

                        settings.Add("login", txtEmail.Text);
                        settings.Add("password", txtPassword.Text);
                    }
                    else
                    {
                        settings["login"] = txtEmail.Text;
                        settings["password"] = txtPassword.Text;
                    }
                    settings.Save();
                    
                    MessagePrompt p = new MessagePrompt();
                    p.Title = "Success";
                    p.Message = antwoord.Message;
                    p.Show();
                    LoggedIn();
                }
                else
                {
                    MessagePrompt p = new MessagePrompt();
                    p.Title = "Error";
                    p.Message = antwoord.Message;
                    p.Show();
                }
                 
            }
            else
            {
                MessagePrompt p = new MessagePrompt();
                p.Title = "Error";
                p.Message = e.Error.ToString();
                p.Show();
            }
            pgrLoader.Visibility = Visibility.Collapsed;
            //throw new NotImplementedException();
        }
Esempio n. 24
0
        void proxy_DownloadStringCompleted_SendMail(object sender, WindowsPhonePostClient.DownloadStringCompletedEventArgs e)
        {
            if (e.Error == null)
            {
                //Process the result... 
                string data = e.Result;

                LoginAntwoord antwoord = JsonConvert.DeserializeObject<LoginAntwoord>(data);

                if (antwoord.Success.Equals("1"))
                {
                    MessagePrompt prompt = new MessagePrompt();
                    prompt.Title = "Success";
                    prompt.Message = antwoord.Message;
                    prompt.Show();
                }
                else
                {
                    MessagePrompt prompt = new MessagePrompt();
                    prompt.Title = "Error";
                    prompt.Message = antwoord.Message;
                    prompt.Show();
                }
                
               

            }
            else
            {
                MessagePrompt prompt = new MessagePrompt();
                prompt.Title = "Error";
                prompt.Message = e.Error.ToString();
                prompt.Show();
            }
            pgrLoader.Visibility = Visibility.Collapsed;
            //throw new NotImplementedException();
        }
Esempio n. 25
0
        private void LoginOrMail(object sender, RoutedEventArgs e)
        {
            bool isNetwork = NetworkInterface.GetIsNetworkAvailable();
              if (!isNetwork)
            {
                MessagePrompt prompt = new MessagePrompt();
                prompt.Title = "Error";
                  prompt.Message = "Please check your internet connection";
                  prompt.Show();
            }
            else{
                IsolatedStorageSettings settings = IsolatedStorageSettings.ApplicationSettings;
                if (settings.Contains("login"))
                {
                    SendMail();
                }
                else 
                {
                    bool valid = true;
                    
                    if(!TextValidator.IsValidEmail(txtEmail.Text)){
                        MessagePrompt prompt = new MessagePrompt();
                        prompt.Title = "Error";
                        prompt.Message = "Please enter a valid email address";
                        prompt.Show();
                        valid = false;
                    }  else if (!TextValidator.IsValdidPassword(txtPassword))
                    {

                        MessagePrompt prompt = new MessagePrompt();
                        prompt.Title = "Error";
                        prompt.Message = "Please enter a valid password";
                        prompt.Show();
                        valid = false;


                    }
                    
                    if (valid)
                    {
                        login();
                        
                    }
                }
              }
        }
Esempio n. 26
0
        void proxy_DownloadStringCompleted(object sender, WindowsPhonePostClient.DownloadStringCompletedEventArgs e)
        {
            if (e.Error == null)
            {
                string data = e.Result;
                string size = "";

                if (m.Cm.Equals("1"))
                {
                    size = " cm";
                }
                else 
                {
                    size = " inches";
                }

                if (m.Gender.Equals("M"))
                {
                    JToken root = JObject.Parse(data);
                    JToken result = root["CalculateSizeResult"];
                    MaleResult deserializedResult = JsonConvert.DeserializeObject<MaleResult>(result.ToString());
                    txtArm.Text = deserializedResult.Arm + size;
                    txtBack.Text = deserializedResult.Back + size;
                    txtBelly.Text = deserializedResult.Belly + size;
                    txtBmi.Text = deserializedResult.Bmi;
                    txtChest.Text = deserializedResult.Chest + size;
                    txtCollar.Text = deserializedResult.Collarsize + size;
                    txtPrediction.Text = deserializedResult.SizePredicition;
                    txtShoulder.Text = deserializedResult.Shoulder + size;
                    txtSleeve.Text = deserializedResult.Sleeve + size;
                    txtWaist.Text = deserializedResult.Waist + size;
                    txtWrist.Text = deserializedResult.Wrist + size;
                }
                else if (m.Gender.Equals("F"))
                {

                    JToken root = JObject.Parse(data);
                    JToken result = root["CalculateSizeResult"];
                    FemaleResult deserializedResult = JsonConvert.DeserializeObject<FemaleResult>(result.ToString());
                    txtUnderbust.Text = deserializedResult.UnderBust + size;
                    txtUpperbust.Text = deserializedResult.UpperBust + size;

                    txtArm.Text = deserializedResult.Arm + size;
                    txtBack.Text = deserializedResult.Back + size;


                    txtBmi.Text = deserializedResult.Bmi;
                    
                    
                    txtHips.Text = deserializedResult.Hips + size;
                    txtPrediction.Text = deserializedResult.SizePredicition;
                    txtShoulder.Text = deserializedResult.Shoulder + size;
                    txtSleeve.Text = deserializedResult.Sleeve + size;
                    txtWaist.Text = deserializedResult.Waist + size;
                    txtWrist.Text = deserializedResult.Wrist + size;
                    

                }

                SetBmiTextColor(txtBmi.Text);
                
            }
            else
            {
                MessagePrompt prompt = new MessagePrompt();
                prompt.Title = "Error";
                prompt.Message = e.Error.ToString();
                prompt.Show();

            }
            pgrLoader.Visibility = Visibility.Collapsed;
          
        }
Esempio n. 27
0
 private void appBarBtnViewNoteInfo_Click(object sender, EventArgs e)
 {
     var ucNoteDetail = new ViewNoteDetail()
     {
         Source = NoteEntity.Source,
         Author = NoteEntity.Author,
         CreatedTime = DateUtils.ConvertFromSecondsToLocalDatetime(NoteEntity.CreateTime),
         ModifiedTime = DateUtils.ConvertFromSecondsToLocalDatetime(NoteEntity.ModifyTime),
         Notebook = NoteEntity.NotebookName,
         WordCount = NoteEntity.Content.Length
     };
     var messagePrompt = new MessagePrompt
     {
         Title = "笔记信息",
         Body = ucNoteDetail,
         Background = new SolidColorBrush(ConstantPool.AppForeColor)
     };
     messagePrompt.Show();
 }
Esempio n. 28
0
        private void calculate_Click_1(object sender, RoutedEventArgs e)
        {

            bool isNetwork = NetworkInterface.GetIsNetworkAvailable();
            if (!isNetwork)
            {

                MessagePrompt prompt = new MessagePrompt();
                prompt.Title = "Error";

                prompt.Message = "Please check your internet connection";
                prompt.Show();

            }
            else
            {
                if (PivotInput.SelectedIndex == 0)
                {
                    Male wrapper = new Male();
                    String cmSetting = IsolatedStorageSettings.ApplicationSettings["cm"] as string;

                    if (cmSetting.Contains("2"))
                    {
                        Male height = (Male)height1Male.SelectedItem;
                        Male height2 = (Male)height2Male.SelectedItem;
                        wrapper.Height = height.Height.Replace(" feet", "'") + height2.Height.Replace(" inches", "");
                        

                        Male weight = (Male)weightMale.SelectedItem;
                        int index = weight.Weight.IndexOf('/');
                        wrapper.Weight = weight.Weight.Remove(index);

                      

                        Male collar = (Male)collarSizeMale.SelectedItem;
                        wrapper.CollarSize = collar.CollarSize.Replace(" inches", "");

                        wrapper.Cm = "2";
                    }
                    else
                    {
                        Male height = (Male)height1Male.SelectedItem;
                        wrapper.Height = height.Height;

                        Male weight = (Male)weightMale.SelectedItem;
                        wrapper.Weight = weight.Weight.Replace(" kg", "");

                        Male collar = (Male)collarSizeMale.SelectedItem;
                        wrapper.CollarSize = collar.CollarSize;

                        wrapper.Cm = "1";
                    }

                    
                    Male age = (Male)ageMale.SelectedItem;
                    

                    wrapper.Gender = "M";
                    
                    wrapper.Age = age.Age;
                    PhoneApplicationService.Current.State["Data"] = wrapper;
                    NavigationService.Navigate(new Uri("/ResultPage.xaml", UriKind.Relative));
                }
                else
                {
                    Female wrapper = new Female();
                    String cmSetting = IsolatedStorageSettings.ApplicationSettings["cm"] as string;

                    if (cmSetting.Contains("2"))
                    {
                        Female height = (Female)height1Female.SelectedItem;
                        Female height2 = (Female)height2Female.SelectedItem;
                        wrapper.Height = height.Height.Replace(" feet", "'") + height2.Height.Replace(" inches", "");
                      

                        Female weight = (Female)weightFemale.SelectedItem;
                        int index = weight.Weight.IndexOf('/');
                        wrapper.Weight = weight.Weight.Remove(index);

                        Female cup = (Female)cupFemale.SelectedItem;
                    Female bust = (Female)bustFemale.SelectedItem;

                    int indexCup = cupFemale.SelectedIndex;
                    int indexBust = bustFemale.SelectedIndex;

                    string cupEu = cupSizeCmSource[indexCup].CupSize;
                    string bustEu = cupLetterSource[indexBust].CupSize;


                    wrapper.CupSize = bust.CupSize.Replace(" ", "") + "-" + cup.CupSize + "/" + cupEu.Replace(" ", "") + "-" + bustEu;
                 
                    wrapper.Cm = "2";
                 
                    }
                    else
                    {
                        Female height = (Female)height1Female.SelectedItem;
                        wrapper.Height = height.Height;

                        Female weight = (Female)weightFemale.SelectedItem;
                        wrapper.Weight = weight.Weight.Replace(" kg", "");

                        Female cup = (Female)cupFemale.SelectedItem;
                        Female bust = (Female)bustFemale.SelectedItem;

                        int indexCup = cupFemale.SelectedIndex;
                        int indexBust = bustFemale.SelectedIndex;

                        string size = "";

                        if (bust.CupSize.Contains("eu"))
                        {
                            size = cupSizeCmSource[indexBust].CupSize;
                        }else if (bust.CupSize.Contains("fr"))
                        {
                            size = cupSizeCmSource[indexBust - 10].CupSize;
                        }
                        wrapper.CupSize = bust.CupSize.Replace(" ", "") + "-" + cup.CupSize + "/" + size.Replace(" ", "") + "-" + cup.CupSize;
                        
            

                        wrapper.Cm = "1";
                    }

                    wrapper.Gender = "F";
                    Measure age = (Measure)ageFemale.SelectedItem;
                    wrapper.Age = age.Age.Replace(" years", "");

                    Female arms = (Female)armFemale.SelectedItem;
                    wrapper.ArmLength = arms.ArmLength;

                    Female waist = (Female)waistFemale.SelectedItem;
                    wrapper.WaistSize = waist.WaistSize;

                    Female hips = (Female)hipFemale.SelectedItem;
                    wrapper.HipSize = hips.HipSize;
                  
                    PhoneApplicationService.Current.State["Data"] = wrapper;
                    NavigationService.Navigate(new Uri("/ResultPage.xaml", UriKind.Relative));
                }
               

           
            }

        }
Esempio n. 29
0
        public void AskQuestions(string title, Shared.Models.Question question, Action<int> completed)
        {
            Deployment.Current.Dispatcher.BeginInvoke(() =>
                {
                    var messagePrompt = new MessagePrompt
                    {
                        Title = title,
                        IsCancelVisible = true,
                        IsAppBarVisible = false
                    };

                    var listBox = new ListBox() { MaxWidth = 400, MaxHeight = 320 };
                    listBox.ItemsSource = question.Answers.Select(q => q.Text).ToArray();


                    listBox.ItemTemplate = Application.Current.Resources["AnswerItemTemplate"] as DataTemplate;
                    listBox.SelectionMode = SelectionMode.Single;

                    messagePrompt.Body = listBox;


                    messagePrompt.Completed += (sender, e) =>
                    {

                        if (e.PopUpResult != PopUpResult.Ok || listBox.SelectedIndex < 0)
                            return;

                        if (completed != null)
                            completed(listBox.SelectedIndex);
                    };

                    messagePrompt.Show();
                });
        }
 private static void CreateMsgPrompt(string message)
 {
     var msgPrompt = new MessagePrompt { Title = message, Message = message };
     msgPrompt.Show();
 }