aboutsummaryrefslogtreecommitdiffstats
path: root/Software/Visual_Studio/Tango.DAL.Remote/Partials/RemoteDB.cs
blob: a298572629c7ea01ef197f90fad4535fd75958a6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
using System;
using System.Collections.Generic;
using System.Data.Entity;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Tango.Core;
using Tango.Settings;

namespace Tango.DAL.Remote.DB
{
    /// <summary>
    /// Represents an SQL Server database context.
    /// </summary>
    /// <seealso cref="System.Data.Entity.DbContext" />
    public partial class RemoteDB : DbContext
    {
        /// <summary>
        /// Initializes a new instance of the <see cref="RemoteDB"/> class.
        /// </summary>
        /// <param name="path">The server file path.</param>
        /// <param name="isFile">if set to <c>true</c> will try to connect to an .mdf file.</param>
        public RemoteDB(DataSource dataSource) : base(String.Format("metadata=res://*/DB.RemoteADO.csdl|res://*/DB.RemoteADO.ssdl|res://*/DB.RemoteADO.msl;provider=System.Data.SqlClient;provider connection string=\"{0}\"", dataSource.ToConnection().ConnectionString))
        {

        }
    }
}
if (brush == null) return null; if (brush.GetType() == typeof(SolidColorBrush)) { return new SharpDX.Direct2D1.SolidColorBrush(renderTarget, new SharpDX.Color4((brush as SolidColorBrush).Color.ToRgba()), new SharpDX.Direct2D1.BrushProperties() { Opacity = (float)brush.Opacity }); } else if (brush.GetType() == typeof(LinearGradientBrush)) { var linear = brush as LinearGradientBrush; var startPoint = new SharpDX.Vector2((float)linear.StartPoint.X, (float)linear.StartPoint.Y); var endPoint = new SharpDX.Vector2((float)linear.EndPoint.X, (float)linear.EndPoint.Y); SharpDX.Direct2D1.GradientStop[] stops = new SharpDX.Direct2D1.GradientStop[linear.GradientStops.Count]; for (int i = 0; i < linear.GradientStops.Count; i++) { stops[i] = new SharpDX.Direct2D1.GradientStop(); stops[i].Color = new SharpDX.Color4(linear.GradientStops[i].Color.ToRgba()); stops[i].Position = (float)linear.GradientStops[i].Offset; } var dxBrush = new SharpDX.Direct2D1.LinearGradientBrush( renderTarget, new SharpDX.Direct2D1.LinearGradientBrushProperties() { StartPoint = startPoint, EndPoint = endPoint, }, new SharpDX.Direct2D1.GradientStopCollection(renderTarget, stops)); return dxBrush; // var linearGradientBrush = new SharpDX.Direct2D1.LinearGradientBrush(renderTarget, new SharpDX.Direct2D1.LinearGradientBrushProperties() // { // StartPoint = new SharpDX.Vector2(50, 0), // EndPoint = new SharpDX.Vector2(450, 0), // }, //new SharpDX.Direct2D1.GradientStopCollection(renderTarget, new SharpDX.Direct2D1.GradientStop[] // { // new SharpDX.Direct2D1.GradientStop() // { // Color = SharpDX.Color.Blue, // Position = 0, // }, // new SharpDX.Direct2D1.GradientStop() // { // Color = SharpDX.Color.Green, // Position = 1, // } // })); // return linearGradientBrush; } else { return null; } } } }