Exemplo n.º 1
0
        void newmenuitem_Click(object sender, RoutedEventArgs e)
        {
            subwindow_content.Children.Clear();
            sub_addelement newadd = new sub_addelement();

            subwindow.Width   = 400;
            subwindow.Height  = 400;
            newadd.Name       = "newadd";
            subwindow.Opacity = 0.9;

            subwindow_content.Children.Add(newadd);
            Panel.SetZIndex(submainwindow, 3000);



            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;

            //publicDataSetInitializeTableAdapter.Fill(query);

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

            initializeViewSource.View.MoveCurrentToFirst();
        }
Exemplo n.º 2
0
        private void show_Click(object sender, RoutedEventArgs e)
        {
            fcb_public.publicDataSet publicDataSet = ((fcb_public.publicDataSet)(this.FindResource("publicDataSet")));
            fcb_public.publicDataSetTableAdapters.InitializeTableAdapter publicDataSetInitializeTableAdapter = new fcb_public.publicDataSetTableAdapters.InitializeTableAdapter();

            if (show.Content.ToString() == "展示" && iDTextBox.Text != "")
            {
                publicDataSet.Initialize.AddInitializeRow(iDTextBox.Text, false, (int)(SystemParameters.PrimaryScreenWidth - 300) / 2, (int)(SystemParameters.PrimaryScreenHeight - 400) / 2, 300, 400);
                publicDataSetInitializeTableAdapter.Update(publicDataSet.Initialize);
                publicDataSet.AcceptChanges();
                show.Content = "取消展示";
            }
            else
            {
                var del_row = from c in publicDataSet.Initialize where c.in_name == iDTextBox.Text select c;
                foreach (var t in del_row)
                {
                    t.Delete();
                }
                publicDataSetInitializeTableAdapter.Update(publicDataSet.Initialize);
                publicDataSet.AcceptChanges();
                show.Content = "展示";
            }

            PublicClass.show = "showelementset";
            RoutedPropertyChangedEventArgs <object> args = new RoutedPropertyChangedEventArgs <object>(this, e);

            args.RoutedEvent = sub_new_elementset.ModeShowEvent;
            this.RaiseEvent(args);
        }
Exemplo n.º 3
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;
        }
        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();
        }
        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();
        }
        private void show_Click(object sender, RoutedEventArgs e)
        {
            fcb_public.publicDataSet publicDataSet = ((fcb_public.publicDataSet)(this.FindResource("publicDataSet")));
            fcb_public.publicDataSetTableAdapters.InitializeTableAdapter publicDataSetInitializeTableAdapter = new fcb_public.publicDataSetTableAdapters.InitializeTableAdapter();

            if (show.Content.ToString() == "展示" && iDTextBox.Text!="")
            {
                publicDataSet.Initialize.AddInitializeRow(iDTextBox.Text, false, (int)(SystemParameters.PrimaryScreenWidth - 300) / 2, (int)(SystemParameters.PrimaryScreenHeight - 400) / 2, 300, 400);
                publicDataSetInitializeTableAdapter.Update(publicDataSet.Initialize);
                publicDataSet.AcceptChanges();
                show.Content = "取消展示";
            }
            else
            {
                var del_row = from c in publicDataSet.Initialize where c.in_name == iDTextBox.Text select c;
                foreach (var t in del_row)
                {
                    t.Delete();
                }
                publicDataSetInitializeTableAdapter.Update(publicDataSet.Initialize);
                publicDataSet.AcceptChanges();
                show.Content = "展示";
            }

            PublicClass.show = "showelementset";
            RoutedPropertyChangedEventArgs<object> args = new RoutedPropertyChangedEventArgs<object>(this, e);
            args.RoutedEvent = sub_new_elementset.ModeShowEvent;
            this.RaiseEvent(args);
        }
Exemplo n.º 7
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();
        }
Exemplo n.º 8
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);
                }
            }
        }
Exemplo n.º 9
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));
        }
Exemplo n.º 10
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();
        }