Пример #1
0
        private void button_Copy_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                if (!IsEdit)
                {
                    if (!new PassWord(Config.Tables[0].Rows.Find("PassWord")[1].ToString()).ShowDialog().GetValueOrDefault(false))
                    {
                        return;
                    }
                }
                IsEdit = !IsEdit;
                if (IsEdit)
                {
                    if (Bor1.Children.Count > 1)
                    {
                        Bor1.Children.RemoveRange(1, Bor1.Children.Count - 1);
                    }
                    Button_MS.Visibility = Visibility.Visible;
                    switch (MS)
                    {
                    case 0:
                    {
                        PageOf3 pf = Bor1.Children[0] as PageOf3;
                        SetChild(pf.Border11);
                        SetChild(pf.Border21);
                        SetChild(pf.Border31);
                        pf.Border11_MouseLeftButtonDown(sender, null);
                        break;
                    }

                    case 1:
                    {
                        PageOf4 pf = Bor1.Children[0] as PageOf4;
                        SetChild(pf.Border11);
                        SetChild(pf.Border21);
                        SetChild(pf.Border31);
                        SetChild(pf.Border41);
                        pf.Border11_MouseLeftButtonDown(sender, null);
                        break;
                    }

                    case 2:
                    {
                        PageOf5 pf = Bor1.Children[0] as PageOf5;
                        SetChild(pf.Border11);
                        SetChild(pf.Border21);
                        SetChild(pf.Border31);
                        SetChild(pf.Border41);
                        SetChild(pf.Border51);
                        pf.Border11_MouseLeftButtonDown(sender, null);
                        break;
                    }

                    default: { break; }
                    }
                }
                else
                {
                    Button_MS.Visibility = Visibility.Hidden;
                    switch (MS)
                    {
                    case 0:
                    {
                        PageOf3 pf = Bor1.Children[0] as PageOf3;
                        pf.Border11.BorderThickness = new Thickness(0);
                        pf.Border21.BorderThickness = new Thickness(0);
                        pf.Border31.BorderThickness = new Thickness(0);
                        SetChild(pf.Border11);
                        SetChild(pf.Border21);
                        SetChild(pf.Border31);
                        Config.Tables[0].Rows.Find("MS")[1]       = "0";
                        Config.Tables[0].Rows.Find("Border11")[1] = pf.Border11.Tag;
                        Config.Tables[0].Rows.Find("Border21")[1] = pf.Border21.Tag;
                        Config.Tables[0].Rows.Find("Border31")[1] = pf.Border31.Tag;
                        break;
                    }

                    case 1:
                    {
                        PageOf4 pf = Bor1.Children[0] as PageOf4;
                        pf.Border11.BorderThickness = new Thickness(0);
                        pf.Border21.BorderThickness = new Thickness(0);
                        pf.Border31.BorderThickness = new Thickness(0);
                        pf.Border41.BorderThickness = new Thickness(0);
                        SetChild(pf.Border11);
                        SetChild(pf.Border21);
                        SetChild(pf.Border31);
                        SetChild(pf.Border41);
                        Config.Tables[0].Rows.Find("MS")[1]       = "1";
                        Config.Tables[0].Rows.Find("Border11")[1] = pf.Border11.Tag;
                        Config.Tables[0].Rows.Find("Border21")[1] = pf.Border21.Tag;
                        Config.Tables[0].Rows.Find("Border31")[1] = pf.Border31.Tag;
                        Config.Tables[0].Rows.Find("Border41")[1] = pf.Border41.Tag;
                        break;
                    }

                    case 2:
                    {
                        PageOf5 pf = Bor1.Children[0] as PageOf5;
                        pf.Border11.BorderThickness = new Thickness(0);
                        pf.Border21.BorderThickness = new Thickness(0);
                        pf.Border31.BorderThickness = new Thickness(0);
                        pf.Border41.BorderThickness = new Thickness(0);
                        pf.Border51.BorderThickness = new Thickness(0);
                        SetChild(pf.Border11);
                        SetChild(pf.Border21);
                        SetChild(pf.Border31);
                        SetChild(pf.Border41);
                        SetChild(pf.Border51);
                        Config.Tables[0].Rows.Find("MS")[1]       = "2";
                        Config.Tables[0].Rows.Find("Border11")[1] = pf.Border11.Tag;
                        Config.Tables[0].Rows.Find("Border21")[1] = pf.Border21.Tag;
                        Config.Tables[0].Rows.Find("Border31")[1] = pf.Border31.Tag;
                        Config.Tables[0].Rows.Find("Border41")[1] = pf.Border41.Tag;
                        Config.Tables[0].Rows.Find("Border51")[1] = pf.Border51.Tag;
                        break;
                    }

                    default: { break; }
                    }
                    Config.WriteXml(AppPath + "\\Config.Dat", XmlWriteMode.WriteSchema);
                }
                button_BUJU.Content = IsEdit ? "完成" : "布局";
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
Пример #2
0
        private void MSChanged()
        {
            try
            {
                switch (MS)
                {
                case 0:
                {
                    PageOf3 pf = new PageOf3(this);
                    pf.RenderSize = Bor1.RenderSize;
                    Bor1.Children.Clear();
                    if (!IsEdit)
                    {
                        pf.Border11.Tag = Config.Tables[0].Rows.Find("Border11")[1];
                        pf.Border21.Tag = Config.Tables[0].Rows.Find("Border21")[1];
                        pf.Border31.Tag = Config.Tables[0].Rows.Find("Border31")[1];
                    }
                    SetChild(pf.Border11);
                    SetChild(pf.Border21);
                    SetChild(pf.Border31);
                    pf.Border11_MouseLeftButtonDown(null, null);
                    Bor1.Children.Add(pf);
                    break;
                }

                case 1:
                {
                    PageOf4 pf = new PageOf4(this);
                    pf.RenderSize = Bor1.RenderSize;
                    Bor1.Children.Clear();
                    if (!IsEdit)
                    {
                        pf.Border11.Tag = Config.Tables[0].Rows.Find("Border11")[1];
                        pf.Border21.Tag = Config.Tables[0].Rows.Find("Border21")[1];
                        pf.Border31.Tag = Config.Tables[0].Rows.Find("Border31")[1];
                        pf.Border41.Tag = Config.Tables[0].Rows.Find("Border41")[1];
                    }
                    SetChild(pf.Border11);
                    SetChild(pf.Border21);
                    SetChild(pf.Border31);
                    SetChild(pf.Border41);
                    pf.Border11_MouseLeftButtonDown(null, null);
                    Bor1.Children.Add(pf);
                    break;
                }

                case 2:
                {
                    PageOf5 pf = new PageOf5(this);
                    pf.RenderSize = Bor1.RenderSize;
                    Bor1.Children.Clear();
                    if (!IsEdit)
                    {
                        pf.Border11.Tag = Config.Tables[0].Rows.Find("Border11")[1];
                        pf.Border21.Tag = Config.Tables[0].Rows.Find("Border21")[1];
                        pf.Border31.Tag = Config.Tables[0].Rows.Find("Border31")[1];
                        pf.Border41.Tag = Config.Tables[0].Rows.Find("Border41")[1];
                        pf.Border51.Tag = Config.Tables[0].Rows.Find("Border51")[1];
                    }
                    SetChild(pf.Border11);
                    SetChild(pf.Border21);
                    SetChild(pf.Border31);
                    SetChild(pf.Border41);
                    SetChild(pf.Border51);
                    pf.Border11_MouseLeftButtonDown(null, null);
                    Bor1.Children.Add(pf);
                    break;
                }

                default: { break; }
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }