public void savechanges()
        {
            fcb_public.publicDataSet publicDataSet = ((fcb_public.publicDataSet)(this.FindResource("publicDataSet")));
            fcb_public.publicDataSetTableAdapters.weatherTableAdapter publicDataSetweatherTableAdapter = new fcb_public.publicDataSetTableAdapters.weatherTableAdapter();

            System.Windows.Data.CollectionViewSource weatherViewSource = (System.Windows.Data.CollectionViewSource)(this.FindResource("weatherViewSource"));

            //publicDataSetTableAdapters.Fill(publicDataSet.element);
            weatherViewSource.View.MoveCurrentToNext();
            publicDataSetweatherTableAdapter.Update(publicDataSet.weather);
            // publicDataSet.element.AcceptChanges();
        }
Example #2
0
        public void savechanges()
        {
            fcb_public.publicDataSet publicDataSet = ((fcb_public.publicDataSet)(this.FindResource("publicDataSet")));
            fcb_public.publicDataSetTableAdapters.weatherTableAdapter publicDataSetweatherTableAdapter = new fcb_public.publicDataSetTableAdapters.weatherTableAdapter();


            System.Windows.Data.CollectionViewSource weatherViewSource = (System.Windows.Data.CollectionViewSource)(this.FindResource("weatherViewSource"));

            //publicDataSetTableAdapters.Fill(publicDataSet.element);
            weatherViewSource.View.MoveCurrentToNext();
            publicDataSetweatherTableAdapter.Update(publicDataSet.weather);
            // publicDataSet.element.AcceptChanges();
        }
Example #3
0
 private void del_weather_Click(object sender, RoutedEventArgs e)
 {
     fcb_public.publicDataSet publicDataSet = ((fcb_public.publicDataSet)(this.FindResource("publicDataSet")));
     fcb_public.publicDataSetTableAdapters.weatherTableAdapter publicDataSetInitializeTableAdapter = new fcb_public.publicDataSetTableAdapters.weatherTableAdapter();
     // publicDataSetInitializeTableAdapter.Fill(publicDataSet.weather);
     if (iDTextBox.Text != "")
     {
         int index = int.Parse(iDTextBox.Text);
         publicDataSet.weather.FindByID(index).Delete();
         publicDataSetInitializeTableAdapter.Update(publicDataSet.weather);
         publicDataSet.weather.AcceptChanges();
         publicDataSetInitializeTableAdapter.Fill(publicDataSet.weather);
     }
 }
        private void del_weather_Click(object sender, RoutedEventArgs e)
        {
            fcb_public.publicDataSet publicDataSet = ((fcb_public.publicDataSet)(this.FindResource("publicDataSet")));
            fcb_public.publicDataSetTableAdapters.weatherTableAdapter publicDataSetInitializeTableAdapter = new fcb_public.publicDataSetTableAdapters.weatherTableAdapter();
               // publicDataSetInitializeTableAdapter.Fill(publicDataSet.weather);
            if (iDTextBox.Text != "")
            {
                int index = int.Parse(iDTextBox.Text);
                publicDataSet.weather.FindByID(index).Delete();
                publicDataSetInitializeTableAdapter.Update(publicDataSet.weather);
                publicDataSet.weather.AcceptChanges();
                publicDataSetInitializeTableAdapter.Fill(publicDataSet.weather);

            }
        }
Example #5
0
        private void main_grid_MouseUp(object sender, MouseButtonEventArgs e)
        {
            fcb_public.publicDataSet publicDataSet = ((fcb_public.publicDataSet)(this.FindResource("publicDataSet")));
            fcb_public.publicDataSetTableAdapters.InitializeTableAdapter publicDataSetInitializeTableAdapter = new fcb_public.publicDataSetTableAdapters.InitializeTableAdapter();
            fcb_public.publicDataSetTableAdapters.weatherTableAdapter    publicDataSetweatherTableAdapter    = new fcb_public.publicDataSetTableAdapters.weatherTableAdapter();
            publicDataSetweatherTableAdapter.Fill(publicDataSet.weather);
            publicDataSetInitializeTableAdapter.Fill(publicDataSet.Initialize);

            sub_new_show    newshow    = main_grid.FindName(ctrl_name) as sub_new_show;
            sub_showweather newweather = main_grid.FindName(ctrl_name) as sub_showweather;

            if (newshow != null)
            {
                var s = from c in publicDataSet.Initialize where c.in_name == ctrl_name.Substring(1, ctrl_name.Length - 1) select c;
                foreach (var t in s)
                {
                    t.mar_left   = (int)newshow.Margin.Left;
                    t.mar_top    = (int)newshow.Margin.Top;
                    t.mar_weight = (int)newshow.Width;
                    t.mar_hight  = (int)newshow.Height;
                }
                publicDataSetInitializeTableAdapter.Update(publicDataSet.Initialize);
                publicDataSet.AcceptChanges();
                newshow.init_show();



                PublicClass.show_hight = newshow.Height - 70.0;
                mode_show();
            }
            if (newweather != null)
            {
                var s = from c in publicDataSet.weather where c.in_name == ctrl_name.Substring(1, ctrl_name.Length - 1) select c;
                foreach (var t in s)
                {
                    t.mar_left = (int)newweather.Margin.Left;
                    t.mar_top  = (int)newweather.Margin.Top;
                }
                publicDataSetweatherTableAdapter.Update(publicDataSet.weather);
                publicDataSet.AcceptChanges();
            }

            ctrl_name    = "";
            process_type = "";
            can_moves    = false;
        }
Example #6
0
 private void UserControl_Loaded(object sender, RoutedEventArgs e)
 {
     //WeatherWebService wx = new WeatherWebService();
     //string[] s = new string[23];//声明string数组存放返回结果
     // string[] s1 = new string[23];//声明string数组存放返回结果
     // string city = this.textBox1.Text.Trim();//获得文本框录入的查询城市
     // s1 = newweather.getRegionCountry();
     //string city = txt_address.Text;
     //s = wx.getWeatherbyCityName(city);
     // 不要在设计时加载数据。
     // if (!System.ComponentModel.DesignerProperties.GetIsInDesignMode(this))
     // {
     //  //在此处加载数据并将结果指派给 CollectionViewSource。
     //  System.Windows.Data.CollectionViewSource myCollectionViewSource = (System.Windows.Data.CollectionViewSource)this.Resources["Resource Key for CollectionViewSource"];
     //  myCollectionViewSource.Source = your data
     // }
     fcb_public.publicDataSet publicDataSet = ((fcb_public.publicDataSet)(this.FindResource("publicDataSet")));
     fcb_public.publicDataSetTableAdapters.weatherTableAdapter publicDataSetInitializeTableAdapter = new fcb_public.publicDataSetTableAdapters.weatherTableAdapter();
     publicDataSetInitializeTableAdapter.Fill(publicDataSet.weather);
     weatherDataGrid.CanUserAddRows = false;
 }
        private void show_weather_Click(object sender, RoutedEventArgs e)
        {
            fcb_public.publicDataSet publicDataSet = ((fcb_public.publicDataSet)(this.FindResource("publicDataSet")));
            fcb_public.publicDataSetTableAdapters.weatherTableAdapter publicDataSetInitializeTableAdapter = new fcb_public.publicDataSetTableAdapters.weatherTableAdapter();
            if (in_nameTextBox.Text != "")
            {
              ComboBoxItem item = gmt.SelectedItem as ComboBoxItem;
                float gmtime=0;
                //string str = item.Content.ToString();

                //switch (str)
                //{
                //    case "UTC":
                //        gmtime = 0;
                //        break;
                //    case"UTC+00:30":
                //        gmtime = 0.5f;
                //        break;
                //    case "UTC+01:00":
                //        gmtime = 1f;
                //        break;
                //    case "UTC+01:30":
                //        gmtime = 1.5f;
                //        break;
                //    case "UTC+02:00":
                //        gmtime = 2f;
                //        break;
                //    case "UTC+02:30":
                //        gmtime = 2.5f;
                //        break;
                //    case "UTC+03:00":
                //        gmtime = 3f;
                //        break;
                //    case "UTC+03:30":
                //        gmtime = 3.5f;
                //        break;
                //    case "UTC+04:00":
                //        gmtime = 4f;
                //        break;
                //    case "UTC+04:30":
                //        gmtime = 4.5f;
                //        break;
                //    case "UTC+05:00":
                //        gmtime = 5f;
                //        break;
                //    case "UTC+05:30":
                //        gmtime = 5.5f;
                //        break;
                //    case "UTC+06:00":
                //        gmtime = 6f;
                //        break;
                //    case "UTC+06:30":
                //        gmtime = 6.5f;
                //        break;
                //    case "UTC+07:00":
                //        gmtime = 7f;
                //        break;
                //    case "UTC+07:30":
                //        gmtime = 7.5f;
                //        break;
                //    case "UTC+08:00":
                //        gmtime = 8f;
                //        break;
                //    case "UTC+08:30":
                //        gmtime = 8.5f;
                //        break;
                //    case "UTC+09:00":
                //        gmtime = 9.5f;
                //        break;
                //    case "UTC+10:00":
                //        gmtime = 10f;
                //        break;
                //    case "UTC+10:30":
                //        gmtime = 10.5f;
                //        break;
                //    case "UTC+11:00":
                //        gmtime = 11f;
                //        break;
                //    case "UTC+11:30":
                //        gmtime = 11.5f;
                //        break;
                //    case "UTC+12:00":
                //        gmtime = 12f;
                //        break;

                //    case "UTC-00:30":
                //        gmtime = -0.5f;
                //        break;
                //    case "UTC-01:00":
                //        gmtime = -1f;
                //        break;
                //    case "UTC-01:30":
                //        gmtime = -1.5f;
                //        break;
                //    case "UTC-02:00":
                //        gmtime = -2f;
                //        break;
                //    case "UTC-02:30":
                //        gmtime = -2.5f;
                //        break;
                //    case "UTC-03:00":
                //        gmtime = -3f;
                //        break;
                //    case "UTC-03:30":
                //        gmtime = -3.5f;
                //        break;
                //    case "UTC-04:00":
                //        gmtime = -4f;
                //        break;
                //    case "UTC-04:30":
                //        gmtime = -4.5f;
                //        break;
                //    case "UTC-05:00":
                //        gmtime = -5f;
                //        break;
                //    case "UTC-05:30":
                //        gmtime = -5.5f;
                //        break;
                //    case "UTC-06:00":
                //        gmtime = -6f;
                //        break;
                //    case "UTC-06:30":
                //        gmtime = -6.5f;
                //        break;
                //    case "UTC-07:00":
                //        gmtime = -7f;
                //        break;
                //    case "UTC-07:30":
                //        gmtime = -7.5f;
                //        break;
                //    case "UTC-08:00":
                //        gmtime = -8f;
                //        break;
                //    case "UTC-08:30":
                //        gmtime = -8.5f;
                //        break;
                //    case "UTC-09:00":
                //        gmtime = -9.5f;
                //        break;
                //    case "UTC-10:00":
                //        gmtime = -10f;
                //        break;
                //    case "UTC-10:30":
                //        gmtime = -10.5f;
                //        break;
                //    case "UTC-11:00":
                //        gmtime = -11f;
                //        break;
                //    case "UTC-11:30":
                //        gmtime = -11.5f;
                //        break;
                //    case "UTC-12:00":
                //        gmtime = -12f;
                //        break;

                //}
                publicDataSet.weather.AddweatherRow((int)(SystemParameters.PrimaryScreenWidth - 300), 70, in_nameTextBox.Text, (bool)statusCheckBox.IsChecked,gmtime);
                publicDataSetInitializeTableAdapter.Update(publicDataSet.weather);
                publicDataSetInitializeTableAdapter.Fill(publicDataSet.weather);
               // PublicClass.city_name = in_nameTextBox.Text.Trim();
                publicDataSet.AcceptChanges();
                PublicClass.show = "showweather";

            }
        }
 private void UserControl_Loaded(object sender, RoutedEventArgs e)
 {
     //WeatherWebService wx = new WeatherWebService();
     //string[] s = new string[23];//声明string数组存放返回结果
     // string[] s1 = new string[23];//声明string数组存放返回结果
     // string city = this.textBox1.Text.Trim();//获得文本框录入的查询城市
     // s1 = newweather.getRegionCountry();
     //string city = txt_address.Text;
     //s = wx.getWeatherbyCityName(city);
     // 不要在设计时加载数据。
     // if (!System.ComponentModel.DesignerProperties.GetIsInDesignMode(this))
     // {
     // 	//在此处加载数据并将结果指派给 CollectionViewSource。
     // 	System.Windows.Data.CollectionViewSource myCollectionViewSource = (System.Windows.Data.CollectionViewSource)this.Resources["Resource Key for CollectionViewSource"];
     // 	myCollectionViewSource.Source = your data
     // }
     fcb_public.publicDataSet publicDataSet = ((fcb_public.publicDataSet)(this.FindResource("publicDataSet")));
     fcb_public.publicDataSetTableAdapters.weatherTableAdapter publicDataSetInitializeTableAdapter = new fcb_public.publicDataSetTableAdapters.weatherTableAdapter();
     publicDataSetInitializeTableAdapter.Fill(publicDataSet.weather);
     weatherDataGrid.CanUserAddRows = false;
 }
Example #9
0
        private void show_weather_Click(object sender, RoutedEventArgs e)
        {
            fcb_public.publicDataSet publicDataSet = ((fcb_public.publicDataSet)(this.FindResource("publicDataSet")));
            fcb_public.publicDataSetTableAdapters.weatherTableAdapter publicDataSetInitializeTableAdapter = new fcb_public.publicDataSetTableAdapters.weatherTableAdapter();
            if (in_nameTextBox.Text != "")
            {
                ComboBoxItem item   = gmt.SelectedItem as ComboBoxItem;
                float        gmtime = 0;
                //string str = item.Content.ToString();

                //switch (str)
                //{
                //    case "UTC":
                //        gmtime = 0;
                //        break;
                //    case"UTC+00:30":
                //        gmtime = 0.5f;
                //        break;
                //    case "UTC+01:00":
                //        gmtime = 1f;
                //        break;
                //    case "UTC+01:30":
                //        gmtime = 1.5f;
                //        break;
                //    case "UTC+02:00":
                //        gmtime = 2f;
                //        break;
                //    case "UTC+02:30":
                //        gmtime = 2.5f;
                //        break;
                //    case "UTC+03:00":
                //        gmtime = 3f;
                //        break;
                //    case "UTC+03:30":
                //        gmtime = 3.5f;
                //        break;
                //    case "UTC+04:00":
                //        gmtime = 4f;
                //        break;
                //    case "UTC+04:30":
                //        gmtime = 4.5f;
                //        break;
                //    case "UTC+05:00":
                //        gmtime = 5f;
                //        break;
                //    case "UTC+05:30":
                //        gmtime = 5.5f;
                //        break;
                //    case "UTC+06:00":
                //        gmtime = 6f;
                //        break;
                //    case "UTC+06:30":
                //        gmtime = 6.5f;
                //        break;
                //    case "UTC+07:00":
                //        gmtime = 7f;
                //        break;
                //    case "UTC+07:30":
                //        gmtime = 7.5f;
                //        break;
                //    case "UTC+08:00":
                //        gmtime = 8f;
                //        break;
                //    case "UTC+08:30":
                //        gmtime = 8.5f;
                //        break;
                //    case "UTC+09:00":
                //        gmtime = 9.5f;
                //        break;
                //    case "UTC+10:00":
                //        gmtime = 10f;
                //        break;
                //    case "UTC+10:30":
                //        gmtime = 10.5f;
                //        break;
                //    case "UTC+11:00":
                //        gmtime = 11f;
                //        break;
                //    case "UTC+11:30":
                //        gmtime = 11.5f;
                //        break;
                //    case "UTC+12:00":
                //        gmtime = 12f;
                //        break;



                //    case "UTC-00:30":
                //        gmtime = -0.5f;
                //        break;
                //    case "UTC-01:00":
                //        gmtime = -1f;
                //        break;
                //    case "UTC-01:30":
                //        gmtime = -1.5f;
                //        break;
                //    case "UTC-02:00":
                //        gmtime = -2f;
                //        break;
                //    case "UTC-02:30":
                //        gmtime = -2.5f;
                //        break;
                //    case "UTC-03:00":
                //        gmtime = -3f;
                //        break;
                //    case "UTC-03:30":
                //        gmtime = -3.5f;
                //        break;
                //    case "UTC-04:00":
                //        gmtime = -4f;
                //        break;
                //    case "UTC-04:30":
                //        gmtime = -4.5f;
                //        break;
                //    case "UTC-05:00":
                //        gmtime = -5f;
                //        break;
                //    case "UTC-05:30":
                //        gmtime = -5.5f;
                //        break;
                //    case "UTC-06:00":
                //        gmtime = -6f;
                //        break;
                //    case "UTC-06:30":
                //        gmtime = -6.5f;
                //        break;
                //    case "UTC-07:00":
                //        gmtime = -7f;
                //        break;
                //    case "UTC-07:30":
                //        gmtime = -7.5f;
                //        break;
                //    case "UTC-08:00":
                //        gmtime = -8f;
                //        break;
                //    case "UTC-08:30":
                //        gmtime = -8.5f;
                //        break;
                //    case "UTC-09:00":
                //        gmtime = -9.5f;
                //        break;
                //    case "UTC-10:00":
                //        gmtime = -10f;
                //        break;
                //    case "UTC-10:30":
                //        gmtime = -10.5f;
                //        break;
                //    case "UTC-11:00":
                //        gmtime = -11f;
                //        break;
                //    case "UTC-11:30":
                //        gmtime = -11.5f;
                //        break;
                //    case "UTC-12:00":
                //        gmtime = -12f;
                //        break;


                //}
                publicDataSet.weather.AddweatherRow((int)(SystemParameters.PrimaryScreenWidth - 300), 70, in_nameTextBox.Text, (bool)statusCheckBox.IsChecked, gmtime);
                publicDataSetInitializeTableAdapter.Update(publicDataSet.weather);
                publicDataSetInitializeTableAdapter.Fill(publicDataSet.weather);
                // PublicClass.city_name = in_nameTextBox.Text.Trim();
                publicDataSet.AcceptChanges();
                PublicClass.show = "showweather";
            }
        }
Example #10
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);
                }
            }
        }
Example #11
0
        private void Window_Loaded(object sender, RoutedEventArgs e)
        {
            //ImageBrush newimages = new ImageBrush();

            //newimages.ImageSource = new BitmapImage(new Uri(Directory.GetCurrentDirectory() + "\\image\\" + "background.jpg", UriKind.Absolute));
            //main_grid.Background = newimages;

            fcb_public.publicDataSet publicDataSet = ((fcb_public.publicDataSet)(this.FindResource("publicDataSet")));
            // 将数据加载到表 elset_init 中。可以根据需要修改此代码。
            fcb_public.publicDataSetTableAdapters.elset_initTableAdapter publicDataSetelset_initTableAdapter = new fcb_public.publicDataSetTableAdapters.elset_initTableAdapter();
            publicDataSetelset_initTableAdapter.Fill(publicDataSet.elset_init);
            System.Windows.Data.CollectionViewSource elset_initViewSource = ((System.Windows.Data.CollectionViewSource)(this.FindResource("elset_initViewSource")));
            elset_initViewSource.View.MoveCurrentToFirst();
            // 将数据加载到表 Initialize 中。可以根据需要修改此代码。
            fcb_public.publicDataSetTableAdapters.InitializeTableAdapter publicDataSetInitializeTableAdapter = new fcb_public.publicDataSetTableAdapters.InitializeTableAdapter();
            publicDataSetInitializeTableAdapter.Fill(publicDataSet.Initialize);
            System.Windows.Data.CollectionViewSource initializeViewSource = ((System.Windows.Data.CollectionViewSource)(this.FindResource("initializeViewSource")));
            initializeViewSource.View.MoveCurrentToFirst();
            // 将数据加载到表 background_pic 中。可以根据需要修改此代码。
            fcb_public.publicDataSetTableAdapters.background_picTableAdapter publicDataSetbackground_picTableAdapter = new fcb_public.publicDataSetTableAdapters.background_picTableAdapter();
            publicDataSetbackground_picTableAdapter.Fill(publicDataSet.background_pic);
            System.Windows.Data.CollectionViewSource background_picViewSource = ((System.Windows.Data.CollectionViewSource)(this.FindResource("background_picViewSource")));
            background_picViewSource.View.MoveCurrentToFirst();

            // 将数据加载到表 element 中。可以根据需要修改此代码。
            fcb_public.publicDataSetTableAdapters.elementTableAdapter publicDataSetelementTableAdapter = new fcb_public.publicDataSetTableAdapters.elementTableAdapter();
            publicDataSetelementTableAdapter.Fill(publicDataSet.element);
            System.Windows.Data.CollectionViewSource elementViewSource = ((System.Windows.Data.CollectionViewSource)(this.FindResource("elementViewSource")));
            elementViewSource.View.MoveCurrentToFirst();



            // 将数据加载到表 weather 中。可以根据需要修改此代码。
            fcb_public.publicDataSetTableAdapters.weatherTableAdapter publicDataSetweatherTableAdapter = new fcb_public.publicDataSetTableAdapters.weatherTableAdapter();
            publicDataSetweatherTableAdapter.Fill(publicDataSet.weather);
            System.Windows.Data.CollectionViewSource weatherViewSource = ((System.Windows.Data.CollectionViewSource)(this.FindResource("weatherViewSource")));
            weatherViewSource.View.MoveCurrentToFirst();


            // 将数据加载到表 roll 中。可以根据需要修改此代码。
            fcb_public.publicDataSetTableAdapters.rollTableAdapter publicDataSetrollTableAdapter = new fcb_public.publicDataSetTableAdapters.rollTableAdapter();
            publicDataSetrollTableAdapter.Fill(publicDataSet.roll);
            System.Windows.Data.CollectionViewSource rollViewSource = ((System.Windows.Data.CollectionViewSource)(this.FindResource("rollViewSource")));
            rollViewSource.View.MoveCurrentToFirst();

            if (publicDataSet.element_set.Count > 0)
            {
                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);
                }
            }



            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);
            }

//初始化滚动
            TextBlock newtextblock = new TextBlock();

            //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;
            newtextblock.BeginAnimation(TextBlock.MarginProperty, txt_margin_animation);



            var default_background = from c in publicDataSet.background_pic where c._default == "1" select c;

            foreach (var t in default_background)
            {
                PublicClass.background_url = Directory.GetCurrentDirectory() + "\\image\\" + t.url;
                ImageBrush newimage = new ImageBrush();

                newimage.ImageSource = new BitmapImage(new Uri(PublicClass.background_url, UriKind.Absolute));
                main_grid.Background = newimage;
            }
            main_canvas.Width = main_grid.ActualWidth;

            //Color color = new Color();

            //color.A = 0;

            //color.R = 0;

            //color.G = 0;

            //color.B = 0;
            //toolbarpanel.Background = new SolidColorBrush(color);
            //toolbarpanel.Background = new SolidColorBrush(Color.FromArgb(100, 255, 255, 255));
            main_canvas.Background = new SolidColorBrush(Color.FromArgb(20, 255, 255, 255));
        }