Ok, Just Do It!

This commit is contained in:
Vitaliy
2017-02-18 00:15:59 +03:00
parent f0913f9873
commit 5c46ef7b7f
122 changed files with 1712 additions and 2177 deletions

View File

@@ -1,24 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<configSections>
<section name="entityFramework" type="System.Data.Entity.Internal.ConfigFile.EntityFrameworkSection, EntityFramework, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" />
<!-- For more information on Entity Framework configuration, visit http://go.microsoft.com/fwlink/?LinkID=237468 -->
</configSections>
<entityFramework>
<defaultConnectionFactory type="System.Data.Entity.Infrastructure.LocalDbConnectionFactory, EntityFramework">
<parameters>
<parameter value="v13.0" />
</parameters>
</defaultConnectionFactory>
<providers>
<provider invariantName="MySql.Data.MySqlClient" type="MySql.Data.MySqlClient.MySqlProviderServices, MySql.Data.Entity.EF6, Version=6.9.9.0, Culture=neutral, PublicKeyToken=c5687fc88969c44d"></provider>
<provider invariantName="System.Data.SqlClient" type="System.Data.Entity.SqlServer.SqlProviderServices, EntityFramework.SqlServer" />
</providers>
</entityFramework>
<system.data>
<DbProviderFactories>
<remove invariant="MySql.Data.MySqlClient" />
<add name="MySQL Data Provider" invariant="MySql.Data.MySqlClient" description=".Net Framework Data Provider for MySQL" type="MySql.Data.MySqlClient.MySqlClientFactory, MySql.Data, Version=6.9.9.0, Culture=neutral, PublicKeyToken=c5687fc88969c44d" />
</DbProviderFactories>
</system.data>
</configuration>

View File

@@ -1,126 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="14.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>{B4695C76-31FF-4BF1-9DC6-1BC62D374091}</ProjectGuid>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>AppleJobs.Data</RootNamespace>
<AssemblyName>AppleJobs.Data</AssemblyName>
<TargetFrameworkVersion>v4.5.2</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<ProjectTypeGuids>{60dc8134-eba5-43b8-bcc9-bb4bc16c2548};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
<WarningLevel>4</WarningLevel>
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup>
<StartupObject />
</PropertyGroup>
<ItemGroup>
<Reference Include="EntityFramework, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089, processorArchitecture=MSIL">
<HintPath>..\packages\EntityFramework.6.1.0\lib\net45\EntityFramework.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="EntityFramework.SqlServer, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089, processorArchitecture=MSIL">
<HintPath>..\packages\EntityFramework.6.1.0\lib\net45\EntityFramework.SqlServer.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="Microsoft.AspNet.Identity.Core, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<HintPath>..\packages\Microsoft.AspNet.Identity.Core.2.2.1\lib\net45\Microsoft.AspNet.Identity.Core.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="Microsoft.AspNet.Identity.EntityFramework, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<HintPath>..\packages\Microsoft.AspNet.Identity.EntityFramework.2.2.1\lib\net45\Microsoft.AspNet.Identity.EntityFramework.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="MySql.Data, Version=6.9.9.0, Culture=neutral, PublicKeyToken=c5687fc88969c44d, processorArchitecture=MSIL">
<HintPath>..\packages\MySql.Data.6.9.9\lib\net45\MySql.Data.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="MySql.Data.Entity.EF6, Version=6.9.9.0, Culture=neutral, PublicKeyToken=c5687fc88969c44d, processorArchitecture=MSIL">
<HintPath>..\packages\MySql.Data.Entity.6.9.9\lib\net45\MySql.Data.Entity.EF6.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="System" />
<Reference Include="System.ComponentModel.DataAnnotations" />
<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.Net.Http" />
<Reference Include="System.Xaml">
<RequiredTargetFramework>4.0</RequiredTargetFramework>
</Reference>
</ItemGroup>
<ItemGroup>
<Compile Include="AppleJobsContext.cs" />
<Compile Include="Models\Articles\NewsCategory.cs" />
<Compile Include="Models\Articles\News.cs" />
<Compile Include="Models\Inventory\Accessories.cs" />
<Compile Include="Models\Common\Customer.cs" />
<Compile Include="Models\Inventory\Employee.cs" />
<Compile Include="Models\ModelsJobs\Model.cs" />
<Compile Include="Models\ModelsJobs\ModelJobPriceTemplate.cs" />
<Compile Include="Models\ModelsJobs\ModelJob.cs" />
<Compile Include="Models\ModelsJobs\ModelCategory.cs" />
<Compile Include="Models\Orders\Order.cs" />
<Compile Include="Models\Orders\OrderCategory.cs" />
<Compile Include="Models\Orders\OrderStatus.cs" />
<Compile Include="Models\TsModelAttribute.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="App.config" />
<None Include="packages.config" />
<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>

View File

@@ -1,60 +0,0 @@
using AppleJobs.Data.Models.Articles;
using AppleJobs.Data.Models.Common;
using AppleJobs.Data.Models.Inventory;
using AppleJobs.Data.Models.ModelsJobs;
using AppleJobs.Data.Models.Orders;
using Microsoft.AspNet.Identity.EntityFramework;
using MySql.Data.Entity;
using System.Data.Entity;
namespace AppleJobs.Data
{
[DbConfigurationType(typeof(MySqlEFConfiguration))]
public class AppleJobsContext : IdentityDbContext<ApplicationUser>
{
#region Common
public DbSet<Customer> Customers { get; set; }
#endregion
#region Orders
public DbSet<OrderCategory> OrderCategories { get; set; }
public DbSet<Order> Orders { get; set; }
public DbSet<OrderView> OrdersView { get; set; }
public DbSet<OrderStatus> OrderStatuses { get; set; }
#endregion
#region Inventory
public DbSet<Accessories> Accessories { get; set; }
public DbSet<Employee> Employees { get; set; }
#endregion
#region Prices
public DbSet<Model> Models { get; set; }
public DbSet<ModelJob> ModelJobs { get; set; }
public DbSet<ModelCategory> ModelCategories { get; set; }
public DbSet<ModelJobPriceTemplate> ModelJobPriceTemplates { get; set; }
#endregion
#region Articles / News
public DbSet<News> News { get; set; }
public DbSet<NewsCategory> NewsCategories { get; set; }
#endregion
public AppleJobsContext(string connection = "Default") : base(connection)
{
}
}
public class ApplicationUser : IdentityUser
{
}
}

View File

@@ -1,25 +0,0 @@
using System;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
namespace AppleJobs.Data.Models.Articles
{
[Table("ApjNews")]
public class News
{
[Key, DatabaseGenerated(DatabaseGeneratedOption.Identity)]
public int Id { get; set; }
public string Title { get; set; }
public string Content { get; set; }
public int OrderIndex { get; set; }
public int CharCount { get; set; }
public DateTime Date { get; set; }
public string State { get; set; }
public int CategoryId { get; set; }
[ForeignKey(nameof(CategoryId))]
public virtual NewsCategory NewsCategory { get; set; }
public string FilterString { get { return string.Join(",", Title, Content, OrderIndex, CharCount, Date, State, NewsCategory.CategoryDescription); } }
}
}

View File

@@ -1,15 +0,0 @@
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
namespace AppleJobs.Data.Models.Articles
{
[Table("ApjNewsCategory")]
public class NewsCategory
{
[Key, DatabaseGenerated(DatabaseGeneratedOption.Identity)]
public int Id { get; set; }
public string CategoryName { get; set; }
public string CategoryDescription { get; set; }
}
}

View File

@@ -1,15 +0,0 @@
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
namespace AppleJobs.Data.Models.Common
{
public class Customer
{
[Key, DatabaseGenerated(DatabaseGeneratedOption.Identity)]
public int Id { get; set; }
public string Name { get; set; }
public string Code { get; set; }
public string MainEmail { get; set; }
}
}

View File

@@ -1,12 +0,0 @@
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
namespace AppleJobs.Data.Models.Inventory
{
public class Accessories
{
[Key, DatabaseGenerated(DatabaseGeneratedOption.Identity)]
public int Id { get; set; }
public string Name { get; set; }
}
}

View File

@@ -1,14 +0,0 @@
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
namespace AppleJobs.Data.Models.Inventory
{
public class Employee
{
[Key, DatabaseGenerated(DatabaseGeneratedOption.Identity)]
public int Id { get; set; }
public string Name { get; set; }
public string ContactInfo { get; set; }
public string Email { get; set; }
}
}

View File

@@ -1,22 +0,0 @@
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
namespace AppleJobs.Data.Models.ModelsJobs
{
[TsModel]
public class Model
{
[Key, DatabaseGenerated(DatabaseGeneratedOption.Identity)]
public int Id { get; set; }
public string Name { get; set; }
public int ModelCategories_Id { get; set; }
[ForeignKey(nameof(ModelCategories_Id))]
public virtual ModelCategory ModelCategory { get; set; }
public virtual ICollection<ModelJob> ModelJobs { get; set; }
public string FilterString { get { return string.Format("{0},{1}", Name, ModelCategory?.FilterString); } }
}
}

View File

@@ -1,16 +0,0 @@
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
namespace AppleJobs.Data.Models.ModelsJobs
{
[TsModel]
public class ModelCategory
{
[Key, DatabaseGenerated(DatabaseGeneratedOption.Identity)]
public int Id { get; set; }
public string Name { get; set; }
public string FilterString { get { return string.Format("{0}", Name); } }
}
}

View File

@@ -1,20 +0,0 @@
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
namespace AppleJobs.Data.Models.ModelsJobs
{
[TsModel]
public class ModelJob
{
[Key, DatabaseGenerated(DatabaseGeneratedOption.Identity)]
public int Id { get; set; }
public string Name { get; set; }
public string Description { get; set; }
public int Models_Id { get; set; }
[ForeignKey(nameof(Models_Id))]
public virtual Model Model { get; set; }
public string FilterString { get { return string.Format("{0},{1},{2}", Name, Description, Model?.FilterString); } }
}
}

View File

@@ -1,24 +0,0 @@
using AppleJobs.Data.Models.Common;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
namespace AppleJobs.Data.Models.ModelsJobs
{
[TsModel]
public class ModelJobPriceTemplate
{
[Key, DatabaseGenerated(DatabaseGeneratedOption.Identity)]
public int Id { get; set; }
public double? Price { get; set; }
public bool IsPriceFrom { get; set; }
public int ModelJobs_Id { get; set; }
public int Customers_Id { get; set; }
[ForeignKey(nameof(Customers_Id))]
public virtual Customer Customer { get; set; }
[ForeignKey(nameof(ModelJobs_Id))]
public virtual ModelJob ModelJob { get; set; }
public string FilterString { get { return string.Format("{0},{1}", Price, ModelJob?.FilterString); } }
}
}

View File

@@ -1,102 +0,0 @@
using AppleJobs.Data.Models.Common;
using AppleJobs.Data.Models.Inventory;
using AppleJobs.Data.Models.ModelsJobs;
using System;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
namespace AppleJobs.Data.Models.Orders
{
[TsModel]
public class OrderView
{
[Key, DatabaseGenerated(DatabaseGeneratedOption.Identity)]
public int Id { get; set; }
public string Contact { get; set; }
public string Comment { get; set; }
public DateTime DateCreated { get; set; }
public DateTime? DateClosed { get; set; }
public DateTime DateUpdated { get; set; }
public string UserCreated { get; set; }
public bool? IsFast { get; set; }
public bool? IsDrive { get; set; }
public int? Price { get; set; }
public int OrderStatuses_Id { get; set; }
public int Models_Id { get; set; }
public int? ModelJobs_Id { get; set; }
public int Customers_Id { get; set; }
public int? Accessories_Id { get; set; }
public int? Employees_Id { get; set; }
public int OrderCategories_Id { get; set; }
//Joined
public string Status { get; set; }
public string Model { get; set; }
public string ModelJob { get; set; }
public string Customer { get; set; }
public string Accessories { get; set; }
public string Employee { get; set; }
public string OrderCategory { get; set; }
public string FilterString { get; set; }
}
[TsModel]
public class Order
{
public Order()
{
DateCreated = DateUpdated = DateTime.Now;
}
[Key, DatabaseGenerated(DatabaseGeneratedOption.Identity)]
public int Id { get; set; }
public string Contact { get; set; }
public string Comment { get; set; }
public DateTime DateCreated { get; set; }
public DateTime? DateClosed { get; set; }
public DateTime DateUpdated { get; set; }
public string UserCreated { get; set; }
public bool? IsFast { get; set; }
public bool? IsDrive { get; set; }
public int? Price { get; set; }
#region ForeignKeys
public int OrderStatuses_Id { get; set; }
public int Models_Id { get; set; }
public int? ModelJobs_Id { get; set; }
public int Customers_Id { get; set; }
public int? Accessories_Id { get; set; }
public int? Employees_Id { get; set; }
#endregion
[ForeignKey(nameof(OrderStatuses_Id))]
public virtual OrderStatus OrderStatus { get; set; }
[ForeignKey(nameof(Models_Id))]
public virtual Model Model { get; set; }
[ForeignKey(nameof(ModelJobs_Id))]
public virtual ModelJob JobModel { get; set; }
[ForeignKey(nameof(Customers_Id))]
public virtual Customer Customer { get; set; }
[ForeignKey(nameof(Accessories_Id))]
public virtual Accessories Accessories { get; set; }
[ForeignKey(nameof(Employees_Id))]
public virtual Employee Employee { get; set; }
public string FilterString
{
get
{
return string.Join(",", Contact, Comment, DateCreated, DateClosed, DateUpdated,
OrderStatus?.Name, Model.FilterString, JobModel.FilterString, Customer?.Name, Accessories?.Name, Employee?.Name, Price);
}
}
}
}

View File

@@ -1,15 +0,0 @@
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
namespace AppleJobs.Data.Models.Orders
{
[TsModel]
public class OrderCategory
{
[Key, DatabaseGenerated(DatabaseGeneratedOption.Identity)]
public int Id { get; set; }
public string Name { get; set; }
public string FullName { get; set; }
}
}

View File

@@ -1,14 +0,0 @@
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
namespace AppleJobs.Data.Models.Orders
{
[TsModel]
[Table("OrderStatuses")]
public class OrderStatus
{
[Key, DatabaseGenerated(DatabaseGeneratedOption.Identity)]
public int Id { get; set; }
public string Name { get; set; }
}
}

View File

@@ -1,8 +0,0 @@
using System;
namespace AppleJobs.Data.Models
{
public class TsModelAttribute : Attribute
{
}
}

View File

@@ -1,8 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="EntityFramework" version="6.1.0" targetFramework="net452" />
<package id="Microsoft.AspNet.Identity.Core" version="2.2.1" targetFramework="net452" />
<package id="Microsoft.AspNet.Identity.EntityFramework" version="2.2.1" targetFramework="net452" />
<package id="MySql.Data" version="6.9.9" targetFramework="net452" />
<package id="MySql.Data.Entity" version="6.9.9" targetFramework="net452" />
</packages>

48
BrightSharp.Extra.sln Normal file
View File

@@ -0,0 +1,48 @@
Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 14
VisualStudioVersion = 14.0.25420.1
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "BrightSharp.Toolkit.Extra", "BrightSharp.Toolkit.Extra\BrightSharp.Toolkit.Extra.csproj", "{556DD6D9-E5EE-4161-9653-5134FCE99946}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "BrightSharp.Toolkit.Extra.UiTests", "BrightSharp.Toolkit.Extra.UiTests\BrightSharp.Toolkit.Extra.UiTests.csproj", "{0A5F0006-5C82-459A-84B7-7524021F3616}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Debug|x64 = Debug|x64
Debug|x86 = Debug|x86
Release|Any CPU = Release|Any CPU
Release|x64 = Release|x64
Release|x86 = Release|x86
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{556DD6D9-E5EE-4161-9653-5134FCE99946}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{556DD6D9-E5EE-4161-9653-5134FCE99946}.Debug|Any CPU.Build.0 = Debug|Any CPU
{556DD6D9-E5EE-4161-9653-5134FCE99946}.Debug|x64.ActiveCfg = Debug|x64
{556DD6D9-E5EE-4161-9653-5134FCE99946}.Debug|x64.Build.0 = Debug|x64
{556DD6D9-E5EE-4161-9653-5134FCE99946}.Debug|x86.ActiveCfg = Debug|x86
{556DD6D9-E5EE-4161-9653-5134FCE99946}.Debug|x86.Build.0 = Debug|x86
{556DD6D9-E5EE-4161-9653-5134FCE99946}.Release|Any CPU.ActiveCfg = Release|Any CPU
{556DD6D9-E5EE-4161-9653-5134FCE99946}.Release|Any CPU.Build.0 = Release|Any CPU
{556DD6D9-E5EE-4161-9653-5134FCE99946}.Release|x64.ActiveCfg = Release|x64
{556DD6D9-E5EE-4161-9653-5134FCE99946}.Release|x64.Build.0 = Release|x64
{556DD6D9-E5EE-4161-9653-5134FCE99946}.Release|x86.ActiveCfg = Release|x86
{556DD6D9-E5EE-4161-9653-5134FCE99946}.Release|x86.Build.0 = Release|x86
{0A5F0006-5C82-459A-84B7-7524021F3616}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{0A5F0006-5C82-459A-84B7-7524021F3616}.Debug|Any CPU.Build.0 = Debug|Any CPU
{0A5F0006-5C82-459A-84B7-7524021F3616}.Debug|x64.ActiveCfg = Debug|x64
{0A5F0006-5C82-459A-84B7-7524021F3616}.Debug|x64.Build.0 = Debug|x64
{0A5F0006-5C82-459A-84B7-7524021F3616}.Debug|x86.ActiveCfg = Debug|x86
{0A5F0006-5C82-459A-84B7-7524021F3616}.Debug|x86.Build.0 = Debug|x86
{0A5F0006-5C82-459A-84B7-7524021F3616}.Release|Any CPU.ActiveCfg = Release|Any CPU
{0A5F0006-5C82-459A-84B7-7524021F3616}.Release|Any CPU.Build.0 = Release|Any CPU
{0A5F0006-5C82-459A-84B7-7524021F3616}.Release|x64.ActiveCfg = Release|Any CPU
{0A5F0006-5C82-459A-84B7-7524021F3616}.Release|x64.Build.0 = Release|Any CPU
{0A5F0006-5C82-459A-84B7-7524021F3616}.Release|x86.ActiveCfg = Release|Any CPU
{0A5F0006-5C82-459A-84B7-7524021F3616}.Release|x86.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
EndGlobal

View File

@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5.2" />
</startup>
</configuration>

View File

@@ -0,0 +1,9 @@
<Application x:Class="BrightSharp.Toolkit.Extra.UiTests.App"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="clr-namespace:BrightSharp.Toolkit.Extra.UiTests"
StartupUri="MainWindow.xaml">
<Application.Resources>
</Application.Resources>
</Application>

View File

@@ -6,13 +6,12 @@ using System.Linq;
using System.Threading.Tasks;
using System.Windows;
namespace JetFrames.AppleJobs.Editor
namespace BrightSharp.Toolkit.Extra.UiTests
{
/// <summary>
/// Interaction logic for App.xaml
/// </summary>
public partial class App : Application
{
public static ViewModelLocator Locator { get { return (ViewModelLocator)Current.TryFindResource("ViewModelLocator"); } }
}
}

View File

@@ -0,0 +1,164 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="14.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>{0A5F0006-5C82-459A-84B7-7524021F3616}</ProjectGuid>
<OutputType>WinExe</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>BrightSharp.Toolkit.Extra.UiTests</RootNamespace>
<AssemblyName>BrightSharp.Toolkit.Extra.UiTests</AssemblyName>
<TargetFrameworkVersion>v4.5.2</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<ProjectTypeGuids>{60dc8134-eba5-43b8-bcc9-bb4bc16c2548};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
<WarningLevel>4</WarningLevel>
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
<NuGetPackageImportStamp>
</NuGetPackageImportStamp>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x64'">
<DebugSymbols>true</DebugSymbols>
<OutputPath>..\build.extra\x64\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<DebugType>full</DebugType>
<PlatformTarget>x64</PlatformTarget>
<ErrorReport>prompt</ErrorReport>
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
<Prefer32Bit>true</Prefer32Bit>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x64'">
<OutputPath>..\build.extra\x64\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<Optimize>true</Optimize>
<DebugType>pdbonly</DebugType>
<PlatformTarget>x64</PlatformTarget>
<ErrorReport>prompt</ErrorReport>
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
<Prefer32Bit>true</Prefer32Bit>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x86'">
<DebugSymbols>true</DebugSymbols>
<OutputPath>..\build.extra\x86\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<DebugType>full</DebugType>
<PlatformTarget>x86</PlatformTarget>
<ErrorReport>prompt</ErrorReport>
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
<Prefer32Bit>true</Prefer32Bit>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x86'">
<OutputPath>..\build.extra\x86\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<Optimize>true</Optimize>
<DebugType>pdbonly</DebugType>
<PlatformTarget>x86</PlatformTarget>
<ErrorReport>prompt</ErrorReport>
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
<Prefer32Bit>true</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.Net.Http" />
<Reference Include="System.Xaml">
<RequiredTargetFramework>4.0</RequiredTargetFramework>
</Reference>
<Reference Include="WindowsBase" />
<Reference Include="PresentationCore" />
<Reference Include="PresentationFramework" />
</ItemGroup>
<ItemGroup>
<ApplicationDefinition Include="App.xaml">
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
</ApplicationDefinition>
<Page Include="MainWindow.xaml">
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
</Page>
<Compile Include="App.xaml.cs">
<DependentUpon>App.xaml</DependentUpon>
<SubType>Code</SubType>
</Compile>
<Compile Include="MainWindow.xaml.cs">
<DependentUpon>MainWindow.xaml</DependentUpon>
<SubType>Code</SubType>
</Compile>
</ItemGroup>
<ItemGroup>
<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="packages.config" />
<None Include="Properties\Settings.settings">
<Generator>SettingsSingleFileGenerator</Generator>
<LastGenOutput>Settings.Designer.cs</LastGenOutput>
</None>
<AppDesigner Include="Properties\" />
</ItemGroup>
<ItemGroup>
<None Include="App.config" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\BrightSharp.Toolkit.Extra\BrightSharp.Toolkit.Extra.csproj">
<Project>{556dd6d9-e5ee-4161-9653-5134fce99946}</Project>
<Name>BrightSharp.Toolkit.Extra</Name>
</ProjectReference>
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<Import Project="..\packages\cef.redist.x86.3.2785.1486\build\cef.redist.x86.targets" Condition="Exists('..\packages\cef.redist.x86.3.2785.1486\build\cef.redist.x86.targets')" />
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
<PropertyGroup>
<ErrorText>This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.</ErrorText>
</PropertyGroup>
<Error Condition="!Exists('..\packages\cef.redist.x86.3.2785.1486\build\cef.redist.x86.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\cef.redist.x86.3.2785.1486\build\cef.redist.x86.targets'))" />
<Error Condition="!Exists('..\packages\cef.redist.x64.3.2785.1486\build\cef.redist.x64.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\cef.redist.x64.3.2785.1486\build\cef.redist.x64.targets'))" />
</Target>
<Import Project="..\packages\cef.redist.x64.3.2785.1486\build\cef.redist.x64.targets" Condition="Exists('..\packages\cef.redist.x64.3.2785.1486\build\cef.redist.x64.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>

View File

@@ -0,0 +1,16 @@
<Window
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:local="clr-namespace:BrightSharp.Toolkit.Extra.UiTests"
xmlns:Extra="clr-namespace:BrightSharp.Toolkit.Extra;assembly=BrightSharp.Toolkit.Extra"
x:Class="BrightSharp.Toolkit.Extra.UiTests.MainWindow"
mc:Ignorable="d"
Title="MainWindow" Height="350" Width="525">
<Grid>
<Extra:CKEditor />
</Grid>
</Window>

View File

@@ -13,14 +13,14 @@ using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
namespace JetFrames.AppleJobs.Editor.Views
namespace BrightSharp.Toolkit.Extra.UiTests
{
/// <summary>
/// Interaction logic for NewsCategories.xaml
/// Interaction logic for MainWindow.xaml
/// </summary>
public partial class NewsCategories : UserControl
public partial class MainWindow : Window
{
public NewsCategories()
public MainWindow()
{
InitializeComponent();
}

View File

@@ -7,11 +7,11 @@ using System.Windows;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("JetFrames.AppleJobs.Editor")]
[assembly: AssemblyTitle("BrightSharp.Toolkit.Extra.UiTests")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("JetFrames.AppleJobs.Editor")]
[assembly: AssemblyProduct("BrightSharp.Toolkit.Extra.UiTests")]
[assembly: AssemblyCopyright("Copyright © 2017")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]

View File

@@ -8,7 +8,7 @@
// </auto-generated>
//------------------------------------------------------------------------------
namespace AppleJobs.Data.Properties
namespace BrightSharp.Toolkit.Extra.UiTests.Properties
{
@@ -44,7 +44,7 @@ namespace AppleJobs.Data.Properties
{
if ((resourceMan == null))
{
global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("AppleJobs.Data.Properties.Resources", typeof(Resources).Assembly);
global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("BrightSharp.Toolkit.Extra.UiTests.Properties.Resources", typeof(Resources).Assembly);
resourceMan = temp;
}
return resourceMan;

View File

@@ -8,7 +8,7 @@
// </auto-generated>
//------------------------------------------------------------------------------
namespace AppleJobs.Data.Properties
namespace BrightSharp.Toolkit.Extra.UiTests.Properties
{

View File

@@ -0,0 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="cef.redist.x64" version="3.2785.1486" targetFramework="net452" />
<package id="cef.redist.x86" version="3.2785.1486" targetFramework="net452" />
</packages>

View File

@@ -0,0 +1,163 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="14.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="..\packages\CefSharp.WinForms.53.0.1\build\CefSharp.WinForms.props" Condition="Exists('..\packages\CefSharp.WinForms.53.0.1\build\CefSharp.WinForms.props')" />
<Import Project="..\packages\CefSharp.Common.53.0.1\build\CefSharp.Common.props" Condition="Exists('..\packages\CefSharp.Common.53.0.1\build\CefSharp.Common.props')" />
<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>{556DD6D9-E5EE-4161-9653-5134FCE99946}</ProjectGuid>
<OutputType>library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>BrightSharp.Toolkit.Extra</RootNamespace>
<AssemblyName>BrightSharp.Toolkit.Extra</AssemblyName>
<TargetFrameworkVersion>v4.5.2</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<ProjectTypeGuids>{60dc8134-eba5-43b8-bcc9-bb4bc16c2548};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
<WarningLevel>4</WarningLevel>
<NuGetPackageImportStamp>
</NuGetPackageImportStamp>
<TargetFrameworkProfile />
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\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>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<Prefer32Bit>false</Prefer32Bit>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x64'">
<DebugSymbols>true</DebugSymbols>
<OutputPath>..\build.extra\x64\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<DebugType>full</DebugType>
<PlatformTarget>x64</PlatformTarget>
<ErrorReport>prompt</ErrorReport>
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
<TreatWarningsAsErrors>false</TreatWarningsAsErrors>
<Prefer32Bit>false</Prefer32Bit>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x64'">
<OutputPath>..\build.extra\x64\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<Optimize>true</Optimize>
<DebugType>pdbonly</DebugType>
<PlatformTarget>x64</PlatformTarget>
<ErrorReport>prompt</ErrorReport>
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
<Prefer32Bit>false</Prefer32Bit>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x86'">
<DebugSymbols>true</DebugSymbols>
<OutputPath>..\build.extra\x86\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<DebugType>full</DebugType>
<PlatformTarget>x86</PlatformTarget>
<ErrorReport>prompt</ErrorReport>
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
<AllowUnsafeBlocks>false</AllowUnsafeBlocks>
<Prefer32Bit>false</Prefer32Bit>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x86'">
<OutputPath>..\build.extra\x86\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<Optimize>true</Optimize>
<DebugType>pdbonly</DebugType>
<PlatformTarget>x86</PlatformTarget>
<ErrorReport>prompt</ErrorReport>
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
<Prefer32Bit>false</Prefer32Bit>
</PropertyGroup>
<ItemGroup>
<Reference Include="System" />
<Reference Include="System.Web.Extensions" />
<Reference Include="System.Windows.Forms" />
<Reference Include="System.Xml" />
<Reference Include="System.Core" />
<Reference Include="System.Xaml">
<RequiredTargetFramework>4.0</RequiredTargetFramework>
</Reference>
<Reference Include="UIAutomationProvider" />
<Reference Include="WindowsBase" />
<Reference Include="PresentationCore" />
<Reference Include="PresentationFramework" />
<Reference Include="WindowsFormsIntegration" />
</ItemGroup>
<ItemGroup>
<Page Include="CKEditor.xaml">
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
</Page>
<Compile Include="DesignTimeConfig.cs" />
<Compile Include="CKEditor.xaml.cs">
<DependentUpon>CKEditor.xaml</DependentUpon>
<SubType>Code</SubType>
</Compile>
</ItemGroup>
<ItemGroup>
<Compile Include="LocalSchemeHandlerFactory.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="packages.config">
<SubType>Designer</SubType>
</None>
<None Include="Properties\Settings.settings">
<Generator>SettingsSingleFileGenerator</Generator>
<LastGenOutput>Settings.Designer.cs</LastGenOutput>
</None>
<AppDesigner Include="Properties\" />
</ItemGroup>
<ItemGroup>
<None Include="Resources\HtmlEditor.html" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<Import Project="..\packages\cef.redist.x64.3.2785.1486\build\cef.redist.x64.targets" Condition="Exists('..\packages\cef.redist.x64.3.2785.1486\build\cef.redist.x64.targets')" />
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
<PropertyGroup>
<ErrorText>This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.</ErrorText>
</PropertyGroup>
<Error Condition="!Exists('..\packages\cef.redist.x64.3.2785.1486\build\cef.redist.x64.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\cef.redist.x64.3.2785.1486\build\cef.redist.x64.targets'))" />
<Error Condition="!Exists('..\packages\cef.redist.x86.3.2785.1486\build\cef.redist.x86.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\cef.redist.x86.3.2785.1486\build\cef.redist.x86.targets'))" />
<Error Condition="!Exists('..\packages\CefSharp.Common.53.0.1\build\CefSharp.Common.props')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\CefSharp.Common.53.0.1\build\CefSharp.Common.props'))" />
<Error Condition="!Exists('..\packages\CefSharp.Common.53.0.1\build\CefSharp.Common.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\CefSharp.Common.53.0.1\build\CefSharp.Common.targets'))" />
<Error Condition="!Exists('..\packages\CefSharp.WinForms.53.0.1\build\CefSharp.WinForms.props')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\CefSharp.WinForms.53.0.1\build\CefSharp.WinForms.props'))" />
<Error Condition="!Exists('..\packages\CefSharp.WinForms.53.0.1\build\CefSharp.WinForms.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\CefSharp.WinForms.53.0.1\build\CefSharp.WinForms.targets'))" />
</Target>
<Import Project="..\packages\cef.redist.x86.3.2785.1486\build\cef.redist.x86.targets" Condition="Exists('..\packages\cef.redist.x86.3.2785.1486\build\cef.redist.x86.targets')" />
<Import Project="..\packages\CefSharp.Common.53.0.1\build\CefSharp.Common.targets" Condition="Exists('..\packages\CefSharp.Common.53.0.1\build\CefSharp.Common.targets')" />
<Import Project="..\packages\CefSharp.WinForms.53.0.1\build\CefSharp.WinForms.targets" Condition="Exists('..\packages\CefSharp.WinForms.53.0.1\build\CefSharp.WinForms.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>

View File

@@ -0,0 +1,14 @@
<UserControl x:Class="BrightSharp.Toolkit.Extra.CKEditor"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
mc:Ignorable="d"
d:DesignHeight="300" d:DesignWidth="300">
<UserControl.Template>
<ControlTemplate TargetType="UserControl">
<WindowsFormsHost x:Name="PART_Host">
</WindowsFormsHost>
</ControlTemplate>
</UserControl.Template>
</UserControl>

View File

@@ -0,0 +1,282 @@
using System;
using System.ComponentModel;
using System.Diagnostics.CodeAnalysis;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Threading;
using System.Web.Script.Serialization;
using System.Windows;
using System.Windows.Forms.Integration;
using System.Windows.Threading;
using CefSharp;
using CefSharp.WinForms;
namespace BrightSharp.Toolkit.Extra
{
public partial class CKEditor
{
internal ChromiumWebBrowser Browser;
private CKEditorObjectForScripting _objectForScripting;
public static void InitializeCef(bool useCache = true, bool reinit = false)
{
Dispatcher.CurrentDispatcher.ShutdownStarted += (s, e) => Cef.Shutdown();
if (!reinit && Cef.IsInitialized) return;
CefSettings settings;
if (useCache)
{
var cacheDir = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData),
"cefCache");
Directory.CreateDirectory(cacheDir);
settings = new CefSettings
{
CachePath = cacheDir
};
}
else
{
settings = new CefSettings();
}
settings.RegisterScheme(new CefCustomScheme
{
SchemeName = "local",
SchemeHandlerFactory = new FolderSchemeHandlerFactory(Environment.CurrentDirectory)
});
Cef.Initialize(settings);
}
private static void InitializeDesignTimeDirectory()
{
if (DesignerProperties.GetIsInDesignMode(new DependencyObject()))
{
Environment.CurrentDirectory = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location);
var nugetPackages = DesignTimeConfig.GetNugetPackagesDirectory();
if (!Directory.Exists(nugetPackages)) return;
var prefix = IntPtr.Size == 4 ? "x86" : "x64";
var allDirectoriesToCopy = Directory.GetDirectories(nugetPackages, "cef.redist.*")
.Union(Directory.GetDirectories(nugetPackages, "CefSharp.*"))
.SelectMany(d => Directory.GetDirectories(d, prefix, SearchOption.AllDirectories));
foreach (var dirForCopy in allDirectoriesToCopy)
{
foreach (var file in Directory.GetFiles(dirForCopy))
{
try { File.Copy(file, Path.Combine(Environment.CurrentDirectory, Path.GetFileName(file)), false); }
catch (Exception) { }
}
foreach (var file in Directory.GetFiles(Directory.GetParent(dirForCopy).FullName))
{
try { File.Copy(file, Path.Combine(Environment.CurrentDirectory, Path.GetFileName(file)), false); }
catch (Exception) { }
}
}
}
}
static CKEditor()
{
InitializeDesignTimeDirectory();
if (!File.Exists("CefSharp.Core.dll"))
return;
InitializeCef();
}
public CKEditor()
{
InitializeComponent();
}
public override void OnApplyTemplate()
{
if (!File.Exists("CefSharp.dll"))
return;
var host = (WindowsFormsHost)Template.FindName("PART_Host", this);
host.Child = Browser = new ChromiumWebBrowser("about:blank");
_objectForScripting = new CKEditorObjectForScripting(this);
Browser.KeyboardHandler = new FixKeyboardHandler();
Browser.IsBrowserInitializedChanged += (s, e) =>
{
if (e.IsBrowserInitialized)
RefreshState();
};
base.OnApplyTemplate();
}
public void RefreshState()
{
if (Browser != null && Browser.IsBrowserInitialized)
{
Dispatcher.BeginInvoke(DispatcherPriority.Normal, new Action(() =>
{
var docContent = BuildDocContent();
Browser.LoadString(docContent, "about:blank");
}));
UpdateDevToolsState();
}
}
protected override void OnContentChanged(object oldContent, object newContent)
{
if (Browser != null && _objectForScripting != null && (string)newContent != _objectForScripting.NewData)
{
//This is not from js
Browser.EvaluateScriptAsync($"setData(`{newContent}`)").Wait(TimeSpan.FromSeconds(2));
}
base.OnContentChanged(oldContent, newContent);
}
public string PackageType
{
get { return (string)GetValue(PackageTypeProperty); }
set { SetValue(PackageTypeProperty, value); }
}
public static readonly DependencyProperty PackageTypeProperty =
DependencyProperty.Register("PackageType", typeof(string), typeof(CKEditor), new PropertyMetadata("standard", UpdatePackageType));
private static void UpdatePackageType(DependencyObject d, DependencyPropertyChangedEventArgs e)
{
var editor = (CKEditor)d;
editor.RefreshState();
}
public bool ShowDevTools
{
get { return (bool)GetValue(ShowDevToolsProperty); }
set { SetValue(ShowDevToolsProperty, value); }
}
public static readonly DependencyProperty ShowDevToolsProperty =
DependencyProperty.Register("ShowDevTools", typeof(bool), typeof(CKEditor), new PropertyMetadata(false, ShowDevToolsChanged));
private static void ShowDevToolsChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
{
var editor = (CKEditor)d;
editor.UpdateDevToolsState();
}
private void UpdateDevToolsState()
{
if (Browser != null && Browser.IsBrowserInitialized)
{
Dispatcher.BeginInvoke(DispatcherPriority.Normal, new Action(() =>
{
if (ShowDevTools)
Browser.ShowDevTools();
else
Browser.CloseDevTools();
}));
}
}
private string BuildDocContent()
{
var docContent = Properties.Resources.HtmlEditor;
if (EditorConfiguration != null)
{
EditorConfiguration.Optimize(PackageType);
docContent = docContent.Replace("$$CONFIG",
new JavaScriptSerializer().Serialize(EditorConfiguration));
docContent = docContent.Replace("$$PACKAGE", PackageType);
}
docContent = docContent.Replace("$$CONTENT", (Content ?? "").ToString());
return docContent;
}
public CKEditorConfig EditorConfiguration
{
get { return (CKEditorConfig)GetValue(EditorConfigurationProperty); }
set { SetValue(EditorConfigurationProperty, value); }
}
public static readonly DependencyProperty EditorConfigurationProperty =
DependencyProperty.Register("EditorConfiguration", typeof(CKEditorConfig), typeof(CKEditor), new PropertyMetadata(new CKEditorConfig()));
}
[SuppressMessage("ReSharper", "InconsistentNaming")]
public class CKEditorConfig
{
public string[] contentsCss { get; set; }
public string language { get; set; } = Thread.CurrentThread.CurrentUICulture.Name;
public string removeButtons { get; set; } =
"Save,Print,Preview,Maximize,ShowBlocks,Paste,PasteText,PasteFromWord";
public string extraAllowedContent { get; set; } = "span;ul;li;table;td;style;*[id];*(*);*{*}";
public string removePlugins { get; set; } = "resize";
public void Optimize(string packageType)
{
if (string.Equals("basic", packageType, StringComparison.InvariantCultureIgnoreCase))
{
//TODO Basic configuration has many problems.
//TODO Need think do we need it, or can we use Standard package as Basic to emulate Basic (from CKE) ?
}
}
}
internal class CKEditorObjectForScripting
{
private CKEditor _editor;
internal string NewData;
public CKEditorObjectForScripting(CKEditor editor)
{
_editor = editor;
_editor.Browser.RegisterJsObject("$$OBJ", this);
}
[SuppressMessage("ReSharper", "UnusedMember.Global")]
public void SetupContent(string newData)
{
NewData = newData;
_editor.Dispatcher.BeginInvoke(DispatcherPriority.Normal, new Action(() => _editor.Content = NewData));
}
}
public class CKEditorDesignTimeSettings
{
public static string DesignTimeCefBinariesDirectory { get; set; }
}
class FixKeyboardHandler : IKeyboardHandler
{
public bool OnPreKeyEvent(IWebBrowser browserControl, IBrowser browser, KeyType type, int windowsKeyCode, int nativeKeyCode,
CefEventFlags modifiers, bool isSystemKey, ref bool isKeyboardShortcut)
{
//F10, Alt
if (windowsKeyCode == 0x79 || windowsKeyCode == 0x12)
{
return true;
}
return false;
}
public bool OnKeyEvent(IWebBrowser browserControl, IBrowser browser, KeyType type, int windowsKeyCode, int nativeKeyCode,
CefEventFlags modifiers, bool isSystemKey)
{
if (windowsKeyCode == 0x79 || windowsKeyCode == 0x12)
{
return true;
}
return false;
}
}
}

View File

@@ -0,0 +1,31 @@
using System.IO;
using Microsoft.Win32;
namespace BrightSharp.Toolkit.Extra
{
public static class DesignTimeConfig
{
public static void SetNugetPackagesDirectory(string nugetDir)
{
if (Directory.Exists(nugetDir))
{
Registry.CurrentUser.CreateSubKey(@"SOFTWARE\Brightsharp").SetValue("NUGET_PACKAGES", nugetDir);
}
}
public static void DesignTimeUnRegisterNugetPackages()
{
Registry.CurrentUser.CreateSubKey(@"SOFTWARE\Brightsharp").SetValue("NUGET_PACKAGES", null);
}
internal static string GetNugetPackagesDirectory()
{
var regKey = Registry.CurrentUser.CreateSubKey(@"SOFTWARE\Brightsharp");
if (regKey != null)
{
var regValue = regKey.GetValue("NUGET_PACKAGES");
return (regValue ?? string.Empty).ToString();
}
return null;
}
}
}

View File

@@ -0,0 +1,73 @@
using CefSharp;
using System;
using System.IO;
using System.Net;
namespace BrightSharp.Toolkit.Extra
{
public class FolderSchemeHandlerFactory : ISchemeHandlerFactory
{
private string rootFolder;
private string defaultPage;
private string schemeName;
private string hostName;
public FolderSchemeHandlerFactory(string rootFolder, string schemeName = null, string hostName = null, string defaultPage = "index.html")
{
this.rootFolder = Path.GetFullPath(rootFolder);
this.defaultPage = defaultPage;
this.schemeName = schemeName;
this.hostName = hostName;
if (!Directory.Exists(this.rootFolder))
{
throw new DirectoryNotFoundException(this.rootFolder);
}
}
IResourceHandler ISchemeHandlerFactory.Create(IBrowser browser, IFrame frame, string schemeName, IRequest request)
{
if (this.schemeName != null && !schemeName.Equals(this.schemeName, StringComparison.OrdinalIgnoreCase))
{
var invalidSchemeName = ResourceHandler.FromString(string.Format("SchemeName {0} does not match the expected SchemeName of {1}.", schemeName, this.schemeName));
invalidSchemeName.StatusCode = (int)HttpStatusCode.NotFound;
return invalidSchemeName;
}
var uri = new Uri(request.Url);
if (hostName != null && !uri.Host.Equals(hostName, StringComparison.OrdinalIgnoreCase))
{
var invalidHostName = ResourceHandler.FromString(string.Format("HostName {0} does not match the expected HostName of {1}.", uri.Host, hostName));
invalidHostName.StatusCode = (int)HttpStatusCode.NotFound;
return invalidHostName;
}
//Get the absolute path and remove the leading slash
var asbolutePath = uri.Host + uri.AbsolutePath;
if (string.IsNullOrEmpty(asbolutePath))
{
asbolutePath = defaultPage;
}
var filePath = Path.GetFullPath(Path.Combine(rootFolder, asbolutePath));
//Check the file requested is within the specified path and that the file exists
if (filePath.StartsWith(rootFolder, StringComparison.OrdinalIgnoreCase) && File.Exists(filePath))
{
var fileExtension = Path.GetExtension(filePath);
var mimeType = ResourceHandler.GetMimeType(fileExtension);
return ResourceHandler.FromFilePath(filePath, mimeType);
}
var fileNotFoundResourceHandler = ResourceHandler.FromString("File Not Found - " + filePath);
fileNotFoundResourceHandler.StatusCode = (int)HttpStatusCode.NotFound;
return fileNotFoundResourceHandler;
}
}
}

View File

@@ -7,12 +7,12 @@ using System.Windows;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("AppleJobs.Data")]
[assembly: AssemblyTitle("BrightSharp.Toolkit.Extra")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("AppleJobs.Data")]
[assembly: AssemblyCopyright("Copyright © 2017")]
[assembly: AssemblyProduct("BrightSharp.Toolkit.Extra")]
[assembly: AssemblyCopyright("Copyright © 2016")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
@@ -31,6 +31,15 @@ using System.Windows;
//[assembly: NeutralResourcesLanguage("en-US", UltimateResourceFallbackLocation.Satellite)]
[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)
)]
// Version information for an assembly consists of the following four values:
//

View File

@@ -8,8 +8,8 @@
// </auto-generated>
//------------------------------------------------------------------------------
namespace JetFrames.AppleJobs.Editor.Properties
{
namespace BrightSharp.Toolkit.Extra.Properties {
using System;
/// <summary>
@@ -22,29 +22,24 @@ namespace JetFrames.AppleJobs.Editor.Properties
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
internal class Resources
{
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()
{
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 ((resourceMan == null))
{
global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("JetFrames.AppleJobs.Editor.Properties.Resources", typeof(Resources).Assembly);
internal static global::System.Resources.ResourceManager ResourceManager {
get {
if (object.ReferenceEquals(resourceMan, null)) {
global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("BrightSharp.Toolkit.Extra.Properties.Resources", typeof(Resources).Assembly);
resourceMan = temp;
}
return resourceMan;
@@ -56,16 +51,38 @@ namespace JetFrames.AppleJobs.Editor.Properties
/// 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
{
internal static global::System.Globalization.CultureInfo Culture {
get {
return resourceCulture;
}
set
{
set {
resourceCulture = value;
}
}
/// <summary>
/// Looks up a localized string similar to &lt;html xmlns=&quot;http://www.w3.org/1999/xhtml&quot;&gt;
///&lt;head&gt;
/// &lt;meta charset=&quot;utf-8&quot; /&gt;
/// &lt;script src=&quot;https://cdn.ckeditor.com/4.6.0/standard/ckeditor.js&quot;&gt;&lt;/script&gt;
///&lt;/head&gt;
///&lt;body&gt;
/// &lt;div id=&quot;editor&quot;&gt;
/// $$CONTENT
/// &lt;/div&gt;
/// &lt;script&gt;
/// CKEDITOR.editorConfig = function (config) {
/// config.scayt_autoStartup = false;
/// config.removePlugins = &apos;resize,scayt&apos;;
/// config.disableNativeSpellChecker = false;
/// }
/// CKEDITOR.on(&apos;instanceReady&apos;,
/// [rest of string was truncated]&quot;;.
/// </summary>
internal static string HtmlEditor {
get {
return ResourceManager.GetString("HtmlEditor", resourceCulture);
}
}
}
}

View File

@@ -46,7 +46,7 @@
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Serialization.Formatters.Binary.BinaryFormatter
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
@@ -60,6 +60,7 @@
: 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:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
@@ -68,9 +69,10 @@
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" />
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
@@ -85,9 +87,10 @@
<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="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
@@ -109,9 +112,13 @@
<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>
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.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>
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<assembly alias="System.Windows.Forms" name="System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
<data name="HtmlEditor" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\resources\htmleditor.html;System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089;utf-8</value>
</data>
</root>

View File

@@ -8,12 +8,12 @@
// </auto-generated>
//------------------------------------------------------------------------------
namespace JetFrames.AppleJobs.Editor.Properties {
namespace BrightSharp.Toolkit.Extra.Properties {
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "14.0.0.0")]
public sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase {
internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase {
private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));

View File

@@ -0,0 +1,7 @@
<?xml version='1.0' encoding='utf-8'?>
<SettingsFile xmlns="uri:settings" CurrentProfile="(Default)">
<Profiles>
<Profile Name="(Default)" />
</Profiles>
<Settings />
</SettingsFile>

View File

@@ -0,0 +1,33 @@
<html>
<head>
<meta charset="utf-8" />
<script src="https://cdn.ckeditor.com/4.6.0/$$PACKAGE/ckeditor.js"></script>
</head>
<body>
<div id="editor">$$CONTENT</div>
<script>
(function (ckeditor, config) {
var lockChanges = false;
// Add override CSS styles for inside editable contents area.
ckeditor.addCss('.cke_editable { font-size: 14px; } @media screen and (max-device-width: 767px) and (-webkit-min-device-pixel-ratio:0) { .cke_editable { font-size: 16px !important; } }');
ckeditor.on('instanceReady',
function (evt) {
evt.editor.execCommand('maximize');
});
var editor = ckeditor.replace('editor', config);
editor.on("change",
function () {
if (!lockChanges)
window.$$OBJ.setupContent(editor.getData());
});
window.setData = function (newData) {
lockChanges = true;
editor.setData(newData);
lockChanges = false;
};
})(CKEDITOR, $$CONFIG);
</script>
</body>
</html>

View File

@@ -0,0 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="cef.redist.x64" version="3.2785.1486" targetFramework="net452" />
<package id="cef.redist.x86" version="3.2785.1486" targetFramework="net452" />
<package id="CefSharp.Common" version="53.0.1" targetFramework="net452" />
<package id="CefSharp.WinForms" version="53.0.1" targetFramework="net452" />
</packages>

View File

@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8" ?>
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5.2" />
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5"/>
</startup>
</configuration>

View File

@@ -9,11 +9,12 @@
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>BrightSharp.Ui.Tests</RootNamespace>
<AssemblyName>BrightSharp.Ui.Tests</AssemblyName>
<TargetFrameworkVersion>v4.5.2</TargetFrameworkVersion>
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<ProjectTypeGuids>{60dc8134-eba5-43b8-bcc9-bb4bc16c2548};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
<WarningLevel>4</WarningLevel>
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
<TargetFrameworkProfile />
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
@@ -24,6 +25,7 @@
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<Prefer32Bit>false</Prefer32Bit>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
@@ -33,6 +35,7 @@
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<Prefer32Bit>false</Prefer32Bit>
</PropertyGroup>
<ItemGroup>
<Reference Include="System" />
@@ -55,6 +58,10 @@
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
</ApplicationDefinition>
<Page Include="CustomWindow.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="MainWindow.xaml">
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
@@ -63,6 +70,9 @@
<DependentUpon>App.xaml</DependentUpon>
<SubType>Code</SubType>
</Compile>
<Compile Include="CustomWindow.xaml.cs">
<DependentUpon>CustomWindow.xaml</DependentUpon>
</Compile>
<Compile Include="ListViewItemModel.cs" />
<Compile Include="MainWindow.xaml.cs">
<DependentUpon>MainWindow.xaml</DependentUpon>

View File

@@ -0,0 +1,20 @@
<Window x:Class="BrightSharp.Ui.Tests.CustomWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:bs="http://schemas.brightsharp.com/developer"
xmlns:local="clr-namespace:BrightSharp.Ui.Tests"
mc:Ignorable="d" ResizeMode="CanResizeWithGrip"
Height="640" Width="1000" Style="{DynamicResource TestWindowStyle}">
<bs:MarkupExtensionProperties.Header>
<Grid>
<Label>Custom WINDOW (In Progress)</Label>
</Grid>
</bs:MarkupExtensionProperties.Header>
<Window.Resources>
</Window.Resources>
<Label>
TEST (Dev) WINDOW STYLE (CONTENT)
</Label>
</Window>

View File

@@ -10,17 +10,18 @@ using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
namespace JetFrames.AppleJobs.Editor.Views
namespace BrightSharp.Ui.Tests
{
public partial class Accessories : UserControl
/// <summary>
/// Interaction logic for CustomWindow.xaml
/// </summary>
public partial class CustomWindow : Window
{
public Accessories()
public CustomWindow()
{
InitializeComponent();
EditorViewModel.InitGrid(dg);
}
}

View File

@@ -39,10 +39,10 @@ namespace BrightSharp.Ui.Tests
set { _companyName = value; RaisePropertyChanged(nameof(CompanyName)); }
}
public string ContactName
public string ContactNameCN
{
get { return _contactName; }
set { _contactName = value; RaisePropertyChanged(nameof(ContactName)); }
set { _contactName = value; RaisePropertyChanged(nameof(ContactNameCN)); }
}
public string ContactTitle

View File

@@ -4,77 +4,83 @@
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:local="clr-namespace:BrightSharp.Ui.Tests"
xmlns:viewModel="clr-namespace:BrightSharp.Ui.Tests"
xmlns:ex="clr-namespace:BrightSharp.Extensions;assembly=BrightSharp"
xmlns:BrightSharp="clr-namespace:BrightSharp;assembly=BrightSharp" x:Class="BrightSharp.Ui.Tests.MainWindow"
Style="{DynamicResource TestWindowStyle}"
ResizeMode="CanResizeWithGrip"
xmlns:ex="http://schemas.brightsharp.com/developer"
xmlns:bsDiag="http://schemas.brightsharp.com/diagrams"
x:Class="BrightSharp.Ui.Tests.MainWindow"
mc:Ignorable="d" Background="{DynamicResource WindowBackgroundBrush}"
Title="BrightSharp.Ui.Tests" Height="600" Width="1200">
ex:MarkupExtensionProperties.HeaderHorizontalAlignment="Center"
Title="BrightSharp.Ui.Tests" Height="750" Width="1600">
<Window.Resources>
<ex:StringHelpConverter x:Key="StringHelpConverter" />
<x:Array x:Key="coll" Type="{x:Type viewModel:CustomerViewModel}">
<viewModel:CustomerViewModel CustomerID="ALFKI" CompanyName="Alfreds Futterkiste" ContactName="Maria Anders" ContactTitle="Sales Representative" Address="Obere Str. 57" City="Berlin" PostalCode="12209" Country="Germany" Phone="030-0074321" Fax="030-0076545" />
<viewModel:CustomerViewModel CustomerID="ANATR" CompanyName="Ana Trujillo Emparedados y helados" ContactName="Ana Trujillo" ContactTitle="Owner" Address="Avda. de la Constitución 2222" City="México D.F." PostalCode="05021" Country="Mexico" Phone="(5) 555-4729" Fax="(5) 555-3745" />
<viewModel:CustomerViewModel CustomerID="ANTON" CompanyName="Antonio Moreno Taquería" ContactName="Antonio Moreno" ContactTitle="Owner" Address="Mataderos 2312" City="México D.F." PostalCode="05023" Country="Mexico" Phone="(5) 555-3932" />
<viewModel:CustomerViewModel CustomerID="AROUT" CompanyName="Around the Horn" ContactName="Thomas Hardy" ContactTitle="Sales Representative" Address="120 Hanover Sq." City="London" PostalCode="WA1 1DP" Country="UK" Phone="(171) 555-7788" Fax="(171) 555-6750" />
<viewModel:CustomerViewModel CustomerID="BERGS" CompanyName="Berglunds snabbköp" ContactName="Christina Berglund" ContactTitle="Order Administrator" Address="Berguvsvägen 8" City="Luleå" PostalCode="S-958 22" Country="Sweden" Phone="0921-12 34 65" Fax="0921-12 34 67" />
<viewModel:CustomerViewModel CustomerID="BLAUS" CompanyName="Blauer See Delikatessen" ContactName="Hanna Moos" ContactTitle="Sales Representative" Address="Forsterstr. 57" City="Mannheim" PostalCode="68306" Country="Germany" Phone="0621-08460" Fax="0621-08924" />
<viewModel:CustomerViewModel CustomerID="BLONP" CompanyName="Blondesddsl père et fils" ContactName="Frédérique Citeaux" ContactTitle="Marketing Manager" Address="24, place Kléber" City="Strasbourg" PostalCode="67000" Country="France" Phone="88.60.15.31" Fax="88.60.15.32" />
<viewModel:CustomerViewModel CustomerID="BOLID" CompanyName="Bólido Comidas preparadas" ContactName="Martín Sommer" ContactTitle="Owner" Address="C/ Araquil, 67" City="Madrid" PostalCode="28023" Country="Spain" Phone="(91) 555 22 82" Fax="(91) 555 91 99" />
<viewModel:CustomerViewModel CustomerID="ALFKI" CompanyName="Alfreds Futterkiste" ContactNameCN="Maria Anders" ContactTitle="Sales Representative" Address="Obere Str. 57" City="Berlin" PostalCode="12209" Country="Germany" Phone="030-0074321" Fax="030-0076545" />
<viewModel:CustomerViewModel CustomerID="ANATR" CompanyName="Ana Trujillo Emparedados y helados" ContactNameCN="Ana Trujillo" ContactTitle="Owner" Address="Avda. de la Constitución 2222" City="México D.F." PostalCode="05021" Country="Mexico" Phone="(5) 555-4729" Fax="(5) 555-3745" />
<viewModel:CustomerViewModel CustomerID="ANTON" CompanyName="Antonio Moreno Taquería" ContactNameCN="Antonio Moreno" ContactTitle="Owner" Address="Mataderos 2312" City="México D.F." PostalCode="05023" Country="Mexico" Phone="(5) 555-3932" />
<viewModel:CustomerViewModel CustomerID="AROUT" CompanyName="Around the Horn" ContactNameCN="Thomas Hardy" ContactTitle="Sales Representative" Address="120 Hanover Sq." City="London" PostalCode="WA1 1DP" Country="UK" Phone="(171) 555-7788" Fax="(171) 555-6750" />
<viewModel:CustomerViewModel CustomerID="BERGS" CompanyName="Berglunds snabbköp" ContactNameCN="Christina Berglund" ContactTitle="Order Administrator" Address="Berguvsvägen 8" City="Luleå" PostalCode="S-958 22" Country="Sweden" Phone="0921-12 34 65" Fax="0921-12 34 67" />
<viewModel:CustomerViewModel CustomerID="BLAUS" CompanyName="Blauer See Delikatessen" ContactNameCN="Hanna Moos" ContactTitle="Sales Representative" Address="Forsterstr. 57" City="Mannheim" PostalCode="68306" Country="Germany" Phone="0621-08460" Fax="0621-08924" />
<viewModel:CustomerViewModel CustomerID="BLONP" CompanyName="Blondesddsl père et fils" ContactNameCN="Frédérique Citeaux" ContactTitle="Marketing Manager" Address="24, place Kléber" City="Strasbourg" PostalCode="67000" Country="France" Phone="88.60.15.31" Fax="88.60.15.32" />
<viewModel:CustomerViewModel CustomerID="BOLID" CompanyName="Bólido Comidas preparadas" ContactNameCN="Martín Sommer" ContactTitle="Owner" Address="C/ Araquil, 67" City="Madrid" PostalCode="28023" Country="Spain" Phone="(91) 555 22 82" Fax="(91) 555 91 99" />
</x:Array>
<CollectionViewSource Source="{StaticResource coll}" x:Key="coll1" />
<CollectionViewSource Source="{StaticResource coll}" x:Key="coll2" />
</Window.Resources>
<Grid>
<BrightSharp:ZoomControl x:Name="zc" Margin="10" UseAnimation="True">
<Grid Margin="2" ClipToBounds="True">
<bsDiag:ZoomControl x:Name="zc" UseAnimation="True" ClipToBounds="False">
<ContentControl Style="{StaticResource DesignerItemStyle}"
Canvas.Left="10" Canvas.Top="20" Width="300" Height="473">
Canvas.Left="10" Canvas.Top="20" Width="330">
<GroupBox Header="Common">
<Grid>
<Button IsDefault="True" Content="Change Theme" Click="Button_Click" HorizontalAlignment="Left" Width="108" Height="32" VerticalAlignment="Top" Margin="10,10,0,0"/>
<ToggleButton Content="Toggle" HorizontalAlignment="Left" Width="108" Height="32" VerticalAlignment="Top" Margin="10,47,0,0"/>
<CheckBox Margin="10,84,0,0" VerticalAlignment="Top" HorizontalAlignment="Left">CheckBox</CheckBox>
<CheckBox IsThreeState="True" ex:MarkupExtensionProperties.Docking="Right" Margin="10,105,0,0" VerticalAlignment="Top" HorizontalAlignment="Left">CheckBox Right Allign</CheckBox>
<CheckBox HorizontalContentAlignment="Center" IsThreeState="True" ex:MarkupExtensionProperties.Docking="Top" Margin="151,35,0,0" VerticalAlignment="Top" HorizontalAlignment="Left" Width="137">CheckBox Top Allign</CheckBox>
<RadioButton IsChecked="True" Margin="10,130,0,0" VerticalAlignment="Top" HorizontalAlignment="Left">RadioButton</RadioButton>
<RadioButton Margin="10,151,0,0" VerticalAlignment="Top" HorizontalAlignment="Left">RadioButton</RadioButton>
<CheckBox Margin="10,84,0,0" VerticalAlignment="Top" HorizontalAlignment="Left" Content="CheckBox"/>
<CheckBox IsThreeState="True" ex:MarkupExtensionProperties.Docking="Right" Margin="10,105,0,0" VerticalAlignment="Top" HorizontalAlignment="Left" Content="CheckBox Right Allign"/>
<CheckBox HorizontalContentAlignment="Center" IsThreeState="True" ex:MarkupExtensionProperties.Docking="Top" Margin="151,35,0,0" VerticalAlignment="Top" HorizontalAlignment="Left" Width="137" Content="CheckBox Top Allign"/>
<RadioButton IsChecked="True" Margin="10,130,0,0" VerticalAlignment="Top" HorizontalAlignment="Left" Content="RadioButton"/>
<RadioButton Margin="10,151,0,0" VerticalAlignment="Top" HorizontalAlignment="Left" Content="RadioButton"/>
<TextBox x:Name="tb" Canvas.Left="10" Canvas.Top="269" Margin="151,10,10,0" VerticalAlignment="Top" />
<TabControl Margin="151,72,10,0" Height="122" VerticalAlignment="Top">
<TabControl BorderThickness="1" Margin="151,72,10,0" Height="122" VerticalAlignment="Top">
<TabItem Header="Tab1" />
<TabItem Header="Tab2" />
<TabItem Header="Tab3" />
</TabControl>
<CheckBox HorizontalAlignment="Left" Style="{StaticResource SwitchCheckBoxStyle}" Margin="19,0,0,10" Content="SwitchCheckBoxStyle" Width="250" RenderTransformOrigin="0.5,0.5" Height="27" VerticalAlignment="Bottom" />
<Calendar Margin="10,199,10,0" VerticalAlignment="Top">
<CheckBox HorizontalAlignment="Left" Style="{StaticResource SwitchCheckBoxStyle}" VerticalAlignment="Top" Margin="37,204,0,0" Content="SwitchCheckBoxStyle" Width="213" RenderTransformOrigin="0.5,0.5" Height="Auto" />
<TextBox Margin="35,236,0,0" VerticalAlignment="Top" HorizontalAlignment="Left" Width="246">
<ex:MarkupExtensionProperties.LeadingElement>L.El.</ex:MarkupExtensionProperties.LeadingElement>
<ex:MarkupExtensionProperties.TrailingElement>T.El.</ex:MarkupExtensionProperties.TrailingElement>
<ex:MarkupExtensionProperties.Header>Watermark</ex:MarkupExtensionProperties.Header>
</TextBox>
<Button Content="Test Custom Window" Margin="93,266,0,0" HorizontalAlignment="Left" Width="134" Height="25" VerticalAlignment="Top" Click="Button_Click_ShowCustomWindow"></Button>
<Calendar Margin="10,295,10,0" VerticalAlignment="Top" Loaded="Calendar_Loaded">
<ex:MarkupExtensionProperties.TrailingElement>
<TextBlock HorizontalAlignment="Center" Foreground="DarkRed">Trailing</TextBlock>
<TextBlock HorizontalAlignment="Center" Foreground="DarkRed"><Run Text="Trailing Region"/></TextBlock>
</ex:MarkupExtensionProperties.TrailingElement>
<ex:MarkupExtensionProperties.LeadingElement>
<TextBlock HorizontalAlignment="Center" Foreground="DarkBlue">Leading</TextBlock>
<TextBlock HorizontalAlignment="Center" Foreground="DarkBlue"><Run Text="Leading Region"/></TextBlock>
</ex:MarkupExtensionProperties.LeadingElement>
</Calendar>
<ComboBox IsEditable="True" Margin="10,172,0,0" VerticalAlignment="Top" HorizontalAlignment="Left" SelectedIndex="0" Width="136">
<ComboBoxItem>Item 1</ComboBoxItem>
<ComboBoxItem>Item 2</ComboBoxItem>
<ComboBoxItem>Item 3</ComboBoxItem>
<ComboBoxItem Content="Item 1"/>
<ComboBoxItem Content="Item 2"/>
<ComboBoxItem Content="Item 3"/>
<Separator />
<ComboBoxItem>Item 4</ComboBoxItem>
<ComboBoxItem>Item 5</ComboBoxItem>
<ComboBoxItem Content="Item 4"/>
<ComboBoxItem Content="Item 5"/>
</ComboBox>
</Grid>
</GroupBox>
</ContentControl>
<ContentControl Style="{StaticResource DesignerItemStyle}"
Height="474" Width="405"
Height="474" Width="442"
Padding="2,27,2,2"
Canvas.Left="350"
Canvas.Top="20">
<GroupBox Margin="0,-25,0,0" Style="{StaticResource ExpandrStyleGroupBox}" >
<GroupBox.Header>
<Label>Collections</Label>
<Label Content="Collections"/>
</GroupBox.Header>
<Grid x:Name="innerCanvas" Background="Transparent" ClipToBounds="True" >
<Menu VerticalAlignment="Top">
@@ -83,15 +89,17 @@
<MenuItem Header="Open..."/>
<MenuItem Header="Save" />
<MenuItem Header="Save as..."/>
<Separator />
<MenuItem Command="ApplicationCommands.Close" />
</MenuItem>
<MenuItem Header="Edit">
<MenuItem Header="Copy" />
<MenuItem Header="Paste" />
<MenuItem Header="Cut" />
<MenuItem Command="ApplicationCommands.Copy" />
<MenuItem Command="ApplicationCommands.Paste" />
<MenuItem Command="ApplicationCommands.Cut" />
</MenuItem>
<MenuItem Header="View"></MenuItem>
<MenuItem Header="View"/>
<MenuItem Header="Help">
<MenuItem Header="About..."></MenuItem>
<MenuItem Header="About..."/>
</MenuItem>
</Menu>
<ListView ItemsSource="{Binding Source={StaticResource coll1}}" SelectedIndex="5" Margin="2,52,10,190">
@@ -103,12 +111,12 @@
</GridView>
</ListView.View>
</ListView>
<ListBox Margin="10,258,0,10" HorizontalAlignment="Left" Width="180">
<ListBox Margin="10,0,0,10" HorizontalAlignment="Left" Width="180" Height="175" VerticalAlignment="Bottom">
<ListBoxItem Content="123"/>
<ListBoxItem Content="456"/>
<ListBoxItem Content="789"/>
</ListBox>
<TreeView Margin="204,258,10,10">
<TreeView Margin="204,0,10,10" Height="175" VerticalAlignment="Bottom">
<TreeViewItem Header="1">
<TreeViewItem Header="12">
<TreeViewItem Header="123"/>
@@ -121,18 +129,102 @@
</GroupBox>
</ContentControl>
<ContentControl Style="{StaticResource DesignerItemStyle}"
Height="155" Width="405"
Padding="2,27,2,2"
Canvas.Left="450"
Canvas.Top="400">
Canvas.Left="850"
Canvas.Top="20" Width="733" Height="475">
<GroupBox Margin="0,-25,0,0" Style="{StaticResource ExpandrStyleGroupBox}" >
<GroupBox.Header>
<Label>Grid</Label>
<Label Content="Xaml RichTextBox"/>
</GroupBox.Header>
<DataGrid SelectedIndex="2" Margin="2" AlternatingRowBackground="{DynamicResource AlternatingRowBackgroundBrush}" ItemsSource="{Binding Source={StaticResource coll2}}" />
<RichTextBox VerticalScrollBarVisibility="Auto">
<FlowDocument>
<Paragraph>
<Run FontWeight="Bold" FontSize="14" Text="What is Lorem Ipsum?"/>
</Paragraph>
<Paragraph TextAlignment="Justify">
<Run Text="Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum."/>
<Run Text=" "/>
<Figure HorizontalAnchor="ColumnRight" Width="205">
<BlockUIContainer>
<Image UseLayoutRounding="True" d:DesignUseLayoutRounding="True">
<Image.Source>
<BitmapImage CreateOptions="IgnoreImageCache" CacheOption="OnLoad" UriSource="http://minionomaniya.ru/wp-content/uploads/2016/01/%D0%BC%D0%B8%D0%BD%D1%8C%D0%BE%D0%BD%D1%8B-%D0%BF%D1%80%D0%B8%D0%BA%D0%BE%D0%BB%D1%8B-%D0%BA%D0%B0%D1%80%D1%82%D0%B8%D0%BD%D0%BA%D0%B8.jpg"/>
</Image.Source>
</Image>
</BlockUIContainer>
</Figure>
<Run Text=" "/>
<Figure HorizontalAnchor="ColumnRight" Width="230">
<BlockUIContainer>
<Image UseLayoutRounding="True" d:DesignUseLayoutRounding="True">
<Image.Source>
<BitmapImage CreateOptions="IgnoreImageCache" CacheOption="OnLoad" UriSource="http://www.radionetplus.ru/uploads/posts/2013-12/1386011570_dogs-wallpaper-2.jpg"/>
</Image.Source>
</Image>
</BlockUIContainer>
</Figure>
</Paragraph>
<Paragraph>
<Run FontWeight="Bold" FontSize="14" Text="Why do we use it?"/>
</Paragraph>
<Paragraph TextAlignment="Justify">
<Run Text="It is a long established fact that a reader will be distracted by the readable content of a page when looking at its layout. The point of using Lorem Ipsum is that it has a more-or-less normal distribution of letters, as opposed to using 'Content here, content here', making it look like readable English. Many desktop publishing packages and web page editors now use Lorem Ipsum as their default model text, and a search for 'lorem ipsum' will uncover many web sites still in their infancy. Various versions have evolved over the years, sometimes by accident, sometimes on purpose (injected humour and the like)."/>
</Paragraph>
<Paragraph>
<Run FontWeight="Bold" FontSize="14" Text="Where does it come from?"/>
</Paragraph>
<Paragraph TextAlignment="Justify">
<Run Text="Contrary to popular belief, Lorem Ipsum is not simply random text. It has roots in a piece of classical Latin literature from 45 BC, making it over 2000 years old. Richard McClintock, a Latin professor at Hampden-Sydney College in Virginia, looked up one of the more obscure Latin words, consectetur, from a Lorem Ipsum passage, and going through the cites of the word in classical literature, discovered the undoubtable source. Lorem Ipsum comes from sections 1.10.32 and 1.10.33 of &quot;de Finibus Bonorum et Malorum&quot; (The Extremes of Good and Evil) by Cicero, written in 45 BC. This book is a treatise on the theory of ethics, very popular during the Renaissance. The first line of Lorem Ipsum, &quot;Lorem ipsum dolor sit amet..&quot;, comes from a line in section 1.10.32."/>
</Paragraph>
<Paragraph TextAlignment="Justify">
<Run Text="The standard chunk of Lorem Ipsum used since the 1500s is reproduced below for those interested. Sections 1.10.32 and 1.10.33 from &quot;de Finibus Bonorum et Malorum&quot; by Cicero are also reproduced in their exact original form, accompanied by English versions from the 1914 translation by H. Rackham."/>
</Paragraph>
<Paragraph>
<Run FontWeight="Bold" FontSize="14" Text="Where can I get some?"/>
</Paragraph>
<Paragraph TextAlignment="Justify">
<Run Text="There are many variations of passages of Lorem Ipsum available, but the majority have suffered alteration in some form, by injected humour, or randomised words which don't look even slightly believable. If you are going to use a passage of Lorem Ipsum, you need to be sure there isn't anything embarrassing hidden in the middle of text. All the Lorem Ipsum generators on the Internet tend to repeat predefined chunks as necessary, making this the first true generator on the Internet. It uses a dictionary of over 200 Latin words, combined with a handful of model sentence structures, to generate Lorem Ipsum which looks reasonable. The generated Lorem Ipsum is therefore always free from repetition, injected humour, or non-characteristic words etc."/>
</Paragraph>
</FlowDocument>
</RichTextBox>
</GroupBox>
</ContentControl>
</BrightSharp:ZoomControl>
<ContentControl Style="{StaticResource DesignerItemStyle}"
MaxHeight="300" Width="440" MaxWidth="700"
Padding="2,27,2,2"
Canvas.Left="350"
Canvas.Top="550">
<Expander Margin="0,-25,0,0">
<Expander.Header>
<Label Background="Transparent" Content="Grid (MaxWidth,MaxHeight)"/>
</Expander.Header>
<DataGrid SelectedIndex="2" Margin="2" AlternatingRowBackground="{DynamicResource AlternatingRowBackgroundBrush}" AutoGenerateColumns="True" ItemsSource="{Binding Source={StaticResource coll2}}" AutoGeneratedColumns="DataGrid_AutoGeneratedColumns" />
</Expander>
</ContentControl>
<ContentControl Width="294" Height="133" Background="Pink" Canvas.Left="1050" Canvas.Top="550" Style="{StaticResource DesignerItemStyle}">
<Border>
<StackPanel>
<TextBlock FontStyle="Italic">(Some elements hidden by LODZoom extension)</TextBlock>
<Separator />
<TextBlock TextWrapping="Wrap" bsDiag:VisualExtensions.LODZoom=" A1-5">1. Element use LODZoom Functionality A1-5</TextBlock>
<TextBlock TextWrapping="Wrap" bsDiag:VisualExtensions.LODZoom="A -5.1">2. Element use LODZoom Functionality A -5.1</TextBlock>
<TextBlock TextWrapping="Wrap" bsDiag:VisualExtensions.LODZoom="a 2-8.3">3. Element use LODZoom Functionality a 2-8.3</TextBlock>
<TextBlock TextWrapping="Wrap" bsDiag:VisualExtensions.LODZoom="a 1.5-">4. Element use LODZoom Functionality a 1.5-</TextBlock>
<TextBlock TextWrapping="Wrap" bsDiag:VisualExtensions.LODZoom="1-5">5. Element use LODZoom Functionality 1-5</TextBlock>
</StackPanel>
</Border>
</ContentControl>
</bsDiag:ZoomControl>
<CheckBox VerticalAlignment="Bottom" HorizontalAlignment="Left" Margin="0,0,0,20" IsChecked="{Binding ElementName=zc, Path=UseAnimation}">UseAnimation</CheckBox>
<TextBlock VerticalAlignment="Bottom" HorizontalAlignment="Left">
<Run>RenderZoom: </Run><Run Text="{Binding ElementName=zc, Path=RenderZoom}" />
</TextBlock>
</Grid>
</Grid>
</Window>

View File

@@ -1,20 +1,8 @@
using BrightSharp.Diagrams;
using BrightSharp.Extensions;
using BrightSharp.Converters;
using Diagrams;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Controls.Primitives;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
namespace BrightSharp.Ui.Tests
{
@@ -30,8 +18,6 @@ namespace BrightSharp.Ui.Tests
tb.Text = ThemeManager.Theme.ToString();
}
private void Button_Click(object sender, RoutedEventArgs e)
{
if (Enum.IsDefined(typeof(ColorThemes), ThemeManager.Theme + 1))
@@ -44,5 +30,27 @@ namespace BrightSharp.Ui.Tests
}
tb.Text = ThemeManager.Theme.ToString();
}
private void Button_Click_ShowCustomWindow(object sender, RoutedEventArgs e)
{
new CustomWindow().ShowDialog();
}
private void Calendar_Loaded(object sender, RoutedEventArgs e)
{
var cal = (Calendar)sender;
cal.BlackoutDates.Add(new CalendarDateRange(DateTime.Now.AddDays(-10), DateTime.Now.AddDays(-8)));
cal.DisplayDateStart = DateTime.Now.AddDays(-400);
}
private void DataGrid_AutoGeneratedColumns(object sender, EventArgs e)
{
var dg = (DataGrid)sender;
var stringHelper = new StringHelpConverter();
foreach (var col in dg.Columns)
{
col.Header = stringHelper.Convert(col.Header, null, "SpaceBetweenCaps", null);
}
}
}
}

View File

@@ -8,8 +8,8 @@
// </auto-generated>
//------------------------------------------------------------------------------
namespace BrightSharp.Ui.Tests.Properties
{
namespace BrightSharp.Ui.Tests.Properties {
using System;
/// <summary>
@@ -22,28 +22,23 @@ namespace BrightSharp.Ui.Tests.Properties
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
internal class Resources
{
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()
{
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 ((resourceMan == null))
{
internal static global::System.Resources.ResourceManager ResourceManager {
get {
if (object.ReferenceEquals(resourceMan, null)) {
global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("BrightSharp.Ui.Tests.Properties.Resources", typeof(Resources).Assembly);
resourceMan = temp;
}
@@ -56,14 +51,11 @@ namespace BrightSharp.Ui.Tests.Properties
/// 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
{
internal static global::System.Globalization.CultureInfo Culture {
get {
return resourceCulture;
}
set
{
set {
resourceCulture = value;
}
}

View File

@@ -8,21 +8,17 @@
// </auto-generated>
//------------------------------------------------------------------------------
namespace BrightSharp.Ui.Tests.Properties
{
namespace BrightSharp.Ui.Tests.Properties {
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "11.0.0.0")]
internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase
{
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "14.0.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
{
public static Settings Default {
get {
return defaultInstance;
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 476 KiB

View File

@@ -7,10 +7,6 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "BrightSharp", "BrightSharp\
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "BrightSharp.Ui.Tests", "BrightSharp.Ui.Tests\BrightSharp.Ui.Tests.csproj", "{0D6E1828-8D07-4701-B98A-65DBF1604D3F}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "JetFrames.AppleJobs.Editor", "JetFrames.AppleJobs.Editor\JetFrames.AppleJobs.Editor.csproj", "{FD3E36B5-444A-4115-B288-6C924BEA0BD3}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AppleJobs.Data", "AppleJobs.Data\AppleJobs.Data.csproj", "{B4695C76-31FF-4BF1-9DC6-1BC62D374091}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
@@ -25,14 +21,6 @@ Global
{0D6E1828-8D07-4701-B98A-65DBF1604D3F}.Debug|Any CPU.Build.0 = Debug|Any CPU
{0D6E1828-8D07-4701-B98A-65DBF1604D3F}.Release|Any CPU.ActiveCfg = Release|Any CPU
{0D6E1828-8D07-4701-B98A-65DBF1604D3F}.Release|Any CPU.Build.0 = Release|Any CPU
{FD3E36B5-444A-4115-B288-6C924BEA0BD3}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{FD3E36B5-444A-4115-B288-6C924BEA0BD3}.Debug|Any CPU.Build.0 = Debug|Any CPU
{FD3E36B5-444A-4115-B288-6C924BEA0BD3}.Release|Any CPU.ActiveCfg = Release|Any CPU
{FD3E36B5-444A-4115-B288-6C924BEA0BD3}.Release|Any CPU.Build.0 = Release|Any CPU
{B4695C76-31FF-4BF1-9DC6-1BC62D374091}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{B4695C76-31FF-4BF1-9DC6-1BC62D374091}.Debug|Any CPU.Build.0 = Debug|Any CPU
{B4695C76-31FF-4BF1-9DC6-1BC62D374091}.Release|Any CPU.ActiveCfg = Release|Any CPU
{B4695C76-31FF-4BF1-9DC6-1BC62D374091}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE

View File

@@ -9,10 +9,11 @@
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>BrightSharp</RootNamespace>
<AssemblyName>BrightSharp</AssemblyName>
<TargetFrameworkVersion>v4.5.2</TargetFrameworkVersion>
<TargetFrameworkVersion>v4.5</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>
@@ -22,6 +23,7 @@
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<Prefer32Bit>false</Prefer32Bit>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
@@ -30,6 +32,7 @@
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<Prefer32Bit>false</Prefer32Bit>
</PropertyGroup>
<ItemGroup>
<Reference Include="System" />
@@ -40,7 +43,6 @@
<Reference Include="System.Core" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="System.Net.Http" />
<Reference Include="System.Xaml">
<RequiredTargetFramework>4.0</RequiredTargetFramework>
</Reference>
@@ -52,11 +54,13 @@
<Compile Include="Behaviors\FiterGridTextBoxBehavior.cs" />
<Compile Include="Commands\AsyncCommand.cs" />
<Compile Include="Commands\RelayCommand.cs" />
<Compile Include="Converters\StringHelpConverter.cs" />
<Compile Include="Diagrams\Adorners\ResizeRotateAdorner.cs" />
<Compile Include="Diagrams\Adorners\ResizeRotateChrome.cs" />
<Compile Include="Diagrams\Adorners\SizeAdorner.cs" />
<Compile Include="Diagrams\Adorners\SizeChrome.cs" />
<Compile Include="Diagrams\DesignerItemDecorator.cs" />
<Compile Include="Diagrams\VisualExtensions.cs" />
<Compile Include="Diagrams\SelectionBehavior.cs" />
<Compile Include="Diagrams\Thumbs\MoveThumb.cs" />
<Compile Include="Diagrams\Thumbs\ResizeThumb.cs" />
@@ -127,9 +131,10 @@
</None>
<AppDesigner Include="Properties\" />
</ItemGroup>
<ItemGroup />
<ItemGroup>
<Resource Include="icons\app.png" />
</ItemGroup>
<ItemGroup>
<Resource Include="icons\copy.png" />
<Resource Include="icons\cut.png" />
<Resource Include="icons\paste.png" />

View File

@@ -12,6 +12,10 @@ namespace BrightSharp.Commands
private Action<Exception> _onFail;
private bool _isExecuting;
public AsyncCommand(Func<Task> execute) : this(p => execute?.Invoke())
{
}
public AsyncCommand(Func<object, Task> execute) : this(execute, o => true)
{
}

View File

@@ -0,0 +1,32 @@
using System;
using System.Globalization;
using System.Text.RegularExpressions;
using System.Windows.Data;
namespace BrightSharp.Converters
{
public class StringHelpConverter : IValueConverter
{
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
{
if (parameter is string && value is string)
{
var parStr = (string)parameter;
switch (parStr)
{
case "SpaceBetweenCaps":
var src = (value ?? string.Empty).ToString();
return Regex.Replace(src, "([a-z])([A-Z])", "$1 $2");
default:
break;
}
}
return value;
}
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
{
throw new NotImplementedException();
}
}
}

View File

@@ -1,4 +1,5 @@
using System.Windows;
using System.ComponentModel;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Input;
@@ -6,6 +7,7 @@ using System.Windows.Media;
namespace Diagrams
{
[ToolboxItem(false)]
public class ResizeRotateAdorner : Adorner
{
private VisualCollection visuals;

View File

@@ -1,8 +1,10 @@
using System.Windows;
using System.ComponentModel;
using System.Windows;
using System.Windows.Controls;
namespace Diagrams
{
[ToolboxItem(false)]
public class ResizeRotateChrome : Control
{
static ResizeRotateChrome()

View File

@@ -1,10 +1,12 @@
using System.Windows;
using System.ComponentModel;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Media;
namespace Diagrams
{
[ToolboxItem(false)]
public class SizeAdorner : Adorner
{
private SizeChrome chrome;

View File

@@ -1,4 +1,5 @@
using System;
using System.ComponentModel;
using System.Globalization;
using System.Windows;
using System.Windows.Controls;
@@ -6,6 +7,8 @@ using System.Windows.Data;
namespace Diagrams
{
[ToolboxItem(false)]
public class SizeChrome : Control
{
static SizeChrome()

View File

@@ -8,9 +8,11 @@ using System.Windows;
using System.Windows.Media;
using System.Windows.Input;
using System.Windows.Media.Animation;
using System.ComponentModel;
namespace Diagrams
{
[ToolboxItem(false)]
public class DesignerItemDecorator : Control
{
private Adorner adorner;

View File

@@ -5,7 +5,7 @@ using System.Windows.Controls;
using System.Windows.Controls.Primitives;
using System;
namespace BrightSharp.Diagrams
namespace Diagrams
{
public static class SelectionBehavior
{

View File

@@ -1,4 +1,5 @@
using System.Windows;
using System.ComponentModel;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Controls.Primitives;
using System.Windows.Input;
@@ -6,6 +7,7 @@ using System.Windows.Media;
namespace Diagrams
{
[ToolboxItem(false)]
public class MoveThumb : Thumb
{
private RotateTransform rotateTransform;

View File

@@ -6,9 +6,11 @@ using System.Windows.Documents;
using System.Windows.Media;
using System.Collections.Generic;
using System.Windows.Input;
using System.ComponentModel;
namespace Diagrams
{
[ToolboxItem(false)]
public class ResizeThumb : Thumb
{
private RotateTransform rotateTransform;
@@ -86,12 +88,14 @@ namespace Diagrams
{
case System.Windows.VerticalAlignment.Bottom:
deltaVertical = Math.Min(-e.VerticalChange, this.designerItem.ActualHeight - this.designerItem.MinHeight);
deltaVertical = Math.Max(deltaVertical, this.designerItem.ActualHeight - this.designerItem.MaxHeight);
Canvas.SetTop(this.designerItem, Canvas.GetTop(this.designerItem) + (this.transformOrigin.Y * deltaVertical * (1 - Math.Cos(-this.angle))));
Canvas.SetLeft(this.designerItem, Canvas.GetLeft(this.designerItem) - deltaVertical * this.transformOrigin.Y * Math.Sin(-this.angle));
this.designerItem.Height -= deltaVertical;
break;
case System.Windows.VerticalAlignment.Top:
deltaVertical = Math.Min(e.VerticalChange, this.designerItem.ActualHeight - this.designerItem.MinHeight);
deltaVertical = Math.Max(deltaVertical, this.designerItem.ActualHeight - this.designerItem.MaxHeight);
Canvas.SetTop(this.designerItem, Canvas.GetTop(this.designerItem) + deltaVertical * Math.Cos(-this.angle) + (this.transformOrigin.Y * deltaVertical * (1 - Math.Cos(-this.angle))));
Canvas.SetLeft(this.designerItem, Canvas.GetLeft(this.designerItem) + deltaVertical * Math.Sin(-this.angle) - (this.transformOrigin.Y * deltaVertical * Math.Sin(-this.angle)));
this.designerItem.Height -= deltaVertical;
@@ -104,12 +108,14 @@ namespace Diagrams
{
case System.Windows.HorizontalAlignment.Left:
deltaHorizontal = Math.Min(e.HorizontalChange, this.designerItem.ActualWidth - this.designerItem.MinWidth);
deltaHorizontal = Math.Max(deltaHorizontal, this.designerItem.ActualWidth - this.designerItem.MaxWidth);
Canvas.SetTop(this.designerItem, Canvas.GetTop(this.designerItem) + deltaHorizontal * Math.Sin(this.angle) - this.transformOrigin.X * deltaHorizontal * Math.Sin(this.angle));
Canvas.SetLeft(this.designerItem, Canvas.GetLeft(this.designerItem) + deltaHorizontal * Math.Cos(this.angle) + (this.transformOrigin.X * deltaHorizontal * (1 - Math.Cos(this.angle))));
this.designerItem.Width -= deltaHorizontal;
break;
case System.Windows.HorizontalAlignment.Right:
deltaHorizontal = Math.Min(-e.HorizontalChange, this.designerItem.ActualWidth - this.designerItem.MinWidth);
deltaHorizontal = Math.Max(deltaHorizontal, this.designerItem.ActualWidth - this.designerItem.MaxWidth);
Canvas.SetTop(this.designerItem, Canvas.GetTop(this.designerItem) - this.transformOrigin.X * deltaHorizontal * Math.Sin(this.angle));
Canvas.SetLeft(this.designerItem, Canvas.GetLeft(this.designerItem) + (deltaHorizontal * this.transformOrigin.X * (1 - Math.Cos(this.angle))));
this.designerItem.Width -= deltaHorizontal;

View File

@@ -1,4 +1,5 @@
using System;
using System.ComponentModel;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Controls.Primitives;
@@ -7,6 +8,7 @@ using System.Windows.Media;
namespace Diagrams
{
[ToolboxItem(false)]
public class RotateThumb : Thumb
{
private double initialAngle;

View File

@@ -0,0 +1,115 @@
using BrightSharp;
using BrightSharp.Extensions;
using System;
using System.Globalization;
using System.Windows;
using System.Windows.Media;
using System.Windows.Media.Animation;
namespace Diagrams
{
/// <summary>
/// If starts with a(A) then use animation,
/// $FromZoom-$ToZoom pattern
/// </summary>
public class VisualExtensions : DependencyObject
{
#region LevelOfDetails Attached Property
public static readonly DependencyProperty LODZoomProperty =
DependencyProperty.RegisterAttached("LODZoom",
typeof(string),
typeof(VisualExtensions),
new UIPropertyMetadata(null, OnChangeLODZoomProperty));
public static void SetLODZoom(UIElement element, string o)
{
element.SetValue(LODZoomProperty, o);
}
public static string GetLODZoom(UIElement element)
{
return (string)element.GetValue(LODZoomProperty);
}
#endregion
private static void OnChangeLODZoomProperty(DependencyObject d, DependencyPropertyChangedEventArgs e)
{
var element = d as FrameworkElement;
if (element == null) return;
var window = Window.GetWindow(element);
if (window == null) return;
if (e.NewValue != e.OldValue)
{
var zoomControl = element.FindAncestor<ZoomControl>();
if (zoomControl == null) return;
var zoomChangedHandler = new RoutedEventHandler((sender, args) =>
{
var lodInfo = new LodInfo(GetLODZoom(element));
var transform = element.TransformToVisual(window) as MatrixTransform;
var scaleX = transform.Matrix.M11;
var newOpacity = (scaleX >= lodInfo.StartRange && scaleX <= lodInfo.EndRange) ? 1 : 0;
if (lodInfo.UseAnimation && args.RoutedEvent != FrameworkElement.LoadedEvent)
{
element.Visibility = Visibility.Visible;
var animation = new DoubleAnimation(newOpacity, TimeSpan.FromSeconds(.5));
element.BeginAnimation(UIElement.OpacityProperty, animation);
}
else
{
element.Visibility = newOpacity == 1 ? Visibility.Visible : Visibility.Hidden;
element.Opacity = newOpacity;
}
});
if (string.IsNullOrWhiteSpace((string)e.NewValue))
{
element.Opacity = 1;
zoomControl.ZoomChanged -= zoomChangedHandler;
zoomControl.Loaded -= zoomChangedHandler;
}
else
{
zoomControl.ZoomChanged += zoomChangedHandler;
zoomControl.Loaded += zoomChangedHandler;
}
}
}
sealed class LodInfo
{
public LodInfo(string lod)
{
UseAnimation = lod.StartsWith("a", true, CultureInfo.InvariantCulture);
lod = lod.TrimStart('a', 'A').Trim();
double rangeStart = 0;
double rangeEnd = double.PositiveInfinity;
var vals = lod.Split('-');
double.TryParse(vals[0], NumberStyles.AllowDecimalPoint, CultureInfo.InvariantCulture, out rangeStart);
if (vals.Length > 1)
{
if (!double.TryParse(vals[1], NumberStyles.AllowDecimalPoint, CultureInfo.InvariantCulture, out rangeEnd))
{
rangeEnd = double.PositiveInfinity;
}
}
EndRange = rangeEnd;
StartRange = rangeStart;
}
public double StartRange { get; set; }
public double EndRange { get; set; }
public bool UseAnimation { get; set; }
}
}
}

View File

@@ -9,7 +9,6 @@ namespace BrightSharp
{
internal partial class Generic
{
private const string StyleDictionaryPattern = @"(?<=.+style\.)(.*?)(?=\.xaml)";
public void CalendarPreviewMouseUp(object sender, MouseEventArgs e)
{
if (Mouse.Captured is CalendarItem) { Mouse.Capture(null); }
@@ -22,5 +21,25 @@ namespace BrightSharp
child = VisualTreeHelper.GetParent(child) ?? LogicalTreeHelper.GetParent(child);
if (((AdornerDecorator)child)?.Child is Calendar) ((AdornerDecorator)child).Child = null;
}
private void closeButton_Click(object sender, RoutedEventArgs e)
{
var window = Window.GetWindow((DependencyObject)sender);
window.Close();
}
private void maximizeButton_Click(object sender, RoutedEventArgs e)
{
var window = Window.GetWindow((DependencyObject)sender);
window.WindowState = window.WindowState == WindowState.Normal ? WindowState.Maximized : WindowState.Normal;
}
private void minimizeButton_Click(object sender, RoutedEventArgs e)
{
var window = Window.GetWindow((DependencyObject)sender);
window.WindowState = WindowState.Minimized;
}
}
}

View File

@@ -5,6 +5,7 @@
xmlns:bs="clr-namespace:BrightSharp.Extensions"
xmlns:conv="clr-namespace:BrightSharp.Converters"
xmlns:sys="clr-namespace:System;assembly=mscorlib"
xmlns:diag="clr-namespace:Diagrams"
xmlns:local="clr-namespace:BrightSharp">
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="Diagrams/Resources/DesignerItem.xaml" />
@@ -757,7 +758,7 @@
</VisualState>
<VisualState x:Name="Disabled">
<Storyboard>
<DoubleAnimation Duration="0" To="0.5" Storyboard.TargetProperty="(Shape.Fill).(Brush.Opacity)" Storyboard.TargetName="path"/>
<DoubleAnimation Duration="0" To="0.5" Storyboard.TargetProperty="Opacity" Storyboard.TargetName="path"/>
</Storyboard>
</VisualState>
</VisualStateGroup>
@@ -780,7 +781,7 @@
</VisualState>
<VisualState x:Name="Disabled">
<Storyboard>
<DoubleAnimation Duration="0" To="0.5" Storyboard.TargetProperty="(Shape.Fill).(Brush.Opacity)" Storyboard.TargetName="path"/>
<DoubleAnimation Duration="0" To="0.5" Storyboard.TargetProperty="Opacity" Storyboard.TargetName="path"/>
</Storyboard>
</VisualState>
</VisualStateGroup>
@@ -813,7 +814,7 @@
<VisualState x:Name="MouseOver"/>
<VisualState x:Name="Disabled">
<Storyboard>
<DoubleAnimation Duration="0" To="0.5" Storyboard.TargetProperty="(Shape.Fill).(Brush.Opacity)" Storyboard.TargetName="path"/>
<DoubleAnimation Duration="0" To="0.5" Storyboard.TargetProperty="Opacity" Storyboard.TargetName="path"/>
</Storyboard>
</VisualState>
</VisualStateGroup>
@@ -855,7 +856,7 @@
<VisualState x:Name="MouseOver"/>
<VisualState x:Name="Disabled">
<Storyboard>
<DoubleAnimation Duration="0" To="0.5" Storyboard.TargetProperty="(Shape.Fill).(Brush.Opacity)" Storyboard.TargetName="path"/>
<DoubleAnimation Duration="0" To="0.5" Storyboard.TargetProperty="Opacity" Storyboard.TargetName="path"/>
</Storyboard>
</VisualState>
</VisualStateGroup>
@@ -1473,6 +1474,9 @@
<Setter Property="MaxHeight" Value="22" />
</Style>
<Style TargetType="DataGridColumnHeader">
<Style.Resources>
<conv:StringHelpConverter x:Key="StringHelper" />
</Style.Resources>
<Setter Property="Foreground" Value="{DynamicResource UiForegroundBrush}" />
<Setter Property="HorizontalContentAlignment" Value="Stretch" />
<Setter Property="VerticalContentAlignment" Value="Center" />
@@ -1481,7 +1485,6 @@
<Setter Property="Background" Value="{DynamicResource LightBrush}" />
<Setter Property="Padding" Value="4" />
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="DataGridColumnHeader">
@@ -1502,7 +1505,7 @@
VerticalAlignment="Top" RenderTransformOrigin=".5 .5"
Data="M 0 0 L 4 4 L 8 0 Z"/>
<Grid Margin="{TemplateBinding Padding}">
<ContentPresenter RecognizesAccessKey="True" Content="{TemplateBinding Content}" ContentTemplate="{TemplateBinding ContentTemplate}" ContentStringFormat="{TemplateBinding ContentStringFormat}" HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" VerticalAlignment="{TemplateBinding VerticalContentAlignment}" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" />
<ContentPresenter RecognizesAccessKey="True" Content="{Binding Path=Content, Converter={StaticResource StringHelper}, RelativeSource={RelativeSource TemplatedParent}}" ContentTemplate="{TemplateBinding ContentTemplate}" ContentStringFormat="{TemplateBinding ContentStringFormat}" HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" VerticalAlignment="{TemplateBinding VerticalContentAlignment}" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" />
</Grid>
<Thumb Name="PART_LeftHeaderGripper" HorizontalAlignment="Left">
@@ -2587,7 +2590,7 @@
<Trigger Property="IsEnabled" Value="false">
<Setter TargetName="MainEllipse" Property="Opacity" Value="0.65" />
<Setter TargetName="MainEllipse" Property="Stroke" Value="DarkGray" />
<Setter Property="Foreground" Value="DarkGray"/>
<!--<Setter TargetName="MainGrid" Property="TextBlock.Foreground" Value="DarkGray"/>-->
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
@@ -3126,9 +3129,9 @@
<Setter Property="OverridesDefaultStyle" Value="True" />
<Setter Property="Height" Value="2"/>
<Setter Property="BorderThickness" Value="0,1,0,0" />
<Setter Property="BorderBrush" Value="#FF686868" />
<Setter Property="BorderBrush" Value="{DynamicResource SolidBorderBrush}" />
<Setter Property="Margin" Value="5,3"/>
<Setter Property="Background" Value="WhiteSmoke" />
<Setter Property="Background" Value="{DynamicResource WindowSolidBrush}" />
<Setter Property="VerticalAlignment" Value="Top" />
<Setter Property="Template">
<Setter.Value>
@@ -3970,6 +3973,7 @@
</Style>
</Style.Resources>
<Setter Property="MinWidth" Value="10" />
<Setter Property="Foreground" Value="{DynamicResource OnWindowForegroundBrush}" />
<Style.BasedOn>
<StaticResource ResourceKey="{x:Type TextBoxBase}"/>
</Style.BasedOn>
@@ -4380,7 +4384,7 @@
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type Separator}">
<Border BorderBrush="{DynamicResource SolidBorderColor}" BorderThickness="1" />
<Border BorderBrush="{DynamicResource SolidBorderBrush}" BorderThickness="1" />
</ControlTemplate>
</Setter.Value>
</Setter>
@@ -4652,6 +4656,8 @@
<Setter Property="HorizontalContentAlignment" Value="Stretch" />
<Setter Property="VerticalAlignment" Value="Stretch" />
<Setter Property="HorizontalAlignment" Value="Stretch" />
<Setter Property="BorderBrush" Value="{DynamicResource SolidBorderBrush}" />
<Setter Property="BorderThickness" Value="1" />
<Setter Property="Padding" Value="4" />
<Setter Property="Template">
<Setter.Value>
@@ -4675,7 +4681,7 @@
<Border
x:Name="Border"
Grid.Row="1" Grid.Column="1"
BorderBrush="{DynamicResource SolidBorderBrush}"
BorderBrush="{TemplateBinding BorderBrush}"
Background="{TemplateBinding Background}"
BorderThickness="{TemplateBinding BorderThickness}"
KeyboardNavigation.TabNavigation="Local"
@@ -5604,7 +5610,7 @@
<Style TargetType="{x:Type local:ZoomControl}">
<Style TargetType="{x:Type diag:ZoomControl}">
<Setter Property="Background" Value="Transparent" />
<Setter Property="ClipToBounds" Value="True" />
<Setter Property="Focusable" Value="False" />
@@ -5617,7 +5623,7 @@
</Setter>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type local:ZoomControl}">
<ControlTemplate TargetType="{x:Type diag:ZoomControl}">
<Border Background="{TemplateBinding Background}" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" Margin="{TemplateBinding Padding}">
<Grid>
<ItemsPresenter>
@@ -5639,6 +5645,110 @@
</Style>
<!-- Window (Experimental) Style -->
<LinearGradientBrush x:Key="WindowSolidBrush" EndPoint="0,1">
<GradientStop Color="White" />
<GradientStop Color="#FFE0E0E0" Offset="0.2" />
<GradientStop Color="#FFECECEC" Offset="0.7" />
<GradientStop Color="#FFC3E0FF" Offset="1" />
</LinearGradientBrush>
<Style x:Key="TestWindowStyle" TargetType="{x:Type Window}">
<Setter Property="WindowStyle" Value="None" />
<Setter Property="BorderBrush" >
<Setter.Value>
<LinearGradientBrush EndPoint="0,1" StartPoint="0,0">
<GradientStop Color="#FF898989" Offset="0"/>
<GradientStop Color="#FF898989" Offset="1"/>
<GradientStop Color="LightGray" Offset="0.841"/>
<GradientStop Color="#FFCBCBCB" Offset="0.23"/>
</LinearGradientBrush>
</Setter.Value>
</Setter>
<Setter Property="BorderThickness" Value="1" />
<Setter Property="Icon" Value="icons/app.png" />
<Setter Property="WindowChrome.WindowChrome">
<Setter.Value>
<WindowChrome CaptionHeight="30" ResizeBorderThickness="4" GlassFrameThickness="1" UseAeroCaptionButtons="False" />
</Setter.Value>
</Setter>
<Setter Property="Foreground" Value="{DynamicResource {x:Static SystemColors.WindowTextBrushKey}}"/>
<Setter Property="Background" Value="{DynamicResource {x:Static SystemColors.WindowBrushKey}}"/>
<Setter Property="bs:MarkupExtensionProperties.Header" Value="{Binding Path=Title, RelativeSource={RelativeSource Self}}" />
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type Window}">
<Border BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" Background="{TemplateBinding Background}">
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="30" />
<RowDefinition />
</Grid.RowDefinitions>
<Border Background="{DynamicResource WindowSolidBrush}">
<DockPanel>
<Image Width="16" Height="16" Source="{TemplateBinding Icon}" Margin="8" VerticalAlignment="Top" DockPanel.Dock="Left" />
<StackPanel DockPanel.Dock="Right" Orientation="Horizontal" VerticalAlignment="Top" Margin="2">
<Button VerticalAlignment="Center" Name="PART_MinimizeButton" Click="minimizeButton_Click" Focusable="False" WindowChrome.IsHitTestVisibleInChrome="True" Content="0" bs:MarkupExtensionProperties.CornerRadius="0" BorderBrush="Transparent" FontFamily="Webdings">
<Button.ToolTip>
<Label FontFamily="{TemplateBinding FontFamily}">Minimize</Label>
</Button.ToolTip>
</Button>
<Button VerticalAlignment="Center" Name="PART_MaximizeButton" Click="maximizeButton_Click" Focusable="False" WindowChrome.IsHitTestVisibleInChrome="True" Content="1" bs:MarkupExtensionProperties.CornerRadius="0" BorderBrush="Transparent" FontFamily="Webdings">
<Button.ToolTip>
<Label FontFamily="{TemplateBinding FontFamily}" Name="MaximizeBtnTooltip">Maximize</Label>
</Button.ToolTip>
</Button>
<Button Padding="6" Name="PART_CloseButton" Click="closeButton_Click" Focusable="False" WindowChrome.IsHitTestVisibleInChrome="True" Content="r" bs:MarkupExtensionProperties.CornerRadius="0" BorderBrush="Transparent" FontFamily="Webdings">
<Button.ToolTip>
<Label FontFamily="{TemplateBinding FontFamily}">Close (Alt+F4)</Label>
</Button.ToolTip>
<Button.Background>
<LinearGradientBrush EndPoint="0,1" StartPoint="0,0">
<GradientStop Color="#FFDEC3C3" Offset="0"/>
<GradientStop Color="#FFCDA2A2" Offset="1"/>
</LinearGradientBrush>
</Button.Background>
<Button.Resources>
<LinearGradientBrush x:Key="DarkBrush" EndPoint="0,1" StartPoint="0,0">
<GradientStop Color="#FFFF8A8A" Offset="0"/>
<GradientStop Color="#FFD14D4D" Offset="1"/>
</LinearGradientBrush>
</Button.Resources>
</Button>
</StackPanel>
<Label HorizontalContentAlignment="{TemplateBinding bs:MarkupExtensionProperties.HeaderHorizontalAlignment}" Content="{TemplateBinding bs:MarkupExtensionProperties.Header}" FontSize="15">
<Label.Effect>
<DropShadowEffect BlurRadius="2" ShadowDepth="2" Color="#7F4F5EA4" />
</Label.Effect>
</Label>
</DockPanel>
</Border>
<AdornerDecorator Grid.Row="1" x:Name="Decorator" ClipToBounds="True">
<ContentPresenter />
</AdornerDecorator>
<ResizeGrip WindowChrome.ResizeGripDirection="BottomRight" Grid.Row="3" x:Name="WindowResizeGrip" HorizontalAlignment="Right" IsTabStop="false" Visibility="Collapsed" VerticalAlignment="Bottom"/>
</Grid>
</Border>
<ControlTemplate.Triggers>
<Trigger Property="WindowState" Value="Maximized">
<Setter TargetName="PART_MaximizeButton" Property="Content" Value="2" />
<Setter TargetName="MaximizeBtnTooltip" Property="Content" Value="Normalize" />
</Trigger>
<MultiTrigger>
<MultiTrigger.Conditions>
<Condition Property="ResizeMode" Value="CanResizeWithGrip"/>
<Condition Property="WindowState" Value="Normal"/>
</MultiTrigger.Conditions>
<Setter Property="Visibility" TargetName="WindowResizeGrip" Value="Visible"/>
</MultiTrigger>
<Trigger Property="WindowState" Value="Maximized">
<Setter Property="Margin" TargetName="Decorator" Value="6,0,4,0" />
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
</ResourceDictionary>

View File

@@ -59,11 +59,7 @@ namespace BrightSharp.Mvvm
protected virtual void RaisePropertyChanged<T>(Expression<Func<T>> propertyExpression)
{
PropertyChangedEventHandler handler = PropertyChanged;
if(handler != null)
{
handler(this, new PropertyChangedEventArgs(GetPropertyName(propertyExpression)));
}
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(GetPropertyName(propertyExpression)));
}
protected Boolean Set<T>(Expression<Func<T>> propertyExpression, ref T field, T newValue)

View File

@@ -58,3 +58,8 @@ using System.Windows.Markup;
[assembly: XmlnsDefinition("http://schemas.brightsharp.com/developer", "BrightSharp")]
[assembly: XmlnsDefinition("http://schemas.brightsharp.com/developer", "BrightSharp.Extensions")]
[assembly: XmlnsDefinition("http://schemas.brightsharp.com/developer", "BrightSharp.Behaviors")]
[assembly: XmlnsDefinition("http://schemas.brightsharp.com/developer", "BrightSharp.Converters")]
[assembly: XmlnsPrefix("http://schemas.brightsharp.com/diagrams", "bsDiag")]
[assembly: XmlnsDefinition("http://schemas.brightsharp.com/diagrams", "Diagrams")]

View File

@@ -9,6 +9,7 @@
//------------------------------------------------------------------------------
namespace BrightSharp.Properties {
using System;
/// <summary>
@@ -37,7 +38,7 @@ namespace BrightSharp.Properties {
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
internal static global::System.Resources.ResourceManager ResourceManager {
get {
if ((resourceMan == null)) {
if (object.ReferenceEquals(resourceMan, null)) {
global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("BrightSharp.Properties.Resources", typeof(Resources).Assembly);
resourceMan = temp;
}

View File

@@ -8,21 +8,17 @@
// </auto-generated>
//------------------------------------------------------------------------------
namespace BrightSharp.Properties
{
namespace BrightSharp.Properties {
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "11.0.0.0")]
internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase
{
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "14.0.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
{
public static Settings Default {
get {
return defaultInstance;
}
}

View File

@@ -5,9 +5,8 @@ using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media.Animation;
using BrightSharp.Diagrams;
namespace BrightSharp
namespace Diagrams
{
public partial class ZoomControl : ItemsControl
@@ -15,6 +14,7 @@ namespace BrightSharp
public ZoomControl()
{
Loaded += ZoomControl_Loaded;
}
private void ZoomControl_Loaded(object sender, RoutedEventArgs e)
@@ -206,5 +206,6 @@ namespace BrightSharp
BeginAnimation(TranslateYProperty, null);
}
}
}
}

View File

@@ -1,33 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<configSections>
<!-- For more information on Entity Framework configuration, visit http://go.microsoft.com/fwlink/?LinkID=237468 -->
<section name="entityFramework" type="System.Data.Entity.Internal.ConfigFile.EntityFrameworkSection, EntityFramework, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" />
<sectionGroup name="userSettings" type="System.Configuration.UserSettingsGroup, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" >
<section name="JetFrames.AppleJobs.Editor.Properties.Settings" type="System.Configuration.ClientSettingsSection, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" allowExeDefinition="MachineToLocalUser" requirePermission="false" />
</sectionGroup>
</configSections>
<connectionStrings>
<add name="Default" providerName="MySql.Data.MySqlClient" connectionString="server=138.201.230.158;user id=admin_applejobs;pwd=dPARP0etzx;database=admin_applejobs_dev;CharSet=utf8;" />
</connectionStrings>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5.2" />
</startup>
<entityFramework>
<defaultConnectionFactory type="System.Data.Entity.Infrastructure.LocalDbConnectionFactory, EntityFramework">
<parameters>
<parameter value="v13.0" />
</parameters>
</defaultConnectionFactory>
<providers>
<provider invariantName="System.Data.SqlClient" type="System.Data.Entity.SqlServer.SqlProviderServices, EntityFramework.SqlServer" />
<provider invariantName="MySql.Data.MySqlClient" type="MySql.Data.MySqlClient.MySqlProviderServices, MySql.Data.Entity.EF6, Version=6.9.9.0, Culture=neutral, PublicKeyToken=c5687fc88969c44d"></provider>
</providers>
</entityFramework>
<system.data>
<DbProviderFactories>
<remove invariant="MySql.Data.MySqlClient" />
<add name="MySQL Data Provider" invariant="MySql.Data.MySqlClient" description=".Net Framework Data Provider for MySQL" type="MySql.Data.MySqlClient.MySqlClientFactory, MySql.Data, Version=6.9.9.0, Culture=neutral, PublicKeyToken=c5687fc88969c44d" />
</DbProviderFactories>
</system.data>
</configuration>

View File

@@ -1,14 +0,0 @@
<Application x:Class="JetFrames.AppleJobs.Editor.App"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="clr-namespace:JetFrames.AppleJobs.Editor"
StartupUri="MainWindow.xaml">
<Application.Resources>
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="/brightsharp;component/generic.xaml" />
</ResourceDictionary.MergedDictionaries>
<local:ViewModelLocator x:Key="ViewModelLocator" />
</ResourceDictionary>
</Application.Resources>
</Application>

View File

@@ -1,319 +0,0 @@
using BrightSharp.Mvvm;
using System.Collections.Generic;
using System.Linq;
using AppleJobs.Data;
using AppleJobs.Data.Models.ModelsJobs;
using System.Windows.Input;
using BrightSharp.Commands;
using System.Data.Entity;
using System.Windows;
using BrightSharp.Extensions;
using System.Windows.Controls;
using System.Windows.Data;
using JetFrames.AppleJobs.Editor.ViewModels;
using System.Collections;
using AppleJobs.Data.Models.Articles;
using AppleJobs.Data.Models.Orders;
using AppleJobs.Data.Models.Inventory;
using System.ComponentModel;
using System;
namespace JetFrames.AppleJobs.Editor
{
public class EditorViewModel : ObservableObject
{
private AppleJobsContext context;
public EditorViewModel(AppleJobsContext context)
{
this.context = context;
}
#region Data Properties
List<Model> _models;
public IEnumerable<Model> Models { get { return GetSingleton(ref _models, context.Models); } }
List<ModelCategory> _categories;
public IEnumerable<ModelCategory> Categories { get { return GetSingleton(ref _categories, context.ModelCategories); } }
private List<News> _news;
public IEnumerable<News> News { get { return GetSingleton(ref _news, context.News); } }
private List<NewsCategory> _newsCategories;
public IEnumerable<NewsCategory> NewsCategories { get { return GetSingleton(ref _newsCategories, context.NewsCategories); } }
List<ModelJobPriceTemplate> _modelJobPriceTemplates;
public IEnumerable<ModelJobPriceTemplate> ModelJobPriceTemplates
{
get
{
ModelJobs.Count();
return GetSingleton(ref _modelJobPriceTemplates, context.ModelJobPriceTemplates);
}
}
List<ModelJob> _modelJobs;
public IEnumerable<ModelJob> ModelJobs { get { context.Models.Load(); return GetSingleton(ref _modelJobs, context.ModelJobs); } }
List<Order> _orders;
public IEnumerable<Order> Orders { get { return GetSingleton(ref _orders, context.Orders.OrderByDescending(o => o.DateCreated).Take(2000)); } }
List<OrderStatus> _orderStatuses;
public IEnumerable<OrderStatus> OrderStatuses { get { return GetSingleton(ref _orderStatuses, context.OrderStatuses); } }
List<Accessories> _accessories;
public IEnumerable<Accessories> Accessories { get { return GetSingleton(ref _accessories, context.Accessories); } }
List<Employee> _employees;
public IEnumerable<Employee> Employees { get { return GetSingleton(ref _employees, context.Employees); } }
#endregion
#region Initialize Grid
public static void InitGrid(DataGrid dg)
{
CommandManager.AddPreviewCanExecuteHandler(dg, DataGridPreviewCanExecute);
dg.InitializingNewItem += DataGridInitializingNewItem;
}
private static void DataGridPreviewCanExecute(object sender, CanExecuteRoutedEventArgs e)
{
if (e.Command == DataGrid.DeleteCommand)
e.Handled = App.Locator.Editor.DeleteEntity(((DataGrid)sender).SelectedItems, true);
}
private static void DataGridInitializingNewItem(object sender, InitializingNewItemEventArgs e)
{
App.Locator.Editor.AddEntity(e.NewItem);
}
#endregion
#region Commands
public bool CanAdd(object item)
{
if (item is ModelJobPriceTemplate)
{
var mjpt = (ModelJobPriceTemplate)item;
return mjpt.Customers_Id != default(int) &&
mjpt.ModelJobs_Id != default(int);
}
else if (item is ModelJob)
{
var mj = (ModelJob)item;
return !string.IsNullOrWhiteSpace(mj.Name) &&
mj.Models_Id != default(int);
}
else if (item is Model)
{
var m = (Model)item;
return !string.IsNullOrWhiteSpace(m.Name) &&
m.ModelCategories_Id != default(int);
}
else if (item is ModelCategory)
{
var mc = (ModelCategory)item;
return !string.IsNullOrWhiteSpace(mc.Name);
}
return true;
}
public ICommand SaveCommand
{
get
{
return new AsyncCommand(p =>
{
var dg = (Keyboard.FocusedElement as UIElement).FindAncestor<DataGrid>();
if (dg != null)
{
dg.CommitEdit(DataGridEditingUnit.Row, true);
}
return context.SaveChangesAsync();
})
.OnComplete(() => ShowMessage("Сохранено"))
.OnFail(ex => ShowMessage("Ошибка при сохранении.", "Red"));
}
}
public ICommand RefreshCommand
{
get
{
return new RelayCommand(p =>
{
_categories = null;
_modelJobPriceTemplates = null;
_models = null;
_modelJobs = null;
_accessories = null;
_employees = null;
_orders = null;
_orderStatuses = null;
foreach (var entity in context.ChangeTracker.Entries())
{
entity.State = EntityState.Detached;
}
RaisePropertyChanged(nameof(Categories));
RaisePropertyChanged(nameof(ModelJobPriceTemplates));
RaisePropertyChanged(nameof(Models));
RaisePropertyChanged(nameof(ModelJobs));
RaisePropertyChanged(nameof(Accessories));
RaisePropertyChanged(nameof(Employees));
RaisePropertyChanged(nameof(Orders));
RaisePropertyChanged(nameof(OrderStatuses));
ShowMessage("Обновлено из базы данных");
});
}
}
public ICommand AddNewPriceTemplateCommand
{
get
{
return new RelayCommand(p =>
{
var vm = new NewPriceTemplateVm(Models, ModelJobs, ModelJobPriceTemplates, viewModel =>
{
var item = new ModelJobPriceTemplate
{
Price = viewModel.NewPrice,
Customers_Id = 1,
ModelJobs_Id = viewModel.SelectedModelJob.Id,
IsPriceFrom = true
};
_modelJobPriceTemplates.Add(item);
context.Entry(item).State = EntityState.Added;
CollectionViewSource.GetDefaultView(ModelJobPriceTemplates).Refresh();
});
var dialog = new Views.NewPriceTemplateDialog
{
DataContext = vm,
Owner = Application.Current.MainWindow
};
dialog.ShowDialog();
});
}
}
public ICommand ModelJobDropDownLoadedCommand
{
get
{
return new RelayCommand<int>(mId =>
{
var view = (CollectionViewSource)Application.Current.MainWindow.FindResource("modelJobsViewSource");
view.View.Filter = o =>
{
var mj = (ModelJob)o;
return mj.Models_Id == mId;
};
});
}
}
public ICommand ModelJobDropDownUnLoadedCommand
{
get
{
return new RelayCommand(p =>
{
var cb = (ComboBox)p;
cb.ItemsSource = null;
var view = (CollectionViewSource)Application.Current.MainWindow.FindResource("modelJobsViewSource");
view.View.Filter = null;
});
}
}
#endregion
public bool DeleteEntity(object entity, bool promt)
{
if (entity != null && (entity.GetType().IsPublic || entity is IEnumerable))
{
if (promt)
if (MessageBox.Show("Удалить?", "Подтверждение", MessageBoxButton.OKCancel, MessageBoxImage.Question) != MessageBoxResult.OK)
return true;
if (entity is IEnumerable)
foreach (var item in (IEnumerable)entity)
DeleteEntityInt(item);
else
DeleteEntityInt(entity);
}
return false;
}
private void DeleteEntityInt(object entity)
{
var currentState = context.Entry(entity).State;
if (currentState == EntityState.Added)
{
context.Entry(entity).State = EntityState.Detached;
}
else if (currentState != EntityState.Detached)
{
context.Entry(entity).State = EntityState.Deleted;
}
}
public void AddEntity(object newItem)
{
if (newItem != null)
{
if (newItem is Order)
{
var mjpt = (Order)newItem;
mjpt.Customers_Id = 1;
}
if (newItem is ModelJobPriceTemplate)
{
var mjpt = (ModelJobPriceTemplate)newItem;
mjpt.Customers_Id = 1;
}
context.Entry(newItem).State = EntityState.Added;
}
}
#region Message
private string _message;
public string Message
{
get { return _message; }
set { _message = value; RaisePropertyChanged(nameof(Message)); }
}
private string _messageForeground;
public string MessageForeground
{
get { return _messageForeground; }
set { _messageForeground = value; RaisePropertyChanged(nameof(MessageForeground)); }
}
private string _messageAnimationState;
public string MessageAnimationState
{
get { return _messageAnimationState; }
set { _messageAnimationState = value; RaisePropertyChanged(nameof(MessageAnimationState)); }
}
private void ShowMessage(string message, string foreground = "DarkGreen")
{
Message = message;
MessageForeground = foreground;
MessageAnimationState = ""; MessageAnimationState = "New";
}
#endregion
private static IEnumerable<T> GetSingleton<T>(ref List<T> entities, IQueryable<T> query) where T : class
{
if (entities != null) return entities;
entities = query.ToList();
//var view = CollectionViewSource.GetDefaultView(entities) as IEditableCollectionView;
//if (view != null) view.NewItemPlaceholderPosition = NewItemPlaceholderPosition.AtBeginning;
return entities;
}
}
}

View File

@@ -1,219 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="14.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>{FD3E36B5-444A-4115-B288-6C924BEA0BD3}</ProjectGuid>
<OutputType>WinExe</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>JetFrames.AppleJobs.Editor</RootNamespace>
<AssemblyName>JetFrames.AppleJobs.Editor</AssemblyName>
<TargetFrameworkVersion>v4.5.2</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<ProjectTypeGuids>{60dc8134-eba5-43b8-bcc9-bb4bc16c2548};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
<WarningLevel>4</WarningLevel>
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup>
<ApplicationIcon>appleicon.ico</ApplicationIcon>
</PropertyGroup>
<ItemGroup>
<Reference Include="EntityFramework, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089, processorArchitecture=MSIL">
<HintPath>..\packages\EntityFramework.6.1.0\lib\net45\EntityFramework.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="EntityFramework.SqlServer, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089, processorArchitecture=MSIL">
<HintPath>..\packages\EntityFramework.6.1.0\lib\net45\EntityFramework.SqlServer.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="Microsoft.AspNet.Identity.Core, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<HintPath>..\packages\Microsoft.AspNet.Identity.Core.2.2.1\lib\net45\Microsoft.AspNet.Identity.Core.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="Microsoft.AspNet.Identity.EntityFramework, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<HintPath>..\packages\Microsoft.AspNet.Identity.EntityFramework.2.2.1\lib\net45\Microsoft.AspNet.Identity.EntityFramework.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="Microsoft.Expression.Interactions, Version=4.5.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL" />
<Reference Include="MySql.Data, Version=6.9.9.0, Culture=neutral, PublicKeyToken=c5687fc88969c44d, processorArchitecture=MSIL">
<HintPath>..\packages\MySql.Data.6.9.9\lib\net45\MySql.Data.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="MySql.Data.Entity.EF6, Version=6.9.9.0, Culture=neutral, PublicKeyToken=c5687fc88969c44d, processorArchitecture=MSIL">
<HintPath>..\packages\MySql.Data.Entity.6.9.9\lib\net45\MySql.Data.Entity.EF6.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="System" />
<Reference Include="System.ComponentModel.DataAnnotations" />
<Reference Include="System.Data" />
<Reference Include="System.Windows.Interactivity, Version=4.5.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL" />
<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.Net.Http" />
<Reference Include="System.Xaml">
<RequiredTargetFramework>4.0</RequiredTargetFramework>
</Reference>
<Reference Include="WindowsBase" />
<Reference Include="PresentationCore" />
<Reference Include="PresentationFramework" />
</ItemGroup>
<ItemGroup>
<ApplicationDefinition Include="App.xaml">
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
</ApplicationDefinition>
<Compile Include="EditorViewModel.cs" />
<Compile Include="ViewModelLocator.cs" />
<Compile Include="ViewModels\NewPriceTemplateVm.cs" />
<Compile Include="Views\Accessories.xaml.cs">
<DependentUpon>Accessories.xaml</DependentUpon>
</Compile>
<Compile Include="Views\ModelCategories.xaml.cs">
<DependentUpon>ModelCategories.xaml</DependentUpon>
</Compile>
<Compile Include="Views\ModelJobPriceTemplates.xaml.cs">
<DependentUpon>ModelJobPriceTemplates.xaml</DependentUpon>
</Compile>
<Compile Include="Views\ModelJobs.xaml.cs">
<DependentUpon>ModelJobs.xaml</DependentUpon>
</Compile>
<Compile Include="Views\Models.xaml.cs">
<DependentUpon>Models.xaml</DependentUpon>
</Compile>
<Compile Include="Views\NewPriceTemplateDialog.xaml.cs">
<DependentUpon>NewPriceTemplateDialog.xaml</DependentUpon>
</Compile>
<Compile Include="Views\News.xaml.cs">
<DependentUpon>News.xaml</DependentUpon>
</Compile>
<Compile Include="Views\NewsCategories.xaml.cs">
<DependentUpon>NewsCategories.xaml</DependentUpon>
</Compile>
<Compile Include="Views\Orders.xaml.cs">
<DependentUpon>Orders.xaml</DependentUpon>
</Compile>
<Page Include="MainWindow.xaml">
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
</Page>
<Compile Include="App.xaml.cs">
<DependentUpon>App.xaml</DependentUpon>
<SubType>Code</SubType>
</Compile>
<Compile Include="MainWindow.xaml.cs">
<DependentUpon>MainWindow.xaml</DependentUpon>
<SubType>Code</SubType>
</Compile>
<Page Include="Views\Accessories.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="Views\ModelCategories.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="Views\ModelJobPriceTemplates.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="Views\ModelJobs.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="Views\Models.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="Views\NewPriceTemplateDialog.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="Views\News.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="Views\NewsCategories.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="Views\Orders.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
</ItemGroup>
<ItemGroup>
<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="packages.config" />
<None Include="Properties\Settings.settings">
<Generator>PublicSettingsSingleFileGenerator</Generator>
<LastGenOutput>Settings.Designer.cs</LastGenOutput>
</None>
<AppDesigner Include="Properties\" />
</ItemGroup>
<ItemGroup>
<None Include="App.config" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\AppleJobs.Data\AppleJobs.Data.csproj">
<Project>{b4695c76-31ff-4bf1-9dc6-1bc62d374091}</Project>
<Name>AppleJobs.Data</Name>
</ProjectReference>
<ProjectReference Include="..\BrightSharp\BrightSharp.csproj">
<Project>{acc3c556-f8e4-4f2a-a23d-8e8749679a1b}</Project>
<Name>BrightSharp</Name>
</ProjectReference>
</ItemGroup>
<ItemGroup>
<Folder Include="Converters\" />
</ItemGroup>
<ItemGroup>
<Resource Include="appleicon.ico" />
</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>

View File

@@ -1,228 +0,0 @@
<Window x:Class="JetFrames.AppleJobs.Editor.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:i="http://schemas.microsoft.com/expression/2010/interactivity"
xmlns:int="http://schemas.microsoft.com/expression/2010/interactions"
xmlns:view="clr-namespace:JetFrames.AppleJobs.Editor.Views"
xmlns:local="clr-namespace:JetFrames.AppleJobs.Editor"
xmlns:sys="clr-namespace:System;assembly=mscorlib"
xmlns:bs="http://schemas.brightsharp.com/developer"
Background="{DynamicResource WindowBackgroundBrush}"
mc:Ignorable="d" DataContext="{Binding Editor, Source={StaticResource ViewModelLocator}}"
Title="Редактор AppleJobs" Height="600" d:DesignWidth="800" Icon="appleicon.ico">
<Window.Resources>
<ObjectDataProvider x:Key="themes" MethodName="GetValues"
ObjectType="{x:Type sys:Enum}">
<ObjectDataProvider.MethodParameters>
<x:Type TypeName="bs:ColorThemes"/>
</ObjectDataProvider.MethodParameters>
</ObjectDataProvider>
<TabItem Header="Категории статей" x:Key="NewsCategoriesViewTab">
<TabItem.ContentTemplate>
<DataTemplate>
<Grid DataContext="{StaticResource ViewModelLocator}">
<TextBox VerticalAlignment="Top" HorizontalAlignment="Right" Width="200" Margin="0,5,0,0">
<bs:MarkupExtensionProperties.Header>Фильтрация</bs:MarkupExtensionProperties.Header>
<i:Interaction.Behaviors>
<bs:FilterDefaultViewTextBoxBehavior ItemsSource="{Binding Path=Editor.NewsCategories}" />
</i:Interaction.Behaviors>
</TextBox>
<view:NewsCategories Margin="0,30,0,0" />
</Grid>
</DataTemplate>
</TabItem.ContentTemplate>
</TabItem>
<TabItem Header="Модели" x:Key="ModelsViewTab">
<TabItem.ContentTemplate>
<DataTemplate>
<Grid DataContext="{StaticResource ViewModelLocator}">
<TextBox VerticalAlignment="Top" HorizontalAlignment="Right" Width="200" Margin="0,5,0,0">
<bs:MarkupExtensionProperties.Header>Фильтрация</bs:MarkupExtensionProperties.Header>
<i:Interaction.Behaviors>
<bs:FilterDefaultViewTextBoxBehavior ItemsSource="{Binding Path=Editor.Models}" />
</i:Interaction.Behaviors>
</TextBox>
<view:Models Margin="0,30,0,0" />
</Grid>
</DataTemplate>
</TabItem.ContentTemplate>
</TabItem>
<TabItem Header="Категории моделей" x:Key="ModelCategoriesViewTab">
<TabItem.ContentTemplate>
<DataTemplate>
<Grid DataContext="{StaticResource ViewModelLocator}">
<TextBox VerticalAlignment="Top" HorizontalAlignment="Right" Width="200" Margin="0,5,0,0">
<bs:MarkupExtensionProperties.Header>Фильтрация</bs:MarkupExtensionProperties.Header>
<i:Interaction.Behaviors>
<bs:FilterDefaultViewTextBoxBehavior ItemsSource="{Binding Editor.Categories}" />
</i:Interaction.Behaviors>
</TextBox>
<view:ModelCategories Margin="0,30,0,0" />
</Grid>
</DataTemplate>
</TabItem.ContentTemplate>
</TabItem>
<TabItem Header="Виды работ" x:Key="ModelJobsViewTab">
<TabItem.ContentTemplate>
<DataTemplate>
<Grid DataContext="{StaticResource ViewModelLocator}">
<TextBox VerticalAlignment="Top" HorizontalAlignment="Right" Width="200" Margin="0,5,0,0">
<bs:MarkupExtensionProperties.Header>Фильтрация</bs:MarkupExtensionProperties.Header>
<i:Interaction.Behaviors>
<bs:FilterDefaultViewTextBoxBehavior ItemsSource="{Binding Path=Editor.ModelJobs}" />
</i:Interaction.Behaviors>
</TextBox>
<view:ModelJobs Margin="0,30,0,0" />
</Grid>
</DataTemplate>
</TabItem.ContentTemplate>
</TabItem>
<TabItem Header="Расценки" x:Key="ModelJobPricesViewTab">
<TabItem.ContentTemplate>
<DataTemplate>
<Grid DataContext="{StaticResource ViewModelLocator}">
<TextBox VerticalAlignment="Top" HorizontalAlignment="Right" Width="200" Margin="0,5,0,0">
<bs:MarkupExtensionProperties.Header>Фильтрация</bs:MarkupExtensionProperties.Header>
<i:Interaction.Behaviors>
<bs:FilterDefaultViewTextBoxBehavior ItemsSource="{Binding Path=Editor.ModelJobPriceTemplates}" />
</i:Interaction.Behaviors>
</TextBox>
<Button bs:MarkupExtensionProperties.CornerRadius="0" VerticalAlignment="Top" HorizontalAlignment="Left" Command="{Binding Source={StaticResource ViewModelLocator}, Path=Editor.AddNewPriceTemplateCommand}" Margin="0,3,0,0">
<Path Fill="Blue">
<Path.Data>
<CombinedGeometry>
<CombinedGeometry.Geometry1>
<RectangleGeometry Rect="0,5,12,2" />
</CombinedGeometry.Geometry1>
<CombinedGeometry.Geometry2>
<RectangleGeometry Rect="5,0,2,12" />
</CombinedGeometry.Geometry2>
</CombinedGeometry>
</Path.Data>
</Path>
</Button>
<view:ModelJobPriceTemplates Margin="0,30,0,0" />
</Grid>
</DataTemplate>
</TabItem.ContentTemplate>
</TabItem>
<TabItem Header="Инвентарь" x:Key="AccessoriesViewTab">
<TabItem.ContentTemplate>
<DataTemplate>
<Grid DataContext="{StaticResource ViewModelLocator}">
<TextBox VerticalAlignment="Top" HorizontalAlignment="Right" Width="200" Margin="0,5,0,0">
<bs:MarkupExtensionProperties.Header>Фильтрация</bs:MarkupExtensionProperties.Header>
<i:Interaction.Behaviors>
<bs:FilterDefaultViewTextBoxBehavior ItemsSource="{Binding Path=Editor.Accessories}" />
</i:Interaction.Behaviors>
</TextBox>
<view:Accessories Margin="0,30,0,0" />
</Grid>
</DataTemplate>
</TabItem.ContentTemplate>
</TabItem>
<TabItem Header="Заказы" x:Key="OrdersViewTab">
<TabItem.ContentTemplate>
<DataTemplate>
<Grid DataContext="{StaticResource ViewModelLocator}">
<TextBox VerticalAlignment="Top" HorizontalAlignment="Right" Width="200" Margin="0,5,0,0">
<bs:MarkupExtensionProperties.Header>Фильтрация</bs:MarkupExtensionProperties.Header>
<i:Interaction.Behaviors>
<bs:FilterDefaultViewTextBoxBehavior ItemsSource="{Binding Path=Editor.Orders}" />
</i:Interaction.Behaviors>
</TextBox>
<view:Orders Margin="0,30,0,0" />
</Grid>
</DataTemplate>
</TabItem.ContentTemplate>
</TabItem>
<TabItem Header="Статьи" x:Key="NewsViewTab">
<TabItem.ContentTemplate>
<DataTemplate>
<Grid DataContext="{StaticResource ViewModelLocator}">
<TextBox VerticalAlignment="Top" HorizontalAlignment="Right" Width="200" Margin="0,5,0,0">
<bs:MarkupExtensionProperties.Header>Фильтрация</bs:MarkupExtensionProperties.Header>
<i:Interaction.Behaviors>
<bs:FilterDefaultViewTextBoxBehavior ItemsSource="{Binding Path=Editor.News}" />
</i:Interaction.Behaviors>
</TextBox>
<view:News Margin="0,30,0,0" />
</Grid>
</DataTemplate>
</TabItem.ContentTemplate>
</TabItem>
</Window.Resources>
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="200"/>
<ColumnDefinition Width="*"/>
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="auto" />
<RowDefinition />
</Grid.RowDefinitions>
<Menu VerticalAlignment="Top" Grid.ColumnSpan="2">
<MenuItem Header="Данные">
<MenuItem Header="Обновить" Command="{Binding RefreshCommand}" />
</MenuItem>
<MenuItem Header="Сайт"></MenuItem>
<MenuItem Header="Вид" ItemsSource="{Binding Source={StaticResource themes}}" MenuItem.Click="MenuItem_Click" />
<MenuItem Header="Сохранить" Command="{Binding SaveCommand}" CommandParameter="{Binding RelativeSource={RelativeSource Self}}"></MenuItem>
<TextBlock IsHitTestVisible="False" Text="{Binding Message}" Foreground="{Binding MessageForeground}" Opacity="0">
<TextBlock.Style>
<Style TargetType="TextBlock">
<Style.Triggers>
<DataTrigger Binding="{Binding MessageAnimationState}" Value="New">
<DataTrigger.EnterActions>
<BeginStoryboard Name="NewAnimation">
<Storyboard>
<DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="Opacity">
<LinearDoubleKeyFrame KeyTime="0:0:0" Value="0" />
<LinearDoubleKeyFrame KeyTime="0:0:.3" Value="1" />
<LinearDoubleKeyFrame KeyTime="0:0:4" Value="1" />
<LinearDoubleKeyFrame KeyTime="0:0:5" Value="0" />
</DoubleAnimationUsingKeyFrames>
</Storyboard>
</BeginStoryboard>
</DataTrigger.EnterActions>
<DataTrigger.ExitActions>
</DataTrigger.ExitActions>
</DataTrigger>
</Style.Triggers>
</Style>
</TextBlock.Style>
</TextBlock>
</Menu>
<TreeView Grid.Row="1" SelectedItemChanged="TreeView_SelectedItemChanged">
<TreeViewItem Header="Модели и расценки">
<TreeViewItem Header="Модели" Tag="{StaticResource ModelsViewTab}" />
<TreeViewItem Header="Категории моделей" Tag="{StaticResource ModelCategoriesViewTab}" />
<TreeViewItem Header="Виды работ" Tag="{StaticResource ModelJobsViewTab}"/>
<TreeViewItem Header="Расценки" Tag="{StaticResource ModelJobPricesViewTab}" />
</TreeViewItem>
<TreeViewItem Header="Ресурсы">
<TreeViewItem Header="Инвентарь" Tag="{StaticResource AccessoriesViewTab}" />
<!--TODO-->
<TreeViewItem Header="Специалисты" />
</TreeViewItem>
<TreeViewItem Header="Заказы" Tag="{StaticResource OrdersViewTab}" />
<TreeViewItem Header="Статьи (новости)">
<TreeViewItem Header="Статьи" Tag="{StaticResource NewsViewTab}" />
<!--TODO-->
<TreeViewItem Header="Категории статей" Tag="{StaticResource NewsCategoriesViewTab}" />
</TreeViewItem>
</TreeView>
<TabControl x:Name="tabs" Grid.Column="1" Grid.Row="1">
<!--<StaticResource ResourceKey="ModelsViewTab" />-->
</TabControl>
</Grid>
</Window>

View File

@@ -1,34 +0,0 @@
using BrightSharp;
using System.Windows;
using System.Windows.Controls;
namespace JetFrames.AppleJobs.Editor
{
public partial class MainWindow : Window
{
public MainWindow()
{
InitializeComponent();
}
private void MenuItem_Click(object sender, RoutedEventArgs e)
{
ThemeManager.Theme = (ColorThemes)((FrameworkElement)e.OriginalSource).DataContext;
}
private void TreeView_SelectedItemChanged(object sender, RoutedPropertyChangedEventArgs<object> e)
{
var item = (TreeViewItem)e.NewValue;
var tabitem = (TabItem)item.Tag;
if (tabitem != null)
{
if (!tabs.Items.Contains(tabitem))
{
tabs.Items.Add(tabitem);
}
tabs.SelectedItem = tabitem;
}
}
}
}

View File

@@ -1,5 +0,0 @@
<?xml version='1.0' encoding='utf-8'?>
<SettingsFile xmlns="http://schemas.microsoft.com/VisualStudio/2004/01/settings" CurrentProfile="(Default)">
<Profiles />
<Settings />
</SettingsFile>

View File

@@ -1,32 +0,0 @@
using AppleJobs.Data;
using BrightSharp.Mvvm;
using MySql.Data.MySqlClient;
using System;
using System.Collections.Generic;
using System.Data.Entity.Core.EntityClient;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace JetFrames.AppleJobs.Editor
{
public class ViewModelLocator
{
AppleJobsContext context;
public ViewModelLocator()
{
if (ObservableObject.IsInDesignTime)
{
context = new AppleJobsContext("server=138.201.230.158;user id=admin_applejobs;pwd=dPARP0etzx;database=admin_applejobs_dev;CharSet=utf8;");
}
else
{
context = new AppleJobsContext();
}
Editor = new EditorViewModel(context);
}
public EditorViewModel Editor { get; private set; }
}
}

View File

@@ -1,64 +0,0 @@
using AppleJobs.Data.Models.ModelsJobs;
using BrightSharp.Commands;
using BrightSharp.Mvvm;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Windows.Input;
namespace JetFrames.AppleJobs.Editor.ViewModels
{
public class NewPriceTemplateVm : ObservableObject
{
private readonly IEnumerable<ModelJobPriceTemplate> modelJobPriceTemplates;
private readonly IEnumerable<ModelJob> modelJobs;
public NewPriceTemplateVm(IEnumerable<Model> models, IEnumerable<ModelJob> modelJobs, IEnumerable<ModelJobPriceTemplate> modelJobPriceTemplates,
Action<NewPriceTemplateVm> createFunc)
{
this.modelJobs = modelJobs;
this.modelJobPriceTemplates = modelJobPriceTemplates;
Models = models;
CreateCommand = new RelayCommand(p => { createFunc?.Invoke(this); RaisePropertyChanged(nameof(FreeModelJobs)); }, p => SelectedModelJob != null);
}
private Model _selectedModel;
public Model SelectedModel
{
get { return _selectedModel; }
set { _selectedModel = value; RaisePropertyChanged(nameof(SelectedModel)); RaisePropertyChanged(nameof(FreeModelJobs)); }
}
public IEnumerable<Model> Models { get; private set; }
public IEnumerable<ModelJob> FreeModelJobs
{
get
{
if (SelectedModel == null) return null;
var res = modelJobs.Where(mj => mj.Model.Id == SelectedModel.Id && modelJobPriceTemplates.All(p => p.ModelJobs_Id != mj.Id));
return res;
}
}
private ModelJob _selectedModelJob;
public ModelJob SelectedModelJob
{
get { return _selectedModelJob; }
set { _selectedModelJob = value; RaisePropertyChanged(nameof(SelectedModelJob)); }
}
private int? _newPrice;
public int? NewPrice
{
get { return _newPrice; }
set { _newPrice = value; RaisePropertyChanged(nameof(NewPrice)); }
}
public ICommand CreateCommand
{
get; set;
}
}
}

View File

@@ -1,17 +0,0 @@
<UserControl x:Class="JetFrames.AppleJobs.Editor.Views.Accessories"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:local="clr-namespace:JetFrames.AppleJobs.Editor.Views"
mc:Ignorable="d" d:DataContext="{StaticResource ViewModelLocator}"
d:DesignHeight="300" d:DesignWidth="300">
<Grid>
<DataGrid x:Name="dg" ItemsSource="{Binding Editor.Accessories}"
AlternatingRowBackground="{DynamicResource AlternatingRowBackgroundBrush}">
<DataGrid.Columns>
<DataGridTextColumn Binding="{Binding Name, ValidatesOnNotifyDataErrors=True}" Header="Название" Width="100" />
</DataGrid.Columns>
</DataGrid>
</Grid>
</UserControl>

View File

@@ -1,17 +0,0 @@
<UserControl x:Class="JetFrames.AppleJobs.Editor.Views.ModelCategories"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:local="clr-namespace:JetFrames.AppleJobs.Editor.Views"
mc:Ignorable="d" d:DataContext="{StaticResource ViewModelLocator}"
d:DesignHeight="300" d:DesignWidth="300">
<Grid>
<DataGrid x:Name="dg" ItemsSource="{Binding Editor.Categories}"
AlternatingRowBackground="{DynamicResource AlternatingRowBackgroundBrush}">
<DataGrid.Columns>
<DataGridTextColumn Binding="{Binding Name, ValidatesOnNotifyDataErrors=True}" Header="Название" Width="100" />
</DataGrid.Columns>
</DataGrid>
</Grid>
</UserControl>

View File

@@ -1,17 +0,0 @@
using System.Windows.Controls;
using System.Windows.Input;
namespace JetFrames.AppleJobs.Editor.Views
{
/// <summary>
/// Interaction logic for ModelCategories.xaml
/// </summary>
public partial class ModelCategories : UserControl
{
public ModelCategories()
{
InitializeComponent();
EditorViewModel.InitGrid(dg);
}
}
}

View File

@@ -1,29 +0,0 @@
<UserControl x:Class="JetFrames.AppleJobs.Editor.Views.ModelJobPriceTemplates"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:local="clr-namespace:JetFrames.AppleJobs.Editor.Views"
mc:Ignorable="d" d:DataContext="{StaticResource ViewModelLocator}"
d:DesignHeight="300" d:DesignWidth="774">
<Grid>
<DataGrid x:Name="dg" ItemsSource="{Binding Editor.ModelJobPriceTemplates}"
CanUserAddRows="False" AlternatingRowBackground="{DynamicResource AlternatingRowBackgroundBrush}">
<DataGrid.Columns>
<DataGridTextColumn Binding="{Binding ModelJob.Name}" Header="Работа" Width="120" SortMemberPath="ModelJob.Name"
ClipboardContentBinding="{Binding ModelJob.Name}"
IsReadOnly="True" />
<DataGridTextColumn Binding="{Binding ModelJob.Model.Name}" Header="Модель" Width="120" SortMemberPath="ModelJob.Model.Name"
ClipboardContentBinding="{Binding ModelJob.Model.Name}"
IsReadOnly="True" />
<DataGridTextColumn Binding="{Binding ModelJob.Model.ModelCategory.Name}"
IsReadOnly="True" Header="Категория" Width="120" SortMemberPath="ModelJob.Model.ModelCategory.Name"
ClipboardContentBinding="{Binding ModelJob.Model.ModelCategory.Name}" />
<DataGridTextColumn Binding="{Binding Price, TargetNullValue=''}" Header="Цена" Width="100" ClipboardContentBinding="{Binding Price}" />
<DataGridCheckBoxColumn Binding="{Binding IsPriceFrom}" Header="Цена от" Width="80"
ClipboardContentBinding="{Binding IsPriceFrom}" />
</DataGrid.Columns>
</DataGrid>
</Grid>
</UserControl>

View File

@@ -1,16 +0,0 @@
using System.Windows.Controls;
namespace JetFrames.AppleJobs.Editor.Views
{
/// <summary>
/// Interaction logic for ModelJobPriceTemplates.xaml
/// </summary>
public partial class ModelJobPriceTemplates : UserControl
{
public ModelJobPriceTemplates()
{
InitializeComponent();
EditorViewModel.InitGrid(dg);
}
}
}

View File

@@ -1,26 +0,0 @@
<UserControl x:Class="JetFrames.AppleJobs.Editor.Views.ModelJobs"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:local="clr-namespace:JetFrames.AppleJobs.Editor.Views"
mc:Ignorable="d" d:DataContext="{StaticResource ViewModelLocator}"
d:DesignHeight="300" d:DesignWidth="527">
<Grid>
<DataGrid x:Name="dg" ItemsSource="{Binding Editor.ModelJobs}"
AlternatingRowBackground="{DynamicResource AlternatingRowBackgroundBrush}">
<DataGrid.Columns>
<DataGridTextColumn Binding="{Binding Name}" Header="Название" Width="150" />
<DataGridComboBoxColumn SelectedValueBinding="{Binding Model}"
ClipboardContentBinding="{Binding Model.Name}"
ItemsSource="{Binding Source={StaticResource ViewModelLocator}, Path=Editor.Models}"
DisplayMemberPath="Name" Header="Модель" Width="120" SortMemberPath="Model.Name"
EditingElementStyle="{StaticResource {x:Type ComboBox}}"/>
<DataGridTextColumn Binding="{Binding Description}" Header="Описание" Width="200" />
</DataGrid.Columns>
</DataGrid>
</Grid>
</UserControl>

View File

@@ -1,29 +0,0 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
namespace JetFrames.AppleJobs.Editor.Views
{
/// <summary>
/// Interaction logic for ModelJobs.xaml
/// </summary>
public partial class ModelJobs : UserControl
{
public ModelJobs()
{
InitializeComponent();
EditorViewModel.InitGrid(dg);
}
}
}

View File

@@ -1,22 +0,0 @@
<UserControl x:Class="JetFrames.AppleJobs.Editor.Views.Models"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:local="clr-namespace:JetFrames.AppleJobs.Editor.Views"
mc:Ignorable="d" d:DataContext="{StaticResource ViewModelLocator}"
d:DesignHeight="300" d:DesignWidth="300">
<Grid>
<DataGrid x:Name="dg" ItemsSource="{Binding Editor.Models}"
AlternatingRowBackground="{DynamicResource AlternatingRowBackgroundBrush}">
<DataGrid.Columns>
<DataGridTextColumn Binding="{Binding Name}" Header="Модель" Width="120" />
<DataGridComboBoxColumn SelectedValueBinding="{Binding ModelCategory, ValidatesOnExceptions=True}"
ClipboardContentBinding="{Binding ModelCategory.Name}"
ItemsSource="{Binding Source={StaticResource ViewModelLocator}, Path=Editor.Categories}"
DisplayMemberPath="Name" Header="Категория" Width="120" SortMemberPath="ModelCategory.Name"
EditingElementStyle="{StaticResource {x:Type ComboBox}}" />
</DataGrid.Columns>
</DataGrid>
</Grid>
</UserControl>

View File

@@ -1,29 +0,0 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
namespace JetFrames.AppleJobs.Editor.Views
{
/// <summary>
/// Interaction logic for Models.xaml
/// </summary>
public partial class Models : UserControl
{
public Models()
{
InitializeComponent();
EditorViewModel.InitGrid(dg);
}
}
}

View File

@@ -1,29 +0,0 @@
<Window x:Class="JetFrames.AppleJobs.Editor.Views.NewPriceTemplateDialog"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:local="clr-namespace:JetFrames.AppleJobs.Editor.Views"
WindowStartupLocation="CenterScreen" ResizeMode="NoResize"
mc:Ignorable="d" WindowStyle="ToolWindow" ShowInTaskbar="False" Title="Новая расценка"
Height="239" Width="324">
<Grid>
<DockPanel Margin="10" LastChildFill="False">
<Label DockPanel.Dock="Top">Модель*</Label>
<ComboBox DockPanel.Dock="Top" Name="modCb" VerticalAlignment="Top" ItemsSource="{Binding Models}" SelectedItem="{Binding SelectedModel, Mode=OneWayToSource}"
DisplayMemberPath="Name" />
<Label DockPanel.Dock="Top">Работа*</Label>
<ComboBox DockPanel.Dock="Top" DisplayMemberPath="Name" VerticalAlignment="Top" ItemsSource="{Binding FreeModelJobs}" SelectedItem="{Binding SelectedModelJob}" />
<Label DockPanel.Dock="Top">Цена (руб)</Label>
<TextBox DockPanel.Dock="Top" Text="{Binding NewPrice, TargetNullValue=''}"></TextBox>
<StackPanel DockPanel.Dock="Bottom" Orientation="Horizontal" HorizontalAlignment="Right">
<Button Content="Создать" Margin="5,5,0,5" IsDefault="True" Padding="20,7" Command="{Binding CreateCommand}" />
<Button Content="Закрыть" Margin="5,5,0,5" IsCancel="True" Padding="7" />
</StackPanel>
</DockPanel>
</Grid>
</Window>

View File

@@ -1,12 +0,0 @@
using System.Windows;
namespace JetFrames.AppleJobs.Editor.Views
{
public partial class NewPriceTemplateDialog : Window
{
public NewPriceTemplateDialog()
{
InitializeComponent();
}
}
}

View File

@@ -1,27 +0,0 @@
<UserControl x:Class="JetFrames.AppleJobs.Editor.Views.News"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:local="clr-namespace:JetFrames.AppleJobs.Editor.Views"
mc:Ignorable="d" d:DataContext="{StaticResource ViewModelLocator}"
d:DesignHeight="300" d:DesignWidth="1000">
<Grid>
<DataGrid x:Name="dg" ItemsSource="{Binding Editor.News}"
AlternatingRowBackground="{DynamicResource AlternatingRowBackgroundBrush}">
<DataGrid.Columns>
<DataGridTextColumn Binding="{Binding Title}" Header="Название" Width="200" />
<DataGridTextColumn Binding="{Binding Content}" Header="Содержание" Width="250" />
<DataGridTextColumn Binding="{Binding Date, StringFormat=MM/dd/yyyy}" Header="Дата" Width="100" />
<DataGridTextColumn Binding="{Binding State}" Header="Настройки" Width="100" />
<DataGridTextColumn Binding="{Binding OrderIndex}" Header="Порядковый номер" Width="100" />
<DataGridTextColumn Binding="{Binding CharCount}" Header="Число символов" IsReadOnly="True" Width="100" />
<DataGridComboBoxColumn SelectedItemBinding="{Binding NewsCategory}" DisplayMemberPath="CategoryDescription"
ItemsSource="{Binding Source={StaticResource ViewModelLocator}, Path=Editor.NewsCategories}"
ClipboardContentBinding="{Binding NewsCategory.CategoryDescription}"
EditingElementStyle="{StaticResource {x:Type ComboBox}}"
Header="Категория" Width="100" />
</DataGrid.Columns>
</DataGrid>
</Grid>
</UserControl>

View File

@@ -1,17 +0,0 @@
using System.Windows.Controls;
using System.Windows.Input;
namespace JetFrames.AppleJobs.Editor.Views
{
/// <summary>
/// Interaction logic for News.xaml
/// </summary>
public partial class News : UserControl
{
public News()
{
InitializeComponent();
EditorViewModel.InitGrid(dg);
}
}
}

View File

@@ -1,19 +0,0 @@
<UserControl x:Class="JetFrames.AppleJobs.Editor.Views.NewsCategories"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:local="clr-namespace:JetFrames.AppleJobs.Editor.Views"
mc:Ignorable="d" d:DataContext="{StaticResource ViewModelLocator}"
d:DesignHeight="300" d:DesignWidth="300">
<Grid>
<DataGrid x:Name="dg" ItemsSource="{Binding Editor.NewsCategories}"
AlternatingRowBackground="{DynamicResource AlternatingRowBackgroundBrush}">
<DataGrid.Columns>
<DataGridTextColumn Binding="{Binding CategoryName, ValidatesOnNotifyDataErrors=True}" Header="Категория" Width="100" />
<DataGridTextColumn Binding="{Binding CategoryDescription, ValidatesOnNotifyDataErrors=True}" Header="Название" Width="200" />
</DataGrid.Columns>
</DataGrid>
</Grid>
</UserControl>

View File

@@ -1,84 +0,0 @@
<UserControl x:Class="JetFrames.AppleJobs.Editor.Views.Orders"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:local="clr-namespace:JetFrames.AppleJobs.Editor.Views"
mc:Ignorable="d" d:DataContext="{StaticResource ViewModelLocator}"
d:DesignHeight="300" d:DesignWidth="1204">
<Grid>
<DataGrid x:Name="dg" ItemsSource="{Binding Editor.Orders}"
AlternatingRowBackground="{DynamicResource AlternatingRowBackgroundBrush}">
<DataGrid.Columns>
<DataGridTextColumn Binding="{Binding Contact}" Header="Контакт" Width="200" />
<DataGridComboBoxColumn ItemsSource="{Binding Source={StaticResource ViewModelLocator}, Path=Editor.OrderStatuses}"
SelectedValueBinding="{Binding OrderStatus}"
DisplayMemberPath="Name" SortMemberPath="OrderStatus.Name" ClipboardContentBinding="{Binding OrderStatus.Name}"
EditingElementStyle="{StaticResource {x:Type ComboBox}}" Header="Статус" Width="80" />
<DataGridComboBoxColumn SelectedValueBinding="{Binding Model, UpdateSourceTrigger=PropertyChanged}"
ItemsSource="{Binding Source={StaticResource ViewModelLocator}, Path=Editor.Models}"
ClipboardContentBinding="{Binding Model.Name}"
DisplayMemberPath="Name" Header="Модель" Width="120" SortMemberPath="Model.Name"
EditingElementStyle="{StaticResource {x:Type ComboBox}}"/>
<DataGridTextColumn Binding="{Binding Comment}" Header="Коментарий" Width="100" />
<DataGridCheckBoxColumn Binding="{Binding IsFast}" Header="Быстро" Width="60" />
<DataGridCheckBoxColumn Binding="{Binding IsDrive}" Header="Доставка" Width="60" />
<DataGridTextColumn Binding="{Binding Price}" Header="Цена" Width="80" />
<DataGridTemplateColumn Header="Работа" Width="150" ClipboardContentBinding="{Binding JobModel.Name}" SortMemberPath="JobModel.Name">
<DataGridTemplateColumn.CellTemplate>
<DataTemplate>
<TextBlock Text="{Binding JobModel.Name}" />
</DataTemplate>
</DataGridTemplateColumn.CellTemplate>
<DataGridTemplateColumn.CellEditingTemplate>
<DataTemplate>
<ComboBox ItemsSource="{Binding Model.ModelJobs}" DisplayMemberPath="Name"
SelectedItem="{Binding JobModel, UpdateSourceTrigger=PropertyChanged}" />
</DataTemplate>
</DataGridTemplateColumn.CellEditingTemplate>
</DataGridTemplateColumn>
<DataGridComboBoxColumn SelectedValueBinding="{Binding Accessories}"
ItemsSource="{Binding Source={StaticResource ViewModelLocator}, Path=Editor.Accessories}"
DisplayMemberPath="Name" SortMemberPath="Accessories.Name"
ClipboardContentBinding="{Binding Accessories.Name}"
EditingElementStyle="{StaticResource {x:Type ComboBox}}" Header="Инвентарь" Width="120" />
<DataGridComboBoxColumn SelectedValueBinding="{Binding Employee}"
ItemsSource="{Binding Source={StaticResource ViewModelLocator}, Path=Editor.Employees}"
DisplayMemberPath="Name" SortMemberPath="Employee.Name"
ClipboardContentBinding="{Binding Employee.Name}"
EditingElementStyle="{StaticResource {x:Type ComboBox}}"
Header="Мастер" Width="120" />
<DataGridTextColumn Binding="{Binding DateCreated}" Header="Дата создания" IsReadOnly="True" />
<DataGridTemplateColumn Header="Дата закрытия" SortMemberPath="DateClosed" ClipboardContentBinding="{Binding DateClosed}">
<DataGridTemplateColumn.CellTemplate>
<DataTemplate>
<TextBlock Text="{Binding DateClosed, StringFormat='MM/dd/yyyy'}" />
</DataTemplate>
</DataGridTemplateColumn.CellTemplate>
<DataGridTemplateColumn.CellEditingTemplate>
<DataTemplate>
<DatePicker SelectedDate="{Binding DateClosed}">
<DatePicker.Resources>
<Style TargetType="{x:Type DatePickerTextBox}">
<Setter Property="Control.Template">
<Setter.Value>
<ControlTemplate>
<TextBox x:Name="PART_TextBox"
Text="{Binding Path=SelectedDate, RelativeSource={RelativeSource AncestorType={x:Type DatePicker}}, StringFormat=M/d/yyyy}" />
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
</DatePicker.Resources>
</DatePicker>
</DataTemplate>
</DataGridTemplateColumn.CellEditingTemplate>
</DataGridTemplateColumn>
</DataGrid.Columns>
</DataGrid>
</Grid>
</UserControl>

View File

@@ -1,21 +0,0 @@
using AppleJobs.Data.Models;
using AppleJobs.Data.Models.ModelsJobs;
using AppleJobs.Data.Models.Orders;
using System.Windows.Controls;
using System.Windows.Input;
namespace JetFrames.AppleJobs.Editor.Views
{
/// <summary>
/// Interaction logic for Orders.xaml
/// </summary>
public partial class Orders : UserControl
{
public Orders()
{
InitializeComponent();
EditorViewModel.InitGrid(dg);
}
}
}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 192 KiB

View File

@@ -1,8 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="EntityFramework" version="6.1.0" targetFramework="net452" />
<package id="Microsoft.AspNet.Identity.Core" version="2.2.1" targetFramework="net452" />
<package id="Microsoft.AspNet.Identity.EntityFramework" version="2.2.1" targetFramework="net452" />
<package id="MySql.Data" version="6.9.9" targetFramework="net452" />
<package id="MySql.Data.Entity" version="6.9.9" targetFramework="net452" />
</packages>

Some files were not shown because too many files have changed in this diff Show More