private void ap_favsadd_click(object sender, EventArgs e)
        {
            using (MyDatafavcolors.favcolorsContext bc = new MyDatafavcolors.favcolorsContext())
            {
                MyDatafavcolors.Favcolors ct = bc.Favcolors.FirstOrDefault(c => c.Name == name);
                if (ct != null)
                {
                    if(mylogo.Text=="Nippon Colors")
                    {
                        var toast1 = new ToastPrompt
                        {
                            Message = "The color had been added."
                        };
                        toast1.Show();
                    }
                    else
                    {
                        var toast1 = new ToastPrompt
                        {
                            Message = "该颜色已添加。"
                        };
                        toast1.Show();
                    }
                    return;
                }
                ct = new MyDatafavcolors.Favcolors()
                {
                    ID = id,
                    Name = name,
                    Romaji = romaji,
                    Rcode = myR.Text,
                    Gcode = myG.Text,
                    Bcode = myB.Text,
                    Code = code,
                    Eromaji=eromaji
                };
                if (mylogo.Text == "Nippon Colors")
                {
                    var toast1 = new ToastPrompt
                    {
                        Message = "Successfully added."
                    };
                    toast1.Show();
                }
                else
                {
                    var toast1 = new ToastPrompt
                    {
                        Message = "添加成功。"
                    };
                    toast1.Show();
                }
                bc.Favcolors.InsertOnSubmit(ct);
                bc.SubmitChanges();

            }
        }
        private void Button_Click(object sender, RoutedEventArgs e)
        {
            if(flag==1000)
            {
                flag = 2;
            }

            if (flag % 2 == 0)
            {
                Button lbi = sender as Button;
                asd = lbi.Content.ToString();
                string MyUri = string.Format("/Select.xaml?0={0}", asd);
                this.NavigationService.Navigate(new Uri(MyUri, UriKind.Relative));
            }
            else
            {
                if (this.mylogo.Text == "Nippon Colors")
                {
                    if (MessageBox.Show("Really want to delete?", "", MessageBoxButton.OKCancel) == MessageBoxResult.OK)
                    {
                        Button lbi = sender as Button;
                        asd = lbi.Content.ToString();
                        using (MyDatafavcolors.favcolorsContext dc = new MyDatafavcolors.favcolorsContext())
                        {
                            MyDatafavcolors.Favcolors ct = dc.Favcolors.FirstOrDefault(c => c.Name == asd);
                            if (ct != null)
                            {
                                dc.Favcolors.DeleteOnSubmit(ct);
                                dc.SubmitChanges();
                            }
                        }
                    }
                    binddata();
                }
                else
                {
                    if (MessageBox.Show("确定要删除吗?", "", MessageBoxButton.OKCancel) == MessageBoxResult.OK)
                    {
                        Button lbi = sender as Button;
                        asd = lbi.Content.ToString();
                        using (MyDatafavcolors.favcolorsContext dc = new MyDatafavcolors.favcolorsContext())
                        {
                            MyDatafavcolors.Favcolors ct = dc.Favcolors.FirstOrDefault(c => c.Name == asd);
                            if (ct != null)
                            {
                                dc.Favcolors.DeleteOnSubmit(ct);
                                dc.SubmitChanges();
                            }
                        }
                        binddata();
                    }
                }
            }
        }
 private void binddata()
 {
     using (MyDatafavcolors.favcolorsContext dc = new MyDatafavcolors.favcolorsContext())
     {
         var res =
             from c in dc.Favcolors
             select c;
         this.myfavcolorlist.ItemsSource = res.ToList();
     }
 }