Пример #1
0
 private void delete_record_Click(object sender, RoutedEventArgs e)
 {
     fcb_public.publicDataSet publicDataSet = (fcb_public.publicDataSet)(this.FindResource("publicDataSet"));
     fcb_public.publicDataSetTableAdapters.elementTableAdapter publicDataSetTableAdapters = new publicDataSetTableAdapters.elementTableAdapter();
     if (publicDataSet.element.Count > 0)
     {
         try
         {
             id_index = int.Parse(iDTextBox.Text);
             publicDataSet.element.FindByID(id_index).Delete();
             publicDataSetTableAdapters.Update(publicDataSet.element);
             publicDataSet.element.AcceptChanges();
             publicDataSetTableAdapters.Fill(publicDataSet.element);
             System.Windows.Documents.FlowDocument doc = richTextBox1.Document;
             doc.Blocks.Clear();
         }
         catch { }
     }
 }
Пример #2
0
 private void UserControl_Loaded(object sender, RoutedEventArgs e)
 {
     fcb_public.publicDataSet publicDataSet = ((fcb_public.publicDataSet)(this.FindResource("publicDataSet")));
     // 将数据加载到表 element_set 中。可以根据需要修改此代码。
     fcb_public.publicDataSetTableAdapters.element_setTableAdapter publicDataSetelement_setTableAdapter = new fcb_public.publicDataSetTableAdapters.element_setTableAdapter();
     publicDataSetelement_setTableAdapter.Fill(publicDataSet.element_set);
     System.Windows.Data.CollectionViewSource element_setViewSource = ((System.Windows.Data.CollectionViewSource)(this.FindResource("element_setViewSource")));
     element_setViewSource.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();
     // 将数据加载到表 el_elset 中。可以根据需要修改此代码。
     fcb_public.publicDataSetTableAdapters.el_elsetTableAdapter publicDataSetel_elsetTableAdapter = new fcb_public.publicDataSetTableAdapters.el_elsetTableAdapter();
     publicDataSetel_elsetTableAdapter.Fill(publicDataSet.el_elset);
     System.Windows.Data.CollectionViewSource el_elsetViewSource = ((System.Windows.Data.CollectionViewSource)(this.FindResource("el_elsetViewSource")));
     el_elsetViewSource.View.MoveCurrentToFirst();
     element_setDataGrid.CanUserAddRows = false;
 }
Пример #3
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;
 }
Пример #4
0
        private void UserControl_Loaded(object sender, RoutedEventArgs e)
        {
            fcb_public.publicDataSet publicDataSet = (fcb_public.publicDataSet)(this.FindResource("publicDataSet"));
            fcb_public.publicDataSetTableAdapters.elementTableAdapter publicDataSetTableAdapters = new publicDataSetTableAdapters.elementTableAdapter();
            System.Windows.Data.CollectionViewSource elementViewSource = (System.Windows.Data.CollectionViewSource)(this.FindResource("elementViewSource"));
            left_line.Width  = bottom_line.ActualWidth / 3;
            right_line.Width = bottom_line.ActualWidth / 3;
            title.Width      = bottom_line.ActualWidth / 3;
            title.Margin     = new Thickness(left_line.Width, 0, 0, 0);
            title.Content    = publicDataSet.element.titleColumn.AllowDBNull;

            // 不要在设计时加载数据。
            // 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
            // }
            // 不要在设计时加载数据。
            // 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
            // }
            // 不要在设计时加载数据。
            // 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
            // }
            // 不要在设计时加载数据。
            // 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
            // }
        }
Пример #5
0
 private void UserControl_Loaded(object sender, RoutedEventArgs e)
 {
     // 不要在设计时加载数据。
     // 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.elementTableAdapter publicDataSetTableAdapters = new publicDataSetTableAdapters.elementTableAdapter();
     //publicDataSet.element =(publicDataSet.elementDataTable) from c in publicDataSet.element where c.ID == 2 select c;
     publicDataSetTableAdapters.Fill(publicDataSet.element);
     System.Windows.Data.CollectionViewSource elementViewSource = (System.Windows.Data.CollectionViewSource)(this.FindResource("elementViewSource"));
     // typeComboBox.SelectionChanged -= new SelectionChangedEventHandler(typeComboBox_SelectionChanged);
     elementDataGrid.CanUserAddRows = false;
     typeComboBox.SelectedIndex     = 0;
     addtoolfontname();
     start_timeDatePicker.SelectedDate = System.DateTime.Now;
     end_timeDatePicker.SelectedDate   = System.DateTime.Now.AddDays(7);
     show_timeTextBox.Text             = "1";
 }
        private void UserControl_Loaded(object sender, RoutedEventArgs e)
        {
            // 不要在设计时加载数据。
            // 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.elementTableAdapter publicDataSetTableAdapters = new publicDataSetTableAdapters.elementTableAdapter();
            //publicDataSetTableAdapters.Fill(publicDataSet.element);
            //System.Windows.Data.CollectionViewSource elementViewSource = (System.Windows.Data.CollectionViewSource)(this.FindResource("elementViewSource"));

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



            var query = from c in publicDataSet.Initialize join t in publicDataSet.elset_init on c.ID equals t.Initialize_ID select c;

            foreach (var s in publicDataSet.Initialize)
            {
                CheckBox newcheckbox = new CheckBox();
            }
            //publicDataSetInitializeTableAdapter.Fill(query);

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

            initializeViewSource.View.MoveCurrentToFirst();
        }
Пример #7
0
        private void contentTextBox_TextChanged(object sender, TextChangedEventArgs e)
        {
            if (iDTextBox.Text != "")
            {
                id_index = int.Parse(iDTextBox.Text);

                fcb_public.publicDataSet publicDataSet = (fcb_public.publicDataSet)(this.FindResource("publicDataSet"));
                fcb_public.publicDataSetTableAdapters.elementTableAdapter publicDataSetTableAdapters = new publicDataSetTableAdapters.elementTableAdapter();

                publicDataSetTableAdapters.Fill(publicDataSet.element);


                contentTextBox.Text = publicDataSet.element.FindByID(id_index).content;

                TextRange    documentTextRange = new TextRange(richTextBox1.Document.ContentStart, richTextBox1.Document.ContentEnd);
                MemoryStream stream            = new MemoryStream();
                StreamWriter sw = new StreamWriter(stream);
                sw.Write(contentTextBox.Text);
                sw.Flush();
                stream.Seek(0, SeekOrigin.Begin);
                if (contentTextBox.Text != "")
                {
                    documentTextRange.Load(stream, DataFormats.Xaml);
                }
                else
                {
                    richTextBox1.Document.Blocks.Clear();
                }

                titleTextBox.Text                 = publicDataSet.element.FindByID(id_index).title;
                typeComboBox.Text                 = publicDataSet.element.FindByID(id_index).type;
                show_timeTextBox.Text             = publicDataSet.element.FindByID(id_index).show_time.ToString();
                statusCheckBox.IsChecked          = publicDataSet.element.FindByID(id_index).status;
                start_timeDatePicker.SelectedDate = publicDataSet.element.FindByID(id_index).start_time;
                end_timeDatePicker.SelectedDate   = publicDataSet.element.FindByID(id_index).end_time;
            }
        }
Пример #8
0
        private void del_elset_Click(object sender, RoutedEventArgs e)
        {
            fcb_public.publicDataSet publicDataSet = ((fcb_public.publicDataSet)(this.FindResource("publicDataSet")));
            fcb_public.publicDataSetTableAdapters.element_setTableAdapter publicDataSetelement_setTableAdapter = new fcb_public.publicDataSetTableAdapters.element_setTableAdapter();
            // fcb_public.publicDataSet publicDataSet = ((fcb_public.publicDataSet)(this.FindResource("publicDataSet")));
            fcb_public.publicDataSetTableAdapters.el_elsetTableAdapter publicDataSetel_elsetTableAdapter = new fcb_public.publicDataSetTableAdapters.el_elsetTableAdapter();
            if (iDTextBox.Text != "")
            {
                int index = int.Parse(iDTextBox.Text);
                publicDataSet.element_set.FindByID(index).Delete();
                publicDataSetelement_setTableAdapter.Update(publicDataSet.element_set);
                publicDataSet.element_set.AcceptChanges();
                publicDataSetelement_setTableAdapter.Fill(publicDataSet.element_set);

                var select_id = from c in publicDataSet.el_elset where index == c.element_set_ID select c;
                foreach (var s in select_id)
                {
                    publicDataSet.el_elset.FindByID(s.ID).Delete();
                }
                publicDataSetel_elsetTableAdapter.Update(publicDataSet.el_elset);
                publicDataSet.el_elset.AcceptChanges();
                publicDataSetel_elsetTableAdapter.Fill(publicDataSet.el_elset);
            }
        }
Пример #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";
            }
        }
Пример #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);
                }
            }
        }
Пример #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));
        }
Пример #12
0
        public void init_show()
        {
            //small_title.Width = content_stackpanel.ActualWidth;
            //newtimer.Elapsed += new System.Timers.ElapsedEventHandler(newtimer_Elapsed);
            //newtimer.Interval = 1000;
            //newtimer.Start();
            // 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
            // }


            //MediaElement newmedia = new MediaElement();

            //newmedia.Source = new Uri(Directory.GetCurrentDirectory() + "\\image\\" + "weicheng.mp4", UriKind.Absolute);

            //abc.Children.Add(newmedia);



            //Thread newthread = new Thread(new ThreadStart(() =>
            //{
            //    Dispatcher.Invoke(new Action(() =>
            //    {



            fcb_public.publicDataSet publicDataSet = ((fcb_public.publicDataSet)(this.FindResource("publicDataSet")));
            fcb_public.publicDataSetTableAdapters.elementTableAdapter     elpublicDataSetTableAdapters      = new publicDataSetTableAdapters.elementTableAdapter();
            fcb_public.publicDataSetTableAdapters.element_setTableAdapter elsetpublicDataSetTableAdapters   = new fcb_public.publicDataSetTableAdapters.element_setTableAdapter();
            fcb_public.publicDataSetTableAdapters.InitializeTableAdapter  initpublicDataSetTableAdapters    = new fcb_public.publicDataSetTableAdapters.InitializeTableAdapter();
            fcb_public.publicDataSetTableAdapters.el_elsetTableAdapter    publicDataSetel_elsetTableAdapter = new fcb_public.publicDataSetTableAdapters.el_elsetTableAdapter();
            publicDataSetel_elsetTableAdapter.Fill(publicDataSet.el_elset);

            elpublicDataSetTableAdapters.Fill(publicDataSet.element);
            elsetpublicDataSetTableAdapters.Fill(publicDataSet.element_set);
            initpublicDataSetTableAdapters.Fill(publicDataSet.Initialize);


            if (elset_id > -1 && init_publicdataset == false)
            {
                var show_el = from el in publicDataSet.element join el_set in publicDataSet.el_elset on el.ID equals el_set.element_ID where elset_id == el_set.element_set_ID select el;
                element_count      = show_el.Count();
                init_publicdataset = true;
                //newtimer.Interval = 1000;
            }

            if (element_count > 0)
            {
                var show_el = from el in publicDataSet.element join el_set in publicDataSet.el_elset on el.ID equals el_set.element_ID where el.status == true && el.start_time <= DateTime.Now && el.end_time >= DateTime.Now  where el_set.element_set_ID == elset_id select el;
                // int temp_step = 0;
                foreach (var t in show_el)
                {
                    //if (step == temp_step)
                    //{
                    var show_el_set = from el_set in publicDataSet.element_set join el_elset in publicDataSet.el_elset on el_set.ID equals el_elset.element_ID where el_elset.element_ID == t.ID select el_elset;
                    foreach (var st in show_el_set)
                    {
                        //var sst = from c in publicDataSet.element_set where c.ID == st.element_set_ID select c;
                        //var sst = from c in publicDataSet.element join el in publicDataSet.el_elset on c.ID equals el.element_ID where el.element_set_ID == elset_id select c;
                        var sst = from c in publicDataSet.element_set where c.ID == elset_id select c;
                        foreach (var ssst in sst)
                        {
                            big_title.Text = ssst.elset_name;
                            // break;
                        }
                    }

                    small_title.Text = t.title;
                    titlename.Add(t.ID + "|" + t.title);


                    //10000;
                    if (t.type == "文档")
                    {
                        small_title.Visibility = Visibility.Hidden;
                        RichTextBox  newRTB            = new RichTextBox();
                        TextRange    documentTextRange = new TextRange(newRTB.Document.ContentStart, newRTB.Document.ContentEnd);
                        MemoryStream stream            = new MemoryStream();
                        StreamWriter sw = new StreamWriter(stream);
                        sw.Write(t.content);
                        sw.Flush();
                        stream.Seek(0, SeekOrigin.Begin);
                        documentTextRange.Load(stream, DataFormats.Xaml);
                        string               xw  = XamlWriter.Save(newRTB.Document);
                        StringReader         sr  = new StringReader(xw);
                        System.Xml.XmlReader xr  = System.Xml.XmlReader.Create(sr);
                        FlowDocument         doc = XamlReader.Load(xr) as FlowDocument;

                        //var showel = from el in publicDataSet.element join el_set in publicDataSet.el_elset on el.ID equals el_set.element_ID where el.status == true where el_set.element_set_ID == elset_id select el;
                        //foreach (var s in showel)
                        //{
                        FlowDocumentScrollViewer deldoc = content_stackpanel.FindName("newdoc" + t.ID) as FlowDocumentScrollViewer;
                        if (deldoc != null)
                        {
                            content_stackpanel.Children.Remove(deldoc);
                            content_stackpanel.UnregisterName("newdoc" + t.ID);
                        }

                        FlowDocumentScrollViewer newdoc = new FlowDocumentScrollViewer();
                        newdoc.Document = doc;
                        // newdoc.Effect = da;
                        //newdoc.Padding = new Thickness(10);
                        newdoc.IsEnabled  = false;
                        newdoc.Foreground = Brushes.White;
                        newdoc.Opacity    = 0;
                        newdoc.VerticalScrollBarVisibility = ScrollBarVisibility.Hidden;
                        newdoc.Margin = new Thickness(0, 0, 0, 0);
                        newdoc.Width  = content_stackpanel.ActualWidth;
                        newdoc.UpdateLayout();
                        content_stackpanel.Children.Add(newdoc);
                        content_stackpanel.RegisterName("newdoc" + t.ID, newdoc);
                        //newdoc.Name = "newdoc" + t.ID;
                        //Storyboard newstoryboard = new Storyboard();
                        //ThicknessAnimation txt_animation = new ThicknessAnimation();
                        //txt_animation.From = new Thickness(0, 0, 0, 0);
                        //txt_animation.To = new Thickness(0, -800, 0, 0);
                        //// newdoc.Visibility = Visibility.Visible;
                        //txt_animation.Duration = TimeSpan.FromSeconds(t.show_time);
                        //newstoryboard.Children.Add(txt_animation);
                        //Storyboard.SetTargetName(txt_animation, newdoc.Name);
                        //Storyboard.SetTargetProperty(txt_animation, new PropertyPath(MarginProperty));
                        //newstoryboard.Stop(content_stackpanel);
                        //newstoryboard.Begin(content_stackpanel);

                        //DoubleAnimation newadouble = new DoubleAnimation();
                        //newadouble.From = 1;
                        //newadouble.To = 0;
                        //newadouble.Duration = TimeSpan.FromSeconds(1);
                        //newstoryboard.Children.Add(newadouble);
                        //Storyboard.SetTargetName(newadouble, newdoc.Name);
                        //Storyboard.SetTargetProperty(newadouble, new PropertyPath(OpacityProperty));
                        //newstoryboard.Begin(content_stackpanel);

                        //DoubleAnimation newadouble = new DoubleAnimation();
                        //newadouble.From = 1;
                        //newadouble.To = 0;
                        //newadouble.Duration = TimeSpan.FromSeconds(1);
                        //newstoryboard.Children.Add(newadouble);
                        //Storyboard.SetTargetName(txt_animation, newdoc.Name);
                        //Storyboard.SetTargetProperty(newadouble, new PropertyPath(OpacityProperty));
                        //newstoryboard.Begin(content_stackpanel);



                        //}



                        //show_video.Width = 0;
                        //show_video.Height = 0;
                        //show_image.Width = 0;
                        //show_image.Height = 0;
                        //text_content.Document = doc;
                        //newtimer.Interval = t.show_time * 1000;
                        // newtimer.Stop();
                        //newtimer.Start();

                        // PublicClass.show_hight = text_content.Height;
                        //text_content.UpdateLayout();
                        //content_stackpanel.UpdateLayout();

                        //ThicknessAnimation wait_animation = new ThicknessAnimation();
                        //wait_animation.From = new Thickness(0, 0, 0, 0);
                        //wait_animation.To = new Thickness(0, 0, 0, 0);
                        //wait_animation.Duration = TimeSpan.FromSeconds(t.show_time/2);

                        //text_content.BeginAnimation(TextBlock.MarginProperty, wait_animation);

                        // newtimer.Start();
                        //ThicknessAnimation txt_margin_animation = new ThicknessAnimation();
                        //txt_margin_animation.From = new Thickness(0, 0, 0, 0);
                        //txt_margin_animation.To = new Thickness(0, -(text_content.ActualHeight), 0, 0);
                        //txt_margin_animation.Duration = TimeSpan.FromSeconds(t.show_time);

                        //text_content.BeginAnimation(FlowDocumentScrollViewer.MarginProperty, txt_margin_animation);
                        // txt_margin_animation.RepeatBehavior = RepeatBehavior.Forever;

                        // newtimer.Interval = t.show_time * 1000;
                    }
                    else if (t.type == "图片")
                    {
                        //text_content.Width = 0;
                        //text_content.Height = 0;
                        //show_video.Width = 0;
                        //show_video.Height = 0;
                        //show_image.Source = new BitmapImage(new Uri(t.content, UriKind.Absolute));

                        //small_title.Text = t.title;
                        Image delimg = content_stackpanel.FindName("newimage" + t.ID) as Image;
                        if (delimg != null)
                        {
                            content_stackpanel.Children.Remove(delimg);
                            content_stackpanel.UnregisterName("newimage" + t.ID);
                        }
                        content_stackpanel.UpdateLayout();
                        Image newimage = new Image();
                        newimage.Opacity = 0;

                        newimage.Source = new BitmapImage(new Uri(t.content, UriKind.Absolute));
                        newimage.Width  = content_stackpanel.ActualWidth;
                        newimage.Height = this.ActualHeight;
                        //newimage.Width = content_stackpanel.Width;
                        //newimage.Height = content_stackpanel.Height;
                        content_stackpanel.Children.Add(newimage);
                        content_stackpanel.RegisterName("newimage" + t.ID, newimage);

                        //Label backlable = new Label();
                        //small_title.Background = new SolidColorBrush(Color.FromArgb(50, 0, 0, 0));
                        small_title.Margin = new Thickness(0, content_back.ActualHeight - 150, 0, 0);
                        //backlable.Height = 200;
                        small_title.Width = content_stackpanel.ActualWidth;

                        //Panel.SetZIndex(backlable, 2);
                        //content_stackpanel.Children.Add(backlable);
                        //TextBlock newtextblock = new TextBlock();
                    }
                    else if (t.type == "视频")
                    {
                        mvlist.Add(t.content);
                        //text_content.Height = 0;
                        //text_content.Width = 0;
                        //show_image.Width = 0;
                        //show_image.Height = 0;
                        //show_video.Source = new Uri(t.content, UriKind.Absolute);
                        // newtimer.Interval = t.show_time * 1000;
                        small_title.Visibility = Visibility.Hidden;
                    }

                    //}
                    //temp_step++;
                }


                if (mvlist.Count > 0)
                {
                    //foreach (var v in show_el)
                    //{
                    //MediaElement delmedia = content_stackpanel.FindName("newmeida" + v.ID) as MediaElement;
                    //if (delmedia != null)
                    //{
                    //    content_stackpanel.Children.Remove(delmedia);
                    //    content_stackpanel.UnregisterName("newmeida" + v.ID);
                    //}

                    MediaElement newmeida = new MediaElement();


                    content_stackpanel.Children.Add(newmeida);
                    //content_stackpanel.RegisterName("newmeida" + v.ID, newmeida);
                    newmeida.LoadedBehavior   = MediaState.Manual;
                    newmeida.UnloadedBehavior = MediaState.Manual;



                    newmeida.MediaEnded += new RoutedEventHandler(newmeida_MediaEnded);
                    newmeida.Source      = new Uri(mvlist[0], UriKind.Absolute);
                    content_stackpanel.UpdateLayout();
                    newmeida.Width = content_stackpanel.ActualWidth;
                    //newmeida.Height = content_stackpanel.ActualHeight;
                    // newmeida.UpdateLayout();
                    newmeida.Play();
                    //newmeida.Loaded += new RoutedEventHandler(newmeida_Loaded);
                    //newmeida.Unloaded += new RoutedEventHandler(newmeida_Unloaded);
                    //newmeida.MediaOpened += new RoutedEventHandler(newmeida_MediaOpened);
                    //}
                }



                //var showel = from el in publicDataSet.element join el_set in publicDataSet.el_elset on el.ID equals el_set.element_ID where el.status == true where el_set.element_set_ID == elset_id select el;
                //Storyboard newstoryboard = new Storyboard();
                int startanimation = 0;
                foreach (var s in show_el)
                {
                    if (s.type == "文档")
                    {
                        //ThicknessAnimation txt_animation = new ThicknessAnimation();
                        FlowDocumentScrollViewer new_fld = content_stackpanel.FindName("newdoc" + s.ID) as FlowDocumentScrollViewer;
                        new_fld.Name = "newdoc" + s.ID;

                        new_fld.UpdateLayout();

                        Storyboard newstoryboard1 = new Storyboard();
                        newstoryboard1.Name = "t" + s.ID;
                        DoubleAnimation newadoubleop = new DoubleAnimation();
                        newadoubleop.From     = 0;
                        newadoubleop.To       = 1;
                        newadoubleop.Duration = TimeSpan.FromSeconds(5);
                        newstoryboard1.Children.Add(newadoubleop);
                        Storyboard.SetTargetName(newadoubleop, new_fld.Name);
                        Storyboard.SetTargetProperty(newadoubleop, new PropertyPath(OpacityProperty));
                        newstoryboard1.Completed += new EventHandler(newstoryboard_Completed);
                        alist.Add(newstoryboard1);
                        if (startanimation == 0)
                        {
                            newstoryboard1.Begin(content_stackpanel);
                            startanimation = 1;
                        }

                        Storyboard newstoryboard2 = new Storyboard();
                        newstoryboard2.Name = "m" + s.ID;
                        ThicknessAnimation txt_animation = new ThicknessAnimation();
                        txt_animation.From = new Thickness(0, 0, 0, 0);
                        if (PublicClass.show_hight - new_fld.ActualHeight >= 0)
                        {
                            txt_animation.To = new Thickness(0, 0, 0, 0);
                        }
                        else
                        {
                            txt_animation.To = new Thickness(0, (PublicClass.show_hight - new_fld.ActualHeight), 0, 0);
                        }
                        // newdoc.Visibility = Visibility.Visible;
                        txt_animation.Duration = TimeSpan.FromSeconds(s.show_time);
                        newstoryboard2.Children.Add(txt_animation);
                        Storyboard.SetTargetName(txt_animation, new_fld.Name);
                        Storyboard.SetTargetProperty(txt_animation, new PropertyPath(MarginProperty));
                        newstoryboard2.Completed += new EventHandler(newstoryboard_Completed);
                        alist.Add(newstoryboard2);
                        //newstoryboard.Stop(content_stackpanel);
                        //newstoryboard.Begin(content_stackpanel);

                        Storyboard newstoryboard3 = new Storyboard();

                        DoubleAnimation newadouble = new DoubleAnimation();
                        newadouble.From     = 1;
                        newadouble.To       = 0;
                        newadouble.Duration = TimeSpan.FromSeconds(5);
                        newstoryboard3.Children.Add(newadouble);
                        Storyboard.SetTargetName(newadouble, new_fld.Name);
                        Storyboard.SetTargetProperty(newadouble, new PropertyPath(OpacityProperty));
                        newstoryboard3.Completed += new EventHandler(newstoryboard_Completed);
                        alist.Add(newstoryboard3);


                        Storyboard newstoryboard4 = new Storyboard();
                        //newstoryboard2.Name = "m" + s.ID;
                        ThicknessAnimation txt_animation4 = new ThicknessAnimation();
                        //txt_animation4.From = new Thickness(0, 0, 0, 0);
                        txt_animation4.To = new Thickness(0, 0, 0, 0);
                        // newdoc.Visibility = Visibility.Visible;
                        txt_animation4.Duration = TimeSpan.FromSeconds(0.1);
                        newstoryboard4.Children.Add(txt_animation4);
                        Storyboard.SetTargetName(txt_animation4, new_fld.Name);
                        Storyboard.SetTargetProperty(txt_animation4, new PropertyPath(MarginProperty));
                        newstoryboard4.Completed += new EventHandler(newstoryboard_Completed);
                        alist.Add(newstoryboard4);
                    }
                    else if (s.type == "图片")
                    {
                        Image new_img = content_stackpanel.FindName("newimage" + s.ID) as Image;
                        new_img.Name = "newimage" + s.ID;

                        //  new_img.UpdateLayout();

                        Storyboard newstoryboard_img1 = new Storyboard();
                        newstoryboard_img1.Name = "t1" + s.ID;
                        DoubleAnimation newadoubleop = new DoubleAnimation();
                        newadoubleop.From     = 0;
                        newadoubleop.To       = 1;
                        newadoubleop.Duration = TimeSpan.FromSeconds(0.5);
                        newstoryboard_img1.Children.Add(newadoubleop);
                        Storyboard.SetTargetName(newadoubleop, new_img.Name);
                        Storyboard.SetTargetProperty(newadoubleop, new PropertyPath(OpacityProperty));
                        newstoryboard_img1.Completed += new EventHandler(newstoryboard_img1_Completed);
                        alist.Add(newstoryboard_img1);
                        if (startanimation == 0)
                        {
                            newstoryboard_img1.Begin(content_stackpanel);
                            startanimation = 1;
                        }
                        //newstoryboard_img1.Begin(content_stackpanel);



                        Storyboard newstoryboard_img3 = new Storyboard();
                        newstoryboard_img3.Name = "t3" + s.ID;
                        DoubleAnimation newadoubleop3 = new DoubleAnimation();
                        newadoubleop3.From     = 1;
                        newadoubleop3.To       = 1;
                        newadoubleop3.Duration = TimeSpan.FromSeconds(10);
                        newstoryboard_img3.Children.Add(newadoubleop3);
                        Storyboard.SetTargetName(newadoubleop3, new_img.Name);
                        Storyboard.SetTargetProperty(newadoubleop3, new PropertyPath(OpacityProperty));
                        newstoryboard_img3.Completed += new EventHandler(newstoryboard_img1_Completed);
                        alist.Add(newstoryboard_img3);



                        Storyboard newstoryboard_img2 = new Storyboard();
                        newstoryboard_img1.Name = "t2" + s.ID;
                        DoubleAnimation newadoubleop2 = new DoubleAnimation();
                        newadoubleop2.From     = 1;
                        newadoubleop2.To       = 0;
                        newadoubleop2.Duration = TimeSpan.FromSeconds(0.5);
                        newstoryboard_img2.Children.Add(newadoubleop2);
                        Storyboard.SetTargetName(newadoubleop2, new_img.Name);
                        Storyboard.SetTargetProperty(newadoubleop2, new PropertyPath(OpacityProperty));
                        newstoryboard_img2.Completed += new EventHandler(newstoryboard_img1_Completed);
                        alist.Add(newstoryboard_img2);
                        //newstoryboard_img2.Begin(content_stackpanel);
                    }
                }


                //newstoryboard.Begin(content_stackpanel);

                //step++;
                //if (step > element_count)
                //{
                //    step = 0;
                //}
            }



            //    }));



            //}));
            //newthread.SetApartmentState(ApartmentState.MTA);
            //newthread.IsBackground = true;
            ////newthread.Priority = ThreadPriority.AboveNormal;
            //newthread.Start();
        }