Ejemplo n.º 1
0
        private void HardwareButtons_BackPressed(object sender, BackPressedEventArgs e)
        {
            Frame frame = Window.Current.Content as Frame;

            if (frame == null)
            {
                return;
            }

            if (frame.CanGoBack)
            {
                frame.GoBack();
                e.Handled = true;
            }
            else
            {
                e.Handled = true;
                JMessBox jb = new JMessBox("再按一次离开");
                jb.Completed += (b) =>
                {
                    if (b)
                    {
                        //退出代码

                        Application.Current.Exit();
                    }
                };
                jb.Show();
            }
        }
Ejemplo n.º 2
0
        private void BTNSearch_Click(object sender, RoutedEventArgs e)
        {
            if (string.IsNullOrEmpty(this.TBMainSearch.Text))
            {
                JMessBox jb = new JMessBox("请输入内容");
                jb.Show();
            }
            else
            {
                string destination = "/DrugResultPage.xaml";

                if (isByKeywords)
                {
                    Dictionary <string, string> dic = new Dictionary <string, string>();
                    dic.Add("name", "drug");
                    dic.Add("keyword", this.TBMainSearch.Text);
                    PhoneApplicationService.Current.State["dic"] = dic;
                    destination += string.Format("?type={0}", "Drug");
                }
                else
                {
                    Dictionary <string, string> dic = new Dictionary <string, string>();
                    dic.Add("number", "国药准字Z" + this.TBMainSearch.Text);
                    PhoneApplicationService.Current.State["dic"] = dic;
                    destination += string.Format("?type={0}", "DrugNumber");
                }



                NavigationService.Navigate(new Uri(destination, UriKind.Relative));
            }
        }
Ejemplo n.º 3
0
 private void BTNSearch_Click(object sender, RoutedEventArgs e)
 {
     if (this.TBMainSearch.Text == "如:“发热”,“小儿”" || string.IsNullOrEmpty(this.TBMainSearch.Text))
     {
         JMessBox jb = new JMessBox("请输入内容");
         jb.Show();
     }
     else
     {
         string destination = "/GeneralResultPage.xaml";
         destination += string.Format("?keyword={0}&type={1}", this.TBMainSearch.Text, "Symptom");
         NavigationService.Navigate(new Uri(destination, UriKind.Relative));
     }
 }
Ejemplo n.º 4
0
        protected override void OnBackKeyPress(System.ComponentModel.CancelEventArgs e)
        {
            e.Cancel = true;

            JMessBox jb = new JMessBox("再按一次离开");

            jb.Completed += (b) =>
            {
                if (b)
                {
                    //退出代码

                    Application.Current.Terminate();
                }
            };
            jb.Show();
        }