Пример #1
0
 protected virtual void Dispose(bool disposing)
 {
     if (disposing)
     {
         if (brush != null)
         {
             brush.Dispose();
         }
     }
 }
Пример #2
0
        //Dispose variables and clear memory
        void DisposeVariables()
        {
            try
            {
                Debug.WriteLine("Setting the last background task run date.");
                vApplicationSettings["BgStatusLastRunDate"] = DateTimeNow.ToString(vCultureInfoEng);

                Debug.WriteLine("Disposing variables and clearing memory.");
                if (Win2DCanvasDevice != null)
                {
                    Win2DCanvasDevice.Dispose();
                }
                if (Win2DCanvasRenderTarget != null)
                {
                    Win2DCanvasRenderTarget.Dispose();
                }
                if (Win2DCanvasBitmap != null)
                {
                    Win2DCanvasBitmap.Dispose();
                }
                if (Win2DCanvasImageBrush != null)
                {
                    Win2DCanvasImageBrush.Dispose();
                }
                if (Win2DCanvasTextFormatTitle != null)
                {
                    Win2DCanvasTextFormatTitle.Dispose();
                }
                if (Win2DCanvasTextFormatBody != null)
                {
                    Win2DCanvasTextFormatBody.Dispose();
                }
                if (Win2DCanvasTextFormatSub != null)
                {
                    Win2DCanvasTextFormatSub.Dispose();
                }
                if (Win2DCanvasTextFormatTextLeft != null)
                {
                    Win2DCanvasTextFormatTextLeft.Dispose();
                }
                if (Win2DCanvasTextFormatTextRight != null)
                {
                    Win2DCanvasTextFormatTextRight.Dispose();
                }
                if (Win2DCanvasTextFormatTextCenter != null)
                {
                    Win2DCanvasTextFormatTextCenter.Dispose();
                }
            }
            catch { }
        }