示例#1
0
        private void element_set_Click(object sender, RoutedEventArgs e)
        {
            subwindow_content.Children.Clear();
            sub_new_elementset newelementset = new sub_new_elementset();

            subwindow.Width    = 500;
            subwindow.Height   = 560;
            newelementset.Name = "newelementset";
            subwindow.Opacity  = 0.9;
            subwindow_content.Children.Add(newelementset);
            Panel.SetZIndex(submainwindow, 3000);
            PublicClass.change_name = "newelementset";
        }
示例#2
0
        private void mode_show()
        {
            if (PublicClass.change_name == "element")
            {
                try
                {
                    sub_new_element newelement = MainWindow.FindChild <sub_new_element>(Application.Current.MainWindow, "newelement");
                    newelement.savechanges();
                }
                catch { }
            }
            else if (PublicClass.change_name == "newweather")
            {
                try
                {
                    sub_weather newweather = MainWindow.FindChild <sub_weather>(Application.Current.MainWindow, "newweather");
                    newweather.savechanges();
                }
                catch { }
            }
            else if (PublicClass.change_name == "newelementset")
            {
                try
                {
                    sub_new_elementset newelementset = MainWindow.FindChild <sub_new_elementset>(Application.Current.MainWindow, "newelementset");
                    newelementset.savechanges();
                }
                catch { }
            }
            else if (PublicClass.change_name == "newroll")
            {
                ;
            }
            {
                try
                {
                    sub_roll newroll = MainWindow.FindChild <sub_roll>(Application.Current.MainWindow, "newroll");
                    newroll.savechanges();
                }
                catch { }
            }
            PublicClass.change_name = "";


            if (PublicClass.show == "showelementset")
            {
                fcb_public.publicDataSet publicDataSet = ((fcb_public.publicDataSet)(this.FindResource("publicDataSet")));
                fcb_public.publicDataSetTableAdapters.InitializeTableAdapter publicDataSetInitializeTableAdapter = new fcb_public.publicDataSetTableAdapters.InitializeTableAdapter();
                publicDataSetInitializeTableAdapter.Fill(publicDataSet.Initialize);
                foreach (var t in publicDataSet.Initialize)
                {
                    sub_new_show del_show = main_grid.FindName("s" + t.in_name) as sub_new_show;
                    if (del_show != null)
                    {
                        main_grid.Children.Remove(del_show);
                        main_grid.UnregisterName("s" + t.in_name);
                    }

                    sub_new_show newshow = new sub_new_show();
                    newshow.Margin = new Thickness(t.mar_left, t.mar_top, 0, 0);
                    newshow.Width  = t.mar_weight;
                    newshow.Height = t.mar_hight;
                    newshow.Name   = "s" + t.in_name;

                    newshow.elset_id = int.Parse(t.in_name);
                    main_grid.Children.Add(newshow);
                    //Panel.SetZIndex(submainwindow1, 3000);
                    main_grid.RegisterName("s" + t.in_name, newshow);
                }
            }

            if (PublicClass.show == "showroll")
            {
                TextBlock newtextblock = new TextBlock();

                fcb_public.publicDataSet publicDataSet = (fcb_public.publicDataSet)(this.FindResource("publicDataSet"));
                fcb_public.publicDataSetTableAdapters.rollTableAdapter publicDataSetTableAdapters = new publicDataSetTableAdapters.rollTableAdapter();
                publicDataSetTableAdapters.Fill(publicDataSet.roll);

                //newtextblock.Text = publicDataSet.roll.FindByID(PublicClass.roll_index).txt;
                var select = from c in publicDataSet.roll where c.status == true select c;
                //int s1 = select.Count();
                //int step = 0;
                //int temp_step = 0;
                //if (s1 > 0)
                //{
                foreach (var s in select)
                {
                    newtextblock.Text += "      " + s.txt;
                }
                //    step++;
                //}
                //if (step > s1)
                //{
                //    step = 0;
                //}

                newtextblock.FontSize   = 30;
                newtextblock.Foreground = Brushes.White;
                // newtextblock.Background = Brushes.AliceBlue;
                newtextblock.TextWrapping = TextWrapping.NoWrap;
                StackPanel delpanel = main_grid.FindName("rollstackpanel") as StackPanel;
                if (delpanel != null)
                {
                    main_grid.Children.Remove(delpanel);
                    main_grid.UnregisterName("rollstackpanel");
                }

                StackPanel newstackpanel = new StackPanel();
                newstackpanel.Name   = "rollstackpanel";
                newstackpanel.Width  = main_grid.ActualWidth;
                newstackpanel.Height = 36;
                newstackpanel.Margin = new Thickness(0, SystemParameters.PrimaryScreenHeight - 36, 0, 0);
                // newstackpanel.Background = Brushes.Green;
                // newstackpanel.Background=new
                // newstackpanel.VerticalAlignment = VerticalAlignment.Bottom;
                newstackpanel.Children.Add(newtextblock);
                main_grid.Children.Add(newstackpanel);
                main_grid.RegisterName("rollstackpanel", newstackpanel);
                newtextblock.UpdateLayout();
                ThicknessAnimation txt_margin_animation = new ThicknessAnimation();
                txt_margin_animation.From           = new Thickness(SystemParameters.PrimaryScreenWidth, 0, 0, 0);
                txt_margin_animation.To             = new Thickness(-newtextblock.ActualWidth, 0, 0, 0);
                txt_margin_animation.Duration       = TimeSpan.FromSeconds(20);
                txt_margin_animation.RepeatBehavior = RepeatBehavior.Forever;
                double t = newtextblock.ActualHeight;
                newtextblock.BeginAnimation(TextBlock.MarginProperty, txt_margin_animation);
            }
            if (PublicClass.show == "showweather")
            {
                fcb_public.publicDataSet publicDataSet = ((fcb_public.publicDataSet)(this.FindResource("publicDataSet")));
                fcb_public.publicDataSetTableAdapters.weatherTableAdapter publicDataSetInitializeTableAdapter = new fcb_public.publicDataSetTableAdapters.weatherTableAdapter();
                publicDataSetInitializeTableAdapter.Fill(publicDataSet.weather);
                var show_weatherconut = from c in publicDataSet.weather where c.status == true select c;
                foreach (var t in show_weatherconut)
                {
                    sub_showweather del_show = main_grid.FindName("w" + t.in_name) as sub_showweather;
                    if (del_show != null)
                    {
                        main_grid.Children.Remove(del_show);
                        main_grid.UnregisterName("w" + t.in_name);
                    }

                    sub_showweather newshow = new sub_showweather();
                    newshow.Margin    = new Thickness(t.mar_left, t.mar_top, 0, 0);
                    newshow.Name      = "w" + t.in_name;
                    newshow.city_name = t.in_name;
                    newshow.gmt       = t.gmt;
                    newshow.Width     = 200;
                    newshow.Height    = 184;
                    //newshow.Background = Brushes.White;
                    //newshow.Opacity = 0.2;
                    // newshow.elset_id = int.Parse(t.in_name);
                    main_grid.Children.Add(newshow);
                    //Panel.SetZIndex(submainwindow1, 3000);
                    main_grid.RegisterName("w" + t.in_name, newshow);
                }
            }
        }