示例#1
0
        public static void Dispose()
        {
            cm.Dispose();
            parent.Children.Remove(sharp_t);
            parent.Children.Remove(start_t);
            parent.Children.Remove(bst);
            parent.Children.Remove(sharp_c);
            parent.Children.Remove(start_c);
            parent.Children.Remove(bsc);
            parent.Children.Remove(restore);
            parent.Children.Remove(ts);
            parent.Children.Remove(ls);

            RecycleTextBlock(sharp_t);
            RecycleTextBlock(start_t);
            RecycleTextBlock(bst);

            GC.SuppressFinalize(ls);
            GC.SuppressFinalize(ts);
            GC.SuppressFinalize(restore);
            GC.SuppressFinalize(sharp_c);
            GC.SuppressFinalize(bsc);
            GC.SuppressFinalize(start_c);
            cm           = null;
            margin.Right = 0;
            DisposeDown();
            //dp.Dispose();
        }
示例#2
0
        public static void Create(Canvas p, Thickness m)
        {
            if (cm != null)
            {
                cm.ReSize(m);
                ReSize(m);
                return;
            }
            parent = p;
            cm     = new ColorManage();
            cm.Create(p, m);
            ts = new ToggleSwitch();
            if (language == 1)
            {
                ts.IsOn = true;
            }
            ts.Toggled += (o, e) => {
                language         = ts.IsOn ? 1 : 0;
                Setting.language = language;
                MainEx.LanguageChange();
                cm.ChangeLan();
                sharp_t.Text = str_s[language];
                start_t.Text = str_st[language];
                bst.Text     = str_bs[language];
                start_c.Items.Clear();
                int c = MainEx.s_all.Length;
                for (int i = 0; i < c; i++)
                {
                    start_c.Items.Add(MainEx.s_all[i][language]);
                }
                start_c.SelectedIndex = Setting.startindex;
                restore.Content       = str_r[language];
                ChangLanguage();
                //dp.ChangLanguage();
            };
            p.Children.Add(ts);
            ls            = CreateTextBlockNext();
            ls.Foreground = font_brush;
            ls.Text       = "English";
            p.Children.Add(ls);

            sharp_t            = CreateTextBlockNext();
            sharp_t.Foreground = font_brush;
            sharp_t.Text       = str_s[language];
            p.Children.Add(sharp_t);
            start_t            = CreateTextBlockNext();
            start_t.Foreground = font_brush;
            start_t.Text       = str_st[language];
            p.Children.Add(start_t);
            bst            = CreateTextBlockNext();
            bst.Foreground = font_brush;
            bst.Text       = str_bs[language];
            p.Children.Add(bst);

            sharp_c = new ComboBox();
            for (int i = 0; i < 3; i++)
            {
                sharp_c.Items.Add(str_ss[i]);
            }
            switch (Setting.sharp)
            {
            case 270:
                sharp_c.SelectedIndex = 2;
                break;

            case 360:
                sharp_c.SelectedIndex = 1;
                break;

            default:
                sharp_c.SelectedIndex = 0;
                break;
            }

            sharp_c.SelectionChanged += (o, e) => {
                switch (sharp_c.SelectedIndex)
                {
                case 1:
                    Setting.sharp = 360;
                    break;

                case 2:
                    Setting.sharp = 270;
                    break;

                default:
                    Setting.sharp = 720;
                    break;
                }
            };
            p.Children.Add(sharp_c);

            bsc = new ComboBox();
            for (int i = 0; i < 3; i++)
            {
                bsc.Items.Add(str_ss[i]);
            }
            switch (Setting.buffsharp)
            {
            case 270:
                bsc.SelectedIndex = 2;
                break;

            case 360:
                bsc.SelectedIndex = 1;
                break;

            default:
                bsc.SelectedIndex = 0;
                break;
            }
            bsc.SelectionChanged += (o, e) => {
                switch (bsc.SelectedIndex)
                {
                case 1:
                    Setting.buffsharp = 360;
                    break;

                case 2:
                    Setting.buffsharp = 270;
                    break;

                default:
                    Setting.buffsharp = 720;
                    break;
                }
            };
            p.Children.Add(bsc);

            start_c = new ComboBox();
            int l = MainEx.s_all.Length;

            for (int i = 0; i < l; i++)
            {
                start_c.Items.Add(MainEx.s_all[i][language]);
            }
            start_c.SelectedIndex     = Setting.startindex;
            start_c.SelectionChanged += (o, e) => {
                if (start_c.SelectedIndex > -1)
                {
                    Setting.startindex = start_c.SelectedIndex;
                }
            };
            p.Children.Add(start_c);

            CreateDown(p);
            restore            = new Button();
            restore.Click     += (o, e) => { Restore(); };
            restore.Content    = str_r[language];
            restore.Foreground = font_brush;
            p.Children.Add(restore);
            ReSize(m);
            //dp= new DownloadPage();
            //dp.Create(p,new Thickness(0,305,m.Right,m.Bottom));
        }