Esempio n. 1
0
 public void DestroyLayout()
 {
     App.DoEvents();
     if (_regions != null)
     {
         if (_regions.Count == 0)
         {
             _regions = null;
         }
         else
         {
             for (int i = 0; i < _regions.Count; i++)
             {
                 ClientApp.Core.Region region = _regions[i];
                 region.Clear();
                 base.Dispatcher.BeginInvoke(DispatcherPriority.Normal, new Action(() => {
                     if (region != null)
                     {
                         this.MediaCanvas.Children.Remove(region);
                     }
                 }));
                 try
                 {
                     region.Dispose();
                 }
                 catch (Exception)
                 {
                 }
             }
             _regions.Clear();
             _regions = null;
         }
     }
 }
Esempio n. 2
0
        // Private Methods (8) 

        /// <summary>
        /// Disposes Layout - removes the controls
        /// </summary>
        public void DestroyLayout()
        {
            Debug.WriteLine("Destroying Layout", "AdvertPlayer - DestoryLayout");

            App.DoEvents();

            if (_regions == null)
            {
                return;
            }

            if (_regions.Count == 0)
            {
                _regions = null;
                return;
            }

            for (int i = 0; i < _regions.Count; i++)
            {
                Region region = _regions[i];
                region.Clear();

                Dispatcher.BeginInvoke(DispatcherPriority.Normal, new ThreadStart(() =>
                {
                    if (region != null)
                    {
                        MediaCanvas.Children.Remove(region);
                    }
                }));


                try
                {
                    Debug.WriteLine("Calling Dispose Region", "AdvertPlayer - DestoryLayout");
                    region.Dispose();
                }
                catch (Exception e)
                {
                    //do nothing (perhaps write to some error xml somewhere?)
                    Debug.WriteLine(e.Message);
                }
            }

            _regions.Clear();
            _regions = null;
        }