diff options
| author | Roy Ben Shabat <Roy.mail.net@gmail.com> | 2018-06-30 02:08:25 +0300 |
|---|---|---|
| committer | Roy Ben Shabat <Roy.mail.net@gmail.com> | 2018-06-30 02:08:25 +0300 |
| commit | 48904928ae83d9c836fe8408374a21af01e5b132 (patch) | |
| tree | f73ff35b4fcdcddb3f9c1fe98de4b52f574d20de /Software/Visual_Studio/Tango.Hive | |
| parent | da35b8b425a6cf269b836e34b7223742dd37a557 (diff) | |
| download | Tango-48904928ae83d9c836fe8408374a21af01e5b132.tar.gz Tango-48904928ae83d9c836fe8408374a21af01e5b132.zip | |
Added Tango.Hive.
Diffstat (limited to 'Software/Visual_Studio/Tango.Hive')
11 files changed, 834 insertions, 0 deletions
diff --git a/Software/Visual_Studio/Tango.Hive/Converters/HexClipConverter.cs b/Software/Visual_Studio/Tango.Hive/Converters/HexClipConverter.cs new file mode 100644 index 000000000..d26e4a44a --- /dev/null +++ b/Software/Visual_Studio/Tango.Hive/Converters/HexClipConverter.cs @@ -0,0 +1,54 @@ +using System; +using System.Globalization; +using System.Windows; +using System.Windows.Controls; +using System.Windows.Data; +using System.Windows.Media; + +namespace Tango.Hive.Converters +{ + public class HexClipConverter: IMultiValueConverter + { + public object Convert(object[] values, Type targetType, object parameter, CultureInfo culture) + { + double w = (double)values[0]; + double h = (double)values[1]; + Orientation o = (Orientation) values[2]; + + if (w <= 0 || h <= 0) + return null; + + PathFigure figure = o == Orientation.Horizontal + ? new PathFigure + { + StartPoint = new Point(0, h*0.5), + Segments = + { + new LineSegment {Point = new Point(w*0.25, 0)}, + new LineSegment {Point = new Point(w*0.75, 0)}, + new LineSegment {Point = new Point(w, h*0.5)}, + new LineSegment {Point = new Point(w*0.75, h)}, + new LineSegment {Point = new Point(w*0.25, h)}, + } + } + : new PathFigure + { + StartPoint = new Point(w*0.5, 0), + Segments = + { + new LineSegment {Point = new Point(w, h*0.25)}, + new LineSegment {Point = new Point(w, h*0.75)}, + new LineSegment {Point = new Point(w*0.5, h)}, + new LineSegment {Point = new Point(0, h*0.75)}, + new LineSegment {Point = new Point(0, h*0.25)}, + } + }; + return new PathGeometry { Figures = { figure } }; + } + + public object[] ConvertBack(object value, Type[] targetTypes, object parameter, CultureInfo culture) + { + throw new NotImplementedException(); + } + } +} diff --git a/Software/Visual_Studio/Tango.Hive/HexGrid.cs b/Software/Visual_Studio/Tango.Hive/HexGrid.cs new file mode 100644 index 000000000..af4598de0 --- /dev/null +++ b/Software/Visual_Studio/Tango.Hive/HexGrid.cs @@ -0,0 +1,297 @@ +using System; +using System.Windows; +using System.Windows.Controls; + +namespace Tango.Hive +{ + /// <summary> + /// Hexagonal panel + /// </summary> + public class HexGrid: Panel + { + #region Orientation + public static readonly DependencyProperty OrientationProperty = + DependencyProperty.RegisterAttached("Orientation", typeof(Orientation), typeof(HexGrid), + new FrameworkPropertyMetadata(Orientation.Horizontal, + FrameworkPropertyMetadataOptions.AffectsMeasure | + FrameworkPropertyMetadataOptions.AffectsArrange | + FrameworkPropertyMetadataOptions.Inherits)); + + public static void SetOrientation(DependencyObject element, Orientation value) + { + element.SetValue(OrientationProperty, value); + } + + public static Orientation GetOrientation(DependencyObject element) + { + return (Orientation)element.GetValue(OrientationProperty); + } + + public Orientation Orientation + { + get { return (Orientation) GetValue(OrientationProperty); } + set { SetValue(OrientationProperty, value); } + } + #endregion + + public static readonly DependencyProperty RowCountProperty = + DependencyProperty.Register("RowCount", typeof (int), typeof (HexGrid), + new FrameworkPropertyMetadata(1, FrameworkPropertyMetadataOptions.AffectsMeasure | FrameworkPropertyMetadataOptions.AffectsArrange), + ValidateCountCallback); + + + public int RowCount + { + get { return (int) GetValue(RowCountProperty); } + set { SetValue(RowCountProperty, value); } + } + + public static readonly DependencyProperty ColumnCountProperty = + DependencyProperty.Register("ColumnCount", typeof (int), typeof (HexGrid), + new FrameworkPropertyMetadata(1, FrameworkPropertyMetadataOptions.AffectsMeasure | FrameworkPropertyMetadataOptions.AffectsArrange), + ValidateCountCallback); + + public int ColumnCount + { + get { return (int) GetValue(ColumnCountProperty); } + set { SetValue(ColumnCountProperty, value); } + } + + private static bool ValidateCountCallback(object value) + { + if (value is int) + { + int count = (int)value; + return count > 0; + } + + return false; + } + + private int GetRow(UIElement e) + { + int row = (int)e.GetValue(Grid.RowProperty); + if (row >= RowCount) + row = RowCount - 1; + return row; + } + + private int GetColumn(UIElement e) + { + int column = (int)e.GetValue(Grid.ColumnProperty); + if (column >= ColumnCount) + column = ColumnCount - 1; + return column; + } + + protected override Size MeasureOverride(Size availableSize) + { + double w = availableSize.Width; + double h = availableSize.Height; + + // if there is Infinity size dimension + if (Double.IsInfinity(w) || Double.IsInfinity(h)) + { + // determine maximum desired size + h = 0; + w = 0; + foreach (UIElement e in InternalChildren) + { + e.Measure(availableSize); + var s = e.DesiredSize; + if (s.Height > h) + h = s.Height; + if (s.Width > w) + w = s.Width; + } + + // multiply maximum size to RowCount and ColumnCount to get total size + if (Orientation == Orientation.Horizontal) + return new Size(w*(ColumnCount * 3 + 1)/4, h*(RowCount * 2 + 1)/2); + + return new Size(w*(ColumnCount * 2 + 1)/2, h*(RowCount * 3 + 1)/4); + } + + return availableSize; + } + + #region HasShift + private void HasShift(out bool first, out bool last) + { + if (Orientation == Orientation.Horizontal) + HasRowShift(out first, out last); + else + HasColumnShift(out first, out last); + } + + private void HasRowShift(out bool firstRow, out bool lastRow) + { + firstRow = lastRow = true; + + UIElementCollection elements = base.InternalChildren; + for (int i = 0; i < elements.Count && (firstRow || lastRow); i++) + { + var e = elements[i]; + if (e.Visibility == Visibility.Collapsed) + continue; + + int row = GetRow(e); + int column = GetColumn(e); + + int mod = column % 2; + + if (row == 0 && mod == 0) + firstRow = false; + + if (row == RowCount - 1 && mod == 1) + lastRow = false; + } + } + + private void HasColumnShift(out bool firstColumn, out bool lastColumn) + { + firstColumn = lastColumn = true; + + UIElementCollection elements = base.InternalChildren; + for (int i = 0; i < elements.Count && (firstColumn || lastColumn); i++) + { + var e = elements[i]; + if (e.Visibility == Visibility.Collapsed) + continue; + + int row = GetRow(e); + int column = GetColumn(e); + + int mod = row % 2; + + if (column == 0 && mod == 0) + firstColumn = false; + + if (column == ColumnCount - 1 && mod == 1) + lastColumn = false; + } + } + #endregion + + #region GetHexSize + private Size GetHexSize(Size gridSize) + { + double minH = 0; + double minW = 0; + + foreach (UIElement e in InternalChildren) + { + var f = e as FrameworkElement; + if (f != null) + { + if (f.MinHeight > minH) + minH = f.MinHeight; + if (f.MinWidth > minW) + minW = f.MinWidth; + } + } + + bool first, last; + HasShift(out first, out last); + + var possibleSize = GetPossibleSize(gridSize); + double possibleW = possibleSize.Width; + double possibleH = possibleSize.Height; + + var w = Math.Max(minW, possibleW); + var h = Math.Max(minH, possibleH); + + return new Size(w, h); + } + + private Size GetPossibleSize(Size gridSize) + { + bool first, last; + HasShift(out first, out last); + + if (Orientation == Orientation.Horizontal) + return GetPossibleSizeHorizontal(gridSize, first, last); + + return GetPossibleSizeVertical(gridSize, first, last); + } + + private Size GetPossibleSizeVertical(Size gridSize, bool first, bool last) + { + int columns = ((first ? 0 : 1) + 2*ColumnCount - (last ? 1 : 0)); + double w = 2 * (gridSize.Width / columns); + + int rows = 1 + 3*RowCount; + double h = 4 * (gridSize.Height / rows); + + return new Size(w, h); + } + + private Size GetPossibleSizeHorizontal(Size gridSize, bool first, bool last) + { + int columns = 1 + 3*ColumnCount; + double w = 4 * (gridSize.Width / columns); + + int rows = (first ? 0 : 1) + 2 * RowCount - (last ? 1 : 0); + double h = 2 * (gridSize.Height / rows); + + return new Size(w, h); + } + #endregion + + protected override Size ArrangeOverride(Size finalSize) + { + // determine if there is empty space at grid borders + bool first, last; + HasShift(out first, out last); + + // compute final hex size + Size hexSize = GetHexSize(finalSize); + + // compute arrange line sizes + double columnWidth, rowHeight; + if (Orientation == Orientation.Horizontal) + { + rowHeight = 0.50 * hexSize.Height; + columnWidth = 0.25 * hexSize.Width; + } + else + { + rowHeight = 0.25 * hexSize.Height; + columnWidth = 0.50 * hexSize.Width; + } + + // arrange elements + UIElementCollection elements = base.InternalChildren; + for (int i = 0; i < elements.Count; i++) + { + if (elements[i].Visibility == Visibility.Collapsed) + continue; + ArrangeElement(elements[i], hexSize, columnWidth, rowHeight, first); + } + + return finalSize; + } + + private void ArrangeElement(UIElement e, Size hexSize, double columnWidth, double rowHeight, bool shift) + { + int row = GetRow(e); + int column = GetColumn(e); + + double x; + double y; + + if (Orientation == Orientation.Horizontal) + { + x = 3 * columnWidth * column; + y = rowHeight * (2 * row + (column % 2 == 1 ? 1 : 0) + (shift ? -1 : 0)); + } + else + { + x = columnWidth * (2 * column + (row % 2 == 1 ? 1 : 0) + (shift ? -1 : 0)); + y = 3 * rowHeight * row; + } + + e.Arrange(new Rect(x, y, hexSize.Width, hexSize.Height)); + } + } +} diff --git a/Software/Visual_Studio/Tango.Hive/HexItem.cs b/Software/Visual_Studio/Tango.Hive/HexItem.cs new file mode 100644 index 000000000..67a301595 --- /dev/null +++ b/Software/Visual_Studio/Tango.Hive/HexItem.cs @@ -0,0 +1,25 @@ +using System.Windows; +using System.Windows.Controls; + +namespace Tango.Hive +{ + /// <summary> + /// Hexagonal content control + /// </summary> + public class HexItem : ListBoxItem + { + static HexItem() + { + DefaultStyleKeyProperty.OverrideMetadata(typeof(HexItem), new FrameworkPropertyMetadata(typeof(HexItem))); + } + + public static readonly DependencyProperty OrientationProperty = HexGrid.OrientationProperty.AddOwner(typeof(HexItem)); + + public Orientation Orientation + { + get { return (Orientation) GetValue(OrientationProperty); } + set { SetValue(OrientationProperty, value); } + } + + } +} diff --git a/Software/Visual_Studio/Tango.Hive/HexList.cs b/Software/Visual_Studio/Tango.Hive/HexList.cs new file mode 100644 index 000000000..cd611eae1 --- /dev/null +++ b/Software/Visual_Studio/Tango.Hive/HexList.cs @@ -0,0 +1,42 @@ +using System.Windows; +using System.Windows.Controls; + +namespace Tango.Hive +{ + public class HexList: ListBox + { + static HexList() + { + DefaultStyleKeyProperty.OverrideMetadata(typeof(HexList), new FrameworkPropertyMetadata(typeof(HexList))); + } + + public static readonly DependencyProperty OrientationProperty = HexGrid.OrientationProperty.AddOwner(typeof (HexList)); + + public static readonly DependencyProperty RowCountProperty = HexGrid.RowCountProperty.AddOwner(typeof (HexList)); + + public static readonly DependencyProperty ColumnCountProperty = HexGrid.ColumnCountProperty.AddOwner(typeof (HexList)); + + public Orientation Orientation + { + get { return (Orientation)GetValue(OrientationProperty); } + set { SetValue(OrientationProperty, value); } + } + + public int RowCount + { + get { return (int)GetValue(RowCountProperty); } + set { SetValue(RowCountProperty, value); } + } + + public int ColumnCount + { + get { return (int)GetValue(ColumnCountProperty); } + set { SetValue(ColumnCountProperty, value); } + } + + protected override bool IsItemItsOwnContainerOverride(object item) + { + return (item is HexItem); + } + } +} diff --git a/Software/Visual_Studio/Tango.Hive/Properties/AssemblyInfo.cs b/Software/Visual_Studio/Tango.Hive/Properties/AssemblyInfo.cs new file mode 100644 index 000000000..ac776638e --- /dev/null +++ b/Software/Visual_Studio/Tango.Hive/Properties/AssemblyInfo.cs @@ -0,0 +1,16 @@ +using System.Reflection; +using System.Resources; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; +using System.Windows; + +[assembly: AssemblyTitle("Tango - Hive UI Components")] + +[assembly:ThemeInfo( + ResourceDictionaryLocation.None, //where theme specific resource dictionaries are located + //(used if a resource is not found in the page, + // or application resource dictionaries) + ResourceDictionaryLocation.SourceAssembly //where the generic resource dictionary is located + //(used if a resource is not found in the page, + // app, or any theme specific resource dictionaries) +)] diff --git a/Software/Visual_Studio/Tango.Hive/Properties/Resources.Designer.cs b/Software/Visual_Studio/Tango.Hive/Properties/Resources.Designer.cs new file mode 100644 index 000000000..814107e6c --- /dev/null +++ b/Software/Visual_Studio/Tango.Hive/Properties/Resources.Designer.cs @@ -0,0 +1,63 @@ +//------------------------------------------------------------------------------ +// <auto-generated> +// This code was generated by a tool. +// Runtime Version:4.0.30319.42000 +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// </auto-generated> +//------------------------------------------------------------------------------ + +namespace Tango.Hive.Properties { + using System; + + + /// <summary> + /// A strongly-typed resource class, for looking up localized strings, etc. + /// </summary> + // This class was auto-generated by the StronglyTypedResourceBuilder + // class via a tool like ResGen or Visual Studio. + // To add or remove a member, edit your .ResX file then rerun ResGen + // with the /str option, or rebuild your VS project. + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "15.0.0.0")] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] + internal class Resources { + + private static global::System.Resources.ResourceManager resourceMan; + + private static global::System.Globalization.CultureInfo resourceCulture; + + [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] + internal Resources() { + } + + /// <summary> + /// Returns the cached ResourceManager instance used by this class. + /// </summary> + [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] + internal static global::System.Resources.ResourceManager ResourceManager { + get { + if (object.ReferenceEquals(resourceMan, null)) { + global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("Tango.Hive.Properties.Resources", typeof(Resources).Assembly); + resourceMan = temp; + } + return resourceMan; + } + } + + /// <summary> + /// Overrides the current thread's CurrentUICulture property for all + /// resource lookups using this strongly typed resource class. + /// </summary> + [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] + internal static global::System.Globalization.CultureInfo Culture { + get { + return resourceCulture; + } + set { + resourceCulture = value; + } + } + } +} diff --git a/Software/Visual_Studio/Tango.Hive/Properties/Resources.resx b/Software/Visual_Studio/Tango.Hive/Properties/Resources.resx new file mode 100644 index 000000000..af7dbebba --- /dev/null +++ b/Software/Visual_Studio/Tango.Hive/Properties/Resources.resx @@ -0,0 +1,117 @@ +<?xml version="1.0" encoding="utf-8"?> +<root> + <!-- + Microsoft ResX Schema + + Version 2.0 + + The primary goals of this format is to allow a simple XML format + that is mostly human readable. The generation and parsing of the + various data types are done through the TypeConverter classes + associated with the data types. + + Example: + + ... ado.net/XML headers & schema ... + <resheader name="resmimetype">text/microsoft-resx</resheader> + <resheader name="version">2.0</resheader> + <resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader> + <resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader> + <data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data> + <data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data> + <data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64"> + <value>[base64 mime encoded serialized .NET Framework object]</value> + </data> + <data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64"> + <value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value> + <comment>This is a comment</comment> + </data> + + There are any number of "resheader" rows that contain simple + name/value pairs. + + Each data row contains a name, and value. The row also contains a + type or mimetype. Type corresponds to a .NET class that support + text/value conversion through the TypeConverter architecture. + Classes that don't support this are serialized and stored with the + mimetype set. + + The mimetype is used for serialized objects, and tells the + ResXResourceReader how to depersist the object. This is currently not + extensible. For a given mimetype the value must be set accordingly: + + Note - application/x-microsoft.net.object.binary.base64 is the format + that the ResXResourceWriter will generate, however the reader can + read any of the formats listed below. + + mimetype: application/x-microsoft.net.object.binary.base64 + value : The object must be serialized with + : System.Serialization.Formatters.Binary.BinaryFormatter + : and then encoded with base64 encoding. + + mimetype: application/x-microsoft.net.object.soap.base64 + value : The object must be serialized with + : System.Runtime.Serialization.Formatters.Soap.SoapFormatter + : and then encoded with base64 encoding. + + mimetype: application/x-microsoft.net.object.bytearray.base64 + value : The object must be serialized into a byte array + : using a System.ComponentModel.TypeConverter + : and then encoded with base64 encoding. + --> + <xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata"> + <xsd:element name="root" msdata:IsDataSet="true"> + <xsd:complexType> + <xsd:choice maxOccurs="unbounded"> + <xsd:element name="metadata"> + <xsd:complexType> + <xsd:sequence> + <xsd:element name="value" type="xsd:string" minOccurs="0" /> + </xsd:sequence> + <xsd:attribute name="name" type="xsd:string" /> + <xsd:attribute name="type" type="xsd:string" /> + <xsd:attribute name="mimetype" type="xsd:string" /> + </xsd:complexType> + </xsd:element> + <xsd:element name="assembly"> + <xsd:complexType> + <xsd:attribute name="alias" type="xsd:string" /> + <xsd:attribute name="name" type="xsd:string" /> + </xsd:complexType> + </xsd:element> + <xsd:element name="data"> + <xsd:complexType> + <xsd:sequence> + <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" /> + <xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" /> + </xsd:sequence> + <xsd:attribute name="name" type="xsd:string" msdata:Ordinal="1" /> + <xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" /> + <xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" /> + </xsd:complexType> + </xsd:element> + <xsd:element name="resheader"> + <xsd:complexType> + <xsd:sequence> + <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" /> + </xsd:sequence> + <xsd:attribute name="name" type="xsd:string" use="required" /> + </xsd:complexType> + </xsd:element> + </xsd:choice> + </xsd:complexType> + </xsd:element> + </xsd:schema> + <resheader name="resmimetype"> + <value>text/microsoft-resx</value> + </resheader> + <resheader name="version"> + <value>2.0</value> + </resheader> + <resheader name="reader"> + <value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value> + </resheader> + <resheader name="writer"> + <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value> + </resheader> +</root>
\ No newline at end of file diff --git a/Software/Visual_Studio/Tango.Hive/Properties/Settings.Designer.cs b/Software/Visual_Studio/Tango.Hive/Properties/Settings.Designer.cs new file mode 100644 index 000000000..79e1bc864 --- /dev/null +++ b/Software/Visual_Studio/Tango.Hive/Properties/Settings.Designer.cs @@ -0,0 +1,26 @@ +//------------------------------------------------------------------------------ +// <auto-generated> +// This code was generated by a tool. +// Runtime Version:4.0.30319.42000 +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// </auto-generated> +//------------------------------------------------------------------------------ + +namespace Tango.Hive.Properties { + + + [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "15.7.0.0")] + internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase { + + private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings()))); + + public static Settings Default { + get { + return defaultInstance; + } + } + } +} diff --git a/Software/Visual_Studio/Tango.Hive/Properties/Settings.settings b/Software/Visual_Studio/Tango.Hive/Properties/Settings.settings new file mode 100644 index 000000000..033d7a5e9 --- /dev/null +++ b/Software/Visual_Studio/Tango.Hive/Properties/Settings.settings @@ -0,0 +1,7 @@ +<?xml version='1.0' encoding='utf-8'?> +<SettingsFile xmlns="uri:settings" CurrentProfile="(Default)"> + <Profiles> + <Profile Name="(Default)" /> + </Profiles> + <Settings /> +</SettingsFile>
\ No newline at end of file diff --git a/Software/Visual_Studio/Tango.Hive/Tango.Hive.csproj b/Software/Visual_Studio/Tango.Hive/Tango.Hive.csproj new file mode 100644 index 000000000..88826e731 --- /dev/null +++ b/Software/Visual_Studio/Tango.Hive/Tango.Hive.csproj @@ -0,0 +1,97 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" /> + <PropertyGroup> + <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> + <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> + <ProjectGuid>{942134AC-6EA2-4500-8F22-0F739B70A05F}</ProjectGuid> + <OutputType>library</OutputType> + <AppDesignerFolder>Properties</AppDesignerFolder> + <RootNamespace>Tango.Hive</RootNamespace> + <AssemblyName>Tango.Hive</AssemblyName> + <TargetFrameworkVersion>v4.6</TargetFrameworkVersion> + <FileAlignment>512</FileAlignment> + <ProjectTypeGuids>{60dc8134-eba5-43b8-bcc9-bb4bc16c2548};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids> + <WarningLevel>4</WarningLevel> + <TargetFrameworkProfile /> + </PropertyGroup> + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> + <DebugSymbols>true</DebugSymbols> + <DebugType>full</DebugType> + <Optimize>false</Optimize> + <OutputPath>..\Build\Debug\</OutputPath> + <DefineConstants>DEBUG;TRACE</DefineConstants> + <ErrorReport>prompt</ErrorReport> + <WarningLevel>4</WarningLevel> + <Prefer32Bit>false</Prefer32Bit> + </PropertyGroup> + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> + <DebugType>pdbonly</DebugType> + <Optimize>true</Optimize> + <OutputPath>..\Build\Release\</OutputPath> + <DefineConstants>TRACE</DefineConstants> + <ErrorReport>prompt</ErrorReport> + <WarningLevel>4</WarningLevel> + <Prefer32Bit>false</Prefer32Bit> + </PropertyGroup> + <ItemGroup> + <Reference Include="System" /> + <Reference Include="System.Data" /> + <Reference Include="System.Xml" /> + <Reference Include="Microsoft.CSharp" /> + <Reference Include="System.Core" /> + <Reference Include="System.Xml.Linq" /> + <Reference Include="System.Data.DataSetExtensions" /> + <Reference Include="System.Xaml"> + <RequiredTargetFramework>4.0</RequiredTargetFramework> + </Reference> + <Reference Include="WindowsBase" /> + <Reference Include="PresentationCore" /> + <Reference Include="PresentationFramework" /> + </ItemGroup> + <ItemGroup> + <Page Include="Themes\Generic.xaml"> + <Generator>MSBuild:Compile</Generator> + <SubType>Designer</SubType> + </Page> + <Compile Include="..\Versioning\Core.cs"> + <Link>Core.cs</Link> + </Compile> + <Compile Include="Converters\HexClipConverter.cs" /> + </ItemGroup> + <ItemGroup> + <Compile Include="HexGrid.cs" /> + <Compile Include="HexList.cs" /> + <Compile Include="HexItem.cs" /> + <Compile Include="Properties\AssemblyInfo.cs"> + <SubType>Code</SubType> + </Compile> + <Compile Include="Properties\Resources.Designer.cs"> + <AutoGen>True</AutoGen> + <DesignTime>True</DesignTime> + <DependentUpon>Resources.resx</DependentUpon> + </Compile> + <Compile Include="Properties\Settings.Designer.cs"> + <AutoGen>True</AutoGen> + <DependentUpon>Settings.settings</DependentUpon> + <DesignTimeSharedInput>True</DesignTimeSharedInput> + </Compile> + <EmbeddedResource Include="Properties\Resources.resx"> + <Generator>ResXFileCodeGenerator</Generator> + <LastGenOutput>Resources.Designer.cs</LastGenOutput> + </EmbeddedResource> + <None Include="Properties\Settings.settings"> + <Generator>SettingsSingleFileGenerator</Generator> + <LastGenOutput>Settings.Designer.cs</LastGenOutput> + </None> + <AppDesigner Include="Properties\" /> + </ItemGroup> + <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" /> + <!-- To modify your build process, add your task inside one of the targets below and uncomment it. + Other similar extension points exist, see Microsoft.Common.targets. + <Target Name="BeforeBuild"> + </Target> + <Target Name="AfterBuild"> + </Target> + --> +</Project>
\ No newline at end of file diff --git a/Software/Visual_Studio/Tango.Hive/Themes/Generic.xaml b/Software/Visual_Studio/Tango.Hive/Themes/Generic.xaml new file mode 100644 index 000000000..49308e512 --- /dev/null +++ b/Software/Visual_Studio/Tango.Hive/Themes/Generic.xaml @@ -0,0 +1,90 @@ +<ResourceDictionary + xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" + xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" + xmlns:local="clr-namespace:Tango.Hive" + xmlns:converters="clr-namespace:Tango.Hive.Converters"> + + <converters:HexClipConverter x:Key="ClipConverter"/> + + <!--HexItem--> + <Style TargetType="{x:Type local:HexItem}"> + <Setter Property="Background" Value="CornflowerBlue"/> + <Setter Property="BorderBrush" Value="Black"/> + <Setter Property="BorderThickness" Value="4"/> + <Setter Property="HorizontalContentAlignment" Value="Center"/> + <Setter Property="VerticalContentAlignment" Value="Center"/> + <Setter Property="Template"> + <Setter.Value> + <ControlTemplate TargetType="local:HexItem"> + <Grid Name="hexBorder" Background="{TemplateBinding BorderBrush}"> + <Grid.Clip> + <MultiBinding Converter="{StaticResource ClipConverter}"> + <Binding Path="ActualWidth" ElementName="hexBorder"/> + <Binding Path="ActualHeight" ElementName="hexBorder"/> + <Binding Path="Orientation" RelativeSource="{RelativeSource TemplatedParent}"/> + </MultiBinding> + </Grid.Clip> + + <Grid Name="hexContent" + Background="{TemplateBinding Background}" + Margin="{TemplateBinding BorderThickness}" VerticalAlignment="Stretch" HorizontalAlignment="Stretch"> + <Grid.Clip> + <MultiBinding Converter="{StaticResource ClipConverter}"> + <Binding Path="ActualWidth" ElementName="hexContent"/> + <Binding Path="ActualHeight" ElementName="hexContent"/> + <Binding Path="Orientation" RelativeSource="{RelativeSource TemplatedParent}"/> + </MultiBinding> + </Grid.Clip> + + <ContentPresenter VerticalAlignment="{TemplateBinding VerticalContentAlignment}" + HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" + ClipToBounds="True" + + Margin="{TemplateBinding Padding}" + Content="{TemplateBinding Content}" + ContentTemplate="{TemplateBinding ContentTemplate}"/> + </Grid> + </Grid> + <ControlTemplate.Triggers> + <Trigger Property="IsSelected" Value="True"> + <Setter Property="BorderBrush" Value="Gold"/> + </Trigger> + </ControlTemplate.Triggers> + </ControlTemplate> + </Setter.Value> + </Setter> + </Style> + + <!--HexList--> + <Style TargetType="{x:Type local:HexList}"> + <Setter Property="ItemsPanel"> + <Setter.Value> + <ItemsPanelTemplate> + <local:HexGrid ColumnCount="{Binding Path=ColumnCount, RelativeSource={RelativeSource AncestorType=ListBox}}" + RowCount="{Binding Path=RowCount, RelativeSource={RelativeSource AncestorType=ListBox}}" + Background="{Binding Path=Background, RelativeSource={RelativeSource AncestorType=ListBox}}"/> + </ItemsPanelTemplate> + </Setter.Value> + </Setter> + + <Setter Property="Template"> + <Setter.Value> + <ControlTemplate TargetType="{x:Type local:HexList}"> + <Grid> + <Border BorderBrush="{TemplateBinding BorderBrush}" + BorderThickness="{TemplateBinding BorderThickness}" + Background="{TemplateBinding Background}" + Padding="{TemplateBinding Padding}" SnapsToDevicePixels="True"> + <ScrollViewer Focusable="False" + HorizontalScrollBarVisibility="Auto" + VerticalScrollBarVisibility="Auto" + Padding="{TemplateBinding Padding}"> + <ItemsPresenter SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}"/> + </ScrollViewer> + </Border> + </Grid> + </ControlTemplate> + </Setter.Value> + </Setter> + </Style> +</ResourceDictionary> |
