aboutsummaryrefslogtreecommitdiffstats
path: root/Software/Visual_Studio/Tango.Protobuf/CompilerProgressEventArgs.cs
blob: bd56d360ffd5e27e9ffcf0709a25ff77c24f803d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Tango.Protobuf
{
    public class CompilerProgressEventArgs : EventArgs
    {
        public int Current { get; set; }
        public int Total { get; set; }
        public String File { get; set; }
    }
}
System.IO; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Windows.Media.Imaging; using Tango.RemoteDesktop.Frames; namespace Tango.RemoteDesktop { /// <summary> /// Represents an image frame base class. /// </summary> /// <seealso cref="Tango.RemoteDesktop.IFrame" /> public abstract class Frame : IFrame { /// <summary> /// Gets the frame width. /// </summary> public abstract int Width { get; } /// <summary> /// Gets the frame height. /// </summary> public abstract int Height { get; } /// <summary> /// Returns a GDI bitmap representing the frame. /// </summary> /// <returns></returns> public abstract Bitmap ToBitmap(); /// <summary> /// Applies this frame onto an existing bitmap. /// </summary> /// <param name="bitmap">The bitmap.</param> public virtual void Apply(Bitmap bitmap) { using (Graphics g = Graphics.FromImage(bitmap)) { g.DrawImage(ToBitmap(), new Rectangle(0, 0, bitmap.Width, bitmap.Height)); } } /// <summary> /// Applies this frame onto an existing raster frame. /// </summary> /// <param name="frame">The frame.</param> public virtual void Apply(RasterFrame frame) { Apply(frame.ToBitmap()); } /// <summary> /// Returns a WPF BitmapSource representing the frame. /// </summary> /// <returns></returns> public BitmapSource ToBitmapSource() { MemoryStream ms = new MemoryStream(); ToBitmap().Save(ms, ImageFormat.Bmp); ms.Position = 0; var bitmapImage = new BitmapImage(); bitmapImage.BeginInit(); bitmapImage.StreamSource = ms; bitmapImage.EndInit(); bitmapImage.Freeze(); return bitmapImage; } /// <summary> /// Returns an instance of <see cref="IFrameEncoder" /> ready to encode this frame. /// </summary> /// <typeparam name="T"></typeparam> /// <returns></returns> public T ToEncoder<T>() where T : IFrameEncoder { return (T)Activator.CreateInstance(typeof(T), new object[] { this }); } /// <summary> /// Releases unmanaged and - optionally - managed resources. /// </summary> public abstract void Dispose(); } }