diff --git a/AppleJobs.Data/App.config b/AppleJobs.Data/App.config deleted file mode 100644 index c3680c2..0000000 --- a/AppleJobs.Data/App.config +++ /dev/null @@ -1,24 +0,0 @@ - - - -
- - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/AppleJobs.Data/AppleJobs.Data.csproj b/AppleJobs.Data/AppleJobs.Data.csproj deleted file mode 100644 index 99a68b9..0000000 --- a/AppleJobs.Data/AppleJobs.Data.csproj +++ /dev/null @@ -1,126 +0,0 @@ - - - - - Debug - AnyCPU - {B4695C76-31FF-4BF1-9DC6-1BC62D374091} - Library - Properties - AppleJobs.Data - AppleJobs.Data - v4.5.2 - 512 - {60dc8134-eba5-43b8-bcc9-bb4bc16c2548};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} - 4 - true - - - AnyCPU - true - full - false - bin\Debug\ - DEBUG;TRACE - prompt - 4 - - - AnyCPU - pdbonly - true - bin\Release\ - TRACE - prompt - 4 - - - - - - - ..\packages\EntityFramework.6.1.0\lib\net45\EntityFramework.dll - True - - - ..\packages\EntityFramework.6.1.0\lib\net45\EntityFramework.SqlServer.dll - True - - - ..\packages\Microsoft.AspNet.Identity.Core.2.2.1\lib\net45\Microsoft.AspNet.Identity.Core.dll - True - - - ..\packages\Microsoft.AspNet.Identity.EntityFramework.2.2.1\lib\net45\Microsoft.AspNet.Identity.EntityFramework.dll - True - - - ..\packages\MySql.Data.6.9.9\lib\net45\MySql.Data.dll - True - - - ..\packages\MySql.Data.Entity.6.9.9\lib\net45\MySql.Data.Entity.EF6.dll - True - - - - - - - - - - - - 4.0 - - - - - - - - - - - - - - - - - - - Code - - - True - True - Resources.resx - - - True - Settings.settings - True - - - ResXFileCodeGenerator - Resources.Designer.cs - - - - - SettingsSingleFileGenerator - Settings.Designer.cs - - - - - - \ No newline at end of file diff --git a/AppleJobs.Data/AppleJobsContext.cs b/AppleJobs.Data/AppleJobsContext.cs deleted file mode 100644 index f9118f1..0000000 --- a/AppleJobs.Data/AppleJobsContext.cs +++ /dev/null @@ -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 - { - #region Common - - public DbSet Customers { get; set; } - - #endregion - - #region Orders - - public DbSet OrderCategories { get; set; } - public DbSet Orders { get; set; } - public DbSet OrdersView { get; set; } - public DbSet OrderStatuses { get; set; } - - #endregion - - #region Inventory - - public DbSet Accessories { get; set; } - public DbSet Employees { get; set; } - - #endregion - - #region Prices - - public DbSet Models { get; set; } - public DbSet ModelJobs { get; set; } - public DbSet ModelCategories { get; set; } - public DbSet ModelJobPriceTemplates { get; set; } - - #endregion - - #region Articles / News - - public DbSet News { get; set; } - public DbSet NewsCategories { get; set; } - - #endregion - - public AppleJobsContext(string connection = "Default") : base(connection) - { - } - } - public class ApplicationUser : IdentityUser - { - } -} diff --git a/AppleJobs.Data/Models/Articles/News.cs b/AppleJobs.Data/Models/Articles/News.cs deleted file mode 100644 index ca71eb9..0000000 --- a/AppleJobs.Data/Models/Articles/News.cs +++ /dev/null @@ -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); } } - } -} diff --git a/AppleJobs.Data/Models/Articles/NewsCategory.cs b/AppleJobs.Data/Models/Articles/NewsCategory.cs deleted file mode 100644 index 7e30bec..0000000 --- a/AppleJobs.Data/Models/Articles/NewsCategory.cs +++ /dev/null @@ -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; } - - } -} diff --git a/AppleJobs.Data/Models/Common/Customer.cs b/AppleJobs.Data/Models/Common/Customer.cs deleted file mode 100644 index 40eed64..0000000 --- a/AppleJobs.Data/Models/Common/Customer.cs +++ /dev/null @@ -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; } - - } -} diff --git a/AppleJobs.Data/Models/Inventory/Accessories.cs b/AppleJobs.Data/Models/Inventory/Accessories.cs deleted file mode 100644 index 129c80f..0000000 --- a/AppleJobs.Data/Models/Inventory/Accessories.cs +++ /dev/null @@ -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; } - } -} diff --git a/AppleJobs.Data/Models/Inventory/Employee.cs b/AppleJobs.Data/Models/Inventory/Employee.cs deleted file mode 100644 index 1516625..0000000 --- a/AppleJobs.Data/Models/Inventory/Employee.cs +++ /dev/null @@ -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; } - } -} diff --git a/AppleJobs.Data/Models/ModelsJobs/Model.cs b/AppleJobs.Data/Models/ModelsJobs/Model.cs deleted file mode 100644 index c988b03..0000000 --- a/AppleJobs.Data/Models/ModelsJobs/Model.cs +++ /dev/null @@ -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 ModelJobs { get; set; } - - public string FilterString { get { return string.Format("{0},{1}", Name, ModelCategory?.FilterString); } } - - } -} diff --git a/AppleJobs.Data/Models/ModelsJobs/ModelCategory.cs b/AppleJobs.Data/Models/ModelsJobs/ModelCategory.cs deleted file mode 100644 index 6fd9234..0000000 --- a/AppleJobs.Data/Models/ModelsJobs/ModelCategory.cs +++ /dev/null @@ -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); } } - - } -} diff --git a/AppleJobs.Data/Models/ModelsJobs/ModelJob.cs b/AppleJobs.Data/Models/ModelsJobs/ModelJob.cs deleted file mode 100644 index 863a509..0000000 --- a/AppleJobs.Data/Models/ModelsJobs/ModelJob.cs +++ /dev/null @@ -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); } } - } -} diff --git a/AppleJobs.Data/Models/ModelsJobs/ModelJobPriceTemplate.cs b/AppleJobs.Data/Models/ModelsJobs/ModelJobPriceTemplate.cs deleted file mode 100644 index 14078c9..0000000 --- a/AppleJobs.Data/Models/ModelsJobs/ModelJobPriceTemplate.cs +++ /dev/null @@ -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); } } - } -} diff --git a/AppleJobs.Data/Models/Orders/Order.cs b/AppleJobs.Data/Models/Orders/Order.cs deleted file mode 100644 index c539a6a..0000000 --- a/AppleJobs.Data/Models/Orders/Order.cs +++ /dev/null @@ -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); - } - } - } -} \ No newline at end of file diff --git a/AppleJobs.Data/Models/Orders/OrderCategory.cs b/AppleJobs.Data/Models/Orders/OrderCategory.cs deleted file mode 100644 index e6596ec..0000000 --- a/AppleJobs.Data/Models/Orders/OrderCategory.cs +++ /dev/null @@ -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; } - } -} diff --git a/AppleJobs.Data/Models/Orders/OrderStatus.cs b/AppleJobs.Data/Models/Orders/OrderStatus.cs deleted file mode 100644 index 190f14b..0000000 --- a/AppleJobs.Data/Models/Orders/OrderStatus.cs +++ /dev/null @@ -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; } - } -} diff --git a/AppleJobs.Data/Models/TsModelAttribute.cs b/AppleJobs.Data/Models/TsModelAttribute.cs deleted file mode 100644 index 3a1e9c7..0000000 --- a/AppleJobs.Data/Models/TsModelAttribute.cs +++ /dev/null @@ -1,8 +0,0 @@ -using System; - -namespace AppleJobs.Data.Models -{ - public class TsModelAttribute : Attribute - { - } -} diff --git a/AppleJobs.Data/packages.config b/AppleJobs.Data/packages.config deleted file mode 100644 index b8fa147..0000000 --- a/AppleJobs.Data/packages.config +++ /dev/null @@ -1,8 +0,0 @@ - - - - - - - - \ No newline at end of file diff --git a/BrightSharp.Extra.sln b/BrightSharp.Extra.sln new file mode 100644 index 0000000..1895be0 --- /dev/null +++ b/BrightSharp.Extra.sln @@ -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 diff --git a/BrightSharp.Toolkit.Extra.UiTests/App.config b/BrightSharp.Toolkit.Extra.UiTests/App.config new file mode 100644 index 0000000..88fa402 --- /dev/null +++ b/BrightSharp.Toolkit.Extra.UiTests/App.config @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/BrightSharp.Toolkit.Extra.UiTests/App.xaml b/BrightSharp.Toolkit.Extra.UiTests/App.xaml new file mode 100644 index 0000000..5e5af00 --- /dev/null +++ b/BrightSharp.Toolkit.Extra.UiTests/App.xaml @@ -0,0 +1,9 @@ + + + + + diff --git a/JetFrames.AppleJobs.Editor/App.xaml.cs b/BrightSharp.Toolkit.Extra.UiTests/App.xaml.cs similarity index 64% rename from JetFrames.AppleJobs.Editor/App.xaml.cs rename to BrightSharp.Toolkit.Extra.UiTests/App.xaml.cs index d486a3c..0894dc7 100644 --- a/JetFrames.AppleJobs.Editor/App.xaml.cs +++ b/BrightSharp.Toolkit.Extra.UiTests/App.xaml.cs @@ -6,13 +6,12 @@ using System.Linq; using System.Threading.Tasks; using System.Windows; -namespace JetFrames.AppleJobs.Editor +namespace BrightSharp.Toolkit.Extra.UiTests { /// /// Interaction logic for App.xaml /// public partial class App : Application { - public static ViewModelLocator Locator { get { return (ViewModelLocator)Current.TryFindResource("ViewModelLocator"); } } } } diff --git a/BrightSharp.Toolkit.Extra.UiTests/BrightSharp.Toolkit.Extra.UiTests.csproj b/BrightSharp.Toolkit.Extra.UiTests/BrightSharp.Toolkit.Extra.UiTests.csproj new file mode 100644 index 0000000..a8caf4d --- /dev/null +++ b/BrightSharp.Toolkit.Extra.UiTests/BrightSharp.Toolkit.Extra.UiTests.csproj @@ -0,0 +1,164 @@ + + + + + Debug + AnyCPU + {0A5F0006-5C82-459A-84B7-7524021F3616} + WinExe + Properties + BrightSharp.Toolkit.Extra.UiTests + BrightSharp.Toolkit.Extra.UiTests + v4.5.2 + 512 + {60dc8134-eba5-43b8-bcc9-bb4bc16c2548};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} + 4 + true + + + + + AnyCPU + true + full + false + bin\Debug\ + DEBUG;TRACE + prompt + 4 + + + AnyCPU + pdbonly + true + bin\Release\ + TRACE + prompt + 4 + + + true + ..\build.extra\x64\ + DEBUG;TRACE + full + x64 + prompt + MinimumRecommendedRules.ruleset + true + + + ..\build.extra\x64\ + TRACE + true + pdbonly + x64 + prompt + MinimumRecommendedRules.ruleset + true + + + true + ..\build.extra\x86\ + DEBUG;TRACE + full + x86 + prompt + MinimumRecommendedRules.ruleset + true + + + ..\build.extra\x86\ + TRACE + true + pdbonly + x86 + prompt + MinimumRecommendedRules.ruleset + true + + + + + + + + + + + + 4.0 + + + + + + + + MSBuild:Compile + Designer + + + MSBuild:Compile + Designer + + + App.xaml + Code + + + MainWindow.xaml + Code + + + + + Code + + + True + True + Resources.resx + + + True + Settings.settings + True + + + ResXFileCodeGenerator + Resources.Designer.cs + + + + SettingsSingleFileGenerator + Settings.Designer.cs + + + + + + + + + {556dd6d9-e5ee-4161-9653-5134fce99946} + BrightSharp.Toolkit.Extra + + + + + + + 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}. + + + + + + + \ No newline at end of file diff --git a/BrightSharp.Toolkit.Extra.UiTests/MainWindow.xaml b/BrightSharp.Toolkit.Extra.UiTests/MainWindow.xaml new file mode 100644 index 0000000..d9d90ed --- /dev/null +++ b/BrightSharp.Toolkit.Extra.UiTests/MainWindow.xaml @@ -0,0 +1,16 @@ + + + + + + + diff --git a/JetFrames.AppleJobs.Editor/Views/NewsCategories.xaml.cs b/BrightSharp.Toolkit.Extra.UiTests/MainWindow.xaml.cs similarity index 73% rename from JetFrames.AppleJobs.Editor/Views/NewsCategories.xaml.cs rename to BrightSharp.Toolkit.Extra.UiTests/MainWindow.xaml.cs index 30d57e7..e1c9b11 100644 --- a/JetFrames.AppleJobs.Editor/Views/NewsCategories.xaml.cs +++ b/BrightSharp.Toolkit.Extra.UiTests/MainWindow.xaml.cs @@ -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 { /// - /// Interaction logic for NewsCategories.xaml + /// Interaction logic for MainWindow.xaml /// - public partial class NewsCategories : UserControl + public partial class MainWindow : Window { - public NewsCategories() + public MainWindow() { InitializeComponent(); } diff --git a/JetFrames.AppleJobs.Editor/Properties/AssemblyInfo.cs b/BrightSharp.Toolkit.Extra.UiTests/Properties/AssemblyInfo.cs similarity index 94% rename from JetFrames.AppleJobs.Editor/Properties/AssemblyInfo.cs rename to BrightSharp.Toolkit.Extra.UiTests/Properties/AssemblyInfo.cs index 4760bc9..d5bf779 100644 --- a/JetFrames.AppleJobs.Editor/Properties/AssemblyInfo.cs +++ b/BrightSharp.Toolkit.Extra.UiTests/Properties/AssemblyInfo.cs @@ -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("")] diff --git a/AppleJobs.Data/Properties/Resources.Designer.cs b/BrightSharp.Toolkit.Extra.UiTests/Properties/Resources.Designer.cs similarity index 93% rename from AppleJobs.Data/Properties/Resources.Designer.cs rename to BrightSharp.Toolkit.Extra.UiTests/Properties/Resources.Designer.cs index 35faca7..c3dd894 100644 --- a/AppleJobs.Data/Properties/Resources.Designer.cs +++ b/BrightSharp.Toolkit.Extra.UiTests/Properties/Resources.Designer.cs @@ -8,7 +8,7 @@ // //------------------------------------------------------------------------------ -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; diff --git a/AppleJobs.Data/Properties/Resources.resx b/BrightSharp.Toolkit.Extra.UiTests/Properties/Resources.resx similarity index 100% rename from AppleJobs.Data/Properties/Resources.resx rename to BrightSharp.Toolkit.Extra.UiTests/Properties/Resources.resx diff --git a/AppleJobs.Data/Properties/Settings.Designer.cs b/BrightSharp.Toolkit.Extra.UiTests/Properties/Settings.Designer.cs similarity index 94% rename from AppleJobs.Data/Properties/Settings.Designer.cs rename to BrightSharp.Toolkit.Extra.UiTests/Properties/Settings.Designer.cs index 32935f6..19182f5 100644 --- a/AppleJobs.Data/Properties/Settings.Designer.cs +++ b/BrightSharp.Toolkit.Extra.UiTests/Properties/Settings.Designer.cs @@ -8,7 +8,7 @@ // //------------------------------------------------------------------------------ -namespace AppleJobs.Data.Properties +namespace BrightSharp.Toolkit.Extra.UiTests.Properties { diff --git a/AppleJobs.Data/Properties/Settings.settings b/BrightSharp.Toolkit.Extra.UiTests/Properties/Settings.settings similarity index 100% rename from AppleJobs.Data/Properties/Settings.settings rename to BrightSharp.Toolkit.Extra.UiTests/Properties/Settings.settings diff --git a/BrightSharp.Toolkit.Extra.UiTests/packages.config b/BrightSharp.Toolkit.Extra.UiTests/packages.config new file mode 100644 index 0000000..b750843 --- /dev/null +++ b/BrightSharp.Toolkit.Extra.UiTests/packages.config @@ -0,0 +1,5 @@ + + + + + \ No newline at end of file diff --git a/BrightSharp.Toolkit.Extra/BrightSharp.Toolkit.Extra.csproj b/BrightSharp.Toolkit.Extra/BrightSharp.Toolkit.Extra.csproj new file mode 100644 index 0000000..bb1db54 --- /dev/null +++ b/BrightSharp.Toolkit.Extra/BrightSharp.Toolkit.Extra.csproj @@ -0,0 +1,163 @@ + + + + + + + Debug + AnyCPU + {556DD6D9-E5EE-4161-9653-5134FCE99946} + library + Properties + BrightSharp.Toolkit.Extra + BrightSharp.Toolkit.Extra + v4.5.2 + 512 + {60dc8134-eba5-43b8-bcc9-bb4bc16c2548};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} + 4 + + + + + + true + full + false + bin\Debug\ + DEBUG;TRACE + prompt + 4 + false + + + pdbonly + true + bin\Release\ + TRACE + prompt + 4 + false + + + true + ..\build.extra\x64\ + DEBUG;TRACE + full + x64 + prompt + MinimumRecommendedRules.ruleset + false + false + + + ..\build.extra\x64\ + TRACE + true + pdbonly + x64 + prompt + MinimumRecommendedRules.ruleset + false + + + true + ..\build.extra\x86\ + DEBUG;TRACE + full + x86 + prompt + MinimumRecommendedRules.ruleset + false + false + + + ..\build.extra\x86\ + TRACE + true + pdbonly + x86 + prompt + MinimumRecommendedRules.ruleset + false + + + + + + + + + 4.0 + + + + + + + + + + MSBuild:Compile + Designer + + + + CKEditor.xaml + Code + + + + + + Code + + + True + True + Resources.resx + + + True + Settings.settings + True + + + ResXFileCodeGenerator + Resources.Designer.cs + + + Designer + + + SettingsSingleFileGenerator + Settings.Designer.cs + + + + + + + + + + + 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}. + + + + + + + + + + + + + \ No newline at end of file diff --git a/BrightSharp.Toolkit.Extra/CKEditor.xaml b/BrightSharp.Toolkit.Extra/CKEditor.xaml new file mode 100644 index 0000000..f6fb7f7 --- /dev/null +++ b/BrightSharp.Toolkit.Extra/CKEditor.xaml @@ -0,0 +1,14 @@ + + + + + + + + diff --git a/BrightSharp.Toolkit.Extra/CKEditor.xaml.cs b/BrightSharp.Toolkit.Extra/CKEditor.xaml.cs new file mode 100644 index 0000000..bda7d9e --- /dev/null +++ b/BrightSharp.Toolkit.Extra/CKEditor.xaml.cs @@ -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; + } + } + + +} diff --git a/BrightSharp.Toolkit.Extra/DesignTimeConfig.cs b/BrightSharp.Toolkit.Extra/DesignTimeConfig.cs new file mode 100644 index 0000000..21c37c1 --- /dev/null +++ b/BrightSharp.Toolkit.Extra/DesignTimeConfig.cs @@ -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; + } + } +} diff --git a/BrightSharp.Toolkit.Extra/LocalSchemeHandlerFactory.cs b/BrightSharp.Toolkit.Extra/LocalSchemeHandlerFactory.cs new file mode 100644 index 0000000..b1c1a21 --- /dev/null +++ b/BrightSharp.Toolkit.Extra/LocalSchemeHandlerFactory.cs @@ -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; + } + } +} \ No newline at end of file diff --git a/AppleJobs.Data/Properties/AssemblyInfo.cs b/BrightSharp.Toolkit.Extra/Properties/AssemblyInfo.cs similarity index 70% rename from AppleJobs.Data/Properties/AssemblyInfo.cs rename to BrightSharp.Toolkit.Extra/Properties/AssemblyInfo.cs index b72a3de..430d43e 100644 --- a/AppleJobs.Data/Properties/AssemblyInfo.cs +++ b/BrightSharp.Toolkit.Extra/Properties/AssemblyInfo.cs @@ -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("")] @@ -30,7 +30,16 @@ 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: // diff --git a/JetFrames.AppleJobs.Editor/Properties/Resources.Designer.cs b/BrightSharp.Toolkit.Extra/Properties/Resources.Designer.cs similarity index 60% rename from JetFrames.AppleJobs.Editor/Properties/Resources.Designer.cs rename to BrightSharp.Toolkit.Extra/Properties/Resources.Designer.cs index 855ffeb..e77e296 100644 --- a/JetFrames.AppleJobs.Editor/Properties/Resources.Designer.cs +++ b/BrightSharp.Toolkit.Extra/Properties/Resources.Designer.cs @@ -8,10 +8,10 @@ // //------------------------------------------------------------------------------ -namespace JetFrames.AppleJobs.Editor.Properties -{ - - +namespace BrightSharp.Toolkit.Extra.Properties { + using System; + + /// /// A strongly-typed resource class, for looking up localized strings, etc. /// @@ -22,50 +22,67 @@ 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() { } - + /// /// Returns the cached ResourceManager instance used by this class. /// [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; } } - + /// /// Overrides the current thread's CurrentUICulture property for all /// resource lookups using this strongly typed resource class. /// [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; } } + + /// + /// Looks up a localized string similar to <html xmlns="http://www.w3.org/1999/xhtml"> + ///<head> + /// <meta charset="utf-8" /> + /// <script src="https://cdn.ckeditor.com/4.6.0/standard/ckeditor.js"></script> + ///</head> + ///<body> + /// <div id="editor"> + /// $$CONTENT + /// </div> + /// <script> + /// CKEDITOR.editorConfig = function (config) { + /// config.scayt_autoStartup = false; + /// config.removePlugins = 'resize,scayt'; + /// config.disableNativeSpellChecker = false; + /// } + /// CKEDITOR.on('instanceReady', + /// [rest of string was truncated]";. + /// + internal static string HtmlEditor { + get { + return ResourceManager.GetString("HtmlEditor", resourceCulture); + } + } } } diff --git a/JetFrames.AppleJobs.Editor/Properties/Resources.resx b/BrightSharp.Toolkit.Extra/Properties/Resources.resx similarity index 84% rename from JetFrames.AppleJobs.Editor/Properties/Resources.resx rename to BrightSharp.Toolkit.Extra/Properties/Resources.resx index af7dbeb..b3ac70e 100644 --- a/JetFrames.AppleJobs.Editor/Properties/Resources.resx +++ b/BrightSharp.Toolkit.Extra/Properties/Resources.resx @@ -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. --> + @@ -68,9 +69,10 @@ - + + @@ -85,9 +87,10 @@ - + + @@ -109,9 +112,13 @@ 2.0 - System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + ..\resources\htmleditor.html;System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089;utf-8 + \ No newline at end of file diff --git a/JetFrames.AppleJobs.Editor/Properties/Settings.Designer.cs b/BrightSharp.Toolkit.Extra/Properties/Settings.Designer.cs similarity index 86% rename from JetFrames.AppleJobs.Editor/Properties/Settings.Designer.cs rename to BrightSharp.Toolkit.Extra/Properties/Settings.Designer.cs index 9fc9388..057337c 100644 --- a/JetFrames.AppleJobs.Editor/Properties/Settings.Designer.cs +++ b/BrightSharp.Toolkit.Extra/Properties/Settings.Designer.cs @@ -8,12 +8,12 @@ // //------------------------------------------------------------------------------ -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()))); diff --git a/BrightSharp.Toolkit.Extra/Properties/Settings.settings b/BrightSharp.Toolkit.Extra/Properties/Settings.settings new file mode 100644 index 0000000..033d7a5 --- /dev/null +++ b/BrightSharp.Toolkit.Extra/Properties/Settings.settings @@ -0,0 +1,7 @@ + + + + + + + \ No newline at end of file diff --git a/BrightSharp.Toolkit.Extra/Resources/HtmlEditor.html b/BrightSharp.Toolkit.Extra/Resources/HtmlEditor.html new file mode 100644 index 0000000..6110055 --- /dev/null +++ b/BrightSharp.Toolkit.Extra/Resources/HtmlEditor.html @@ -0,0 +1,33 @@ + + + + + + +
$$CONTENT
+ + + \ No newline at end of file diff --git a/BrightSharp.Toolkit.Extra/packages.config b/BrightSharp.Toolkit.Extra/packages.config new file mode 100644 index 0000000..d587668 --- /dev/null +++ b/BrightSharp.Toolkit.Extra/packages.config @@ -0,0 +1,7 @@ + + + + + + + \ No newline at end of file diff --git a/BrightSharp.Ui.Tests/App.config b/BrightSharp.Ui.Tests/App.config index 88fa402..d1428ad 100644 --- a/BrightSharp.Ui.Tests/App.config +++ b/BrightSharp.Ui.Tests/App.config @@ -1,6 +1,6 @@ - + - + - \ No newline at end of file + diff --git a/BrightSharp.Ui.Tests/BrightSharp.Ui.Tests.csproj b/BrightSharp.Ui.Tests/BrightSharp.Ui.Tests.csproj index 387178b..397c086 100644 --- a/BrightSharp.Ui.Tests/BrightSharp.Ui.Tests.csproj +++ b/BrightSharp.Ui.Tests/BrightSharp.Ui.Tests.csproj @@ -9,11 +9,12 @@ Properties BrightSharp.Ui.Tests BrightSharp.Ui.Tests - v4.5.2 + v4.5 512 {60dc8134-eba5-43b8-bcc9-bb4bc16c2548};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} 4 true + AnyCPU @@ -24,6 +25,7 @@ DEBUG;TRACE prompt 4 + false AnyCPU @@ -33,6 +35,7 @@ TRACE prompt 4 + false @@ -55,6 +58,10 @@ MSBuild:Compile Designer + + Designer + MSBuild:Compile + MSBuild:Compile Designer @@ -63,6 +70,9 @@ App.xaml Code + + CustomWindow.xaml + MainWindow.xaml diff --git a/BrightSharp.Ui.Tests/CustomWindow.xaml b/BrightSharp.Ui.Tests/CustomWindow.xaml new file mode 100644 index 0000000..b106d0c --- /dev/null +++ b/BrightSharp.Ui.Tests/CustomWindow.xaml @@ -0,0 +1,20 @@ + + + + + + + + + + diff --git a/JetFrames.AppleJobs.Editor/Views/Accessories.xaml.cs b/BrightSharp.Ui.Tests/CustomWindow.xaml.cs similarity index 67% rename from JetFrames.AppleJobs.Editor/Views/Accessories.xaml.cs rename to BrightSharp.Ui.Tests/CustomWindow.xaml.cs index 793063b..f18a6df 100644 --- a/JetFrames.AppleJobs.Editor/Views/Accessories.xaml.cs +++ b/BrightSharp.Ui.Tests/CustomWindow.xaml.cs @@ -10,18 +10,19 @@ 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 + /// + /// Interaction logic for CustomWindow.xaml + /// + public partial class CustomWindow : Window { - public Accessories() + public CustomWindow() { InitializeComponent(); - EditorViewModel.InitGrid(dg); } - + } } diff --git a/BrightSharp.Ui.Tests/ListViewItemModel.cs b/BrightSharp.Ui.Tests/ListViewItemModel.cs index 97bcd56..dd61d08 100644 --- a/BrightSharp.Ui.Tests/ListViewItemModel.cs +++ b/BrightSharp.Ui.Tests/ListViewItemModel.cs @@ -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 diff --git a/BrightSharp.Ui.Tests/MainWindow.xaml b/BrightSharp.Ui.Tests/MainWindow.xaml index ce37615..fa82983 100644 --- a/BrightSharp.Ui.Tests/MainWindow.xaml +++ b/BrightSharp.Ui.Tests/MainWindow.xaml @@ -4,135 +4,227 @@ 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"> + - - - - - - - - + + + + + + + + - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + +
+ + + + + + + +
+ +
+ + + + + + + +
+
+ + + + + + + + + + + + + + + + + + + + + + +
+
+
+
+ + + + + + + + + + + + (Some elements hidden by LODZoom extension) + + 1. Element use LODZoom Functionality A1-5 + 2. Element use LODZoom Functionality A -5.1 + 3. Element use LODZoom Functionality a 2-8.3 + 4. Element use LODZoom Functionality a 1.5- + 5. Element use LODZoom Functionality 1-5 + + + + + + + UseAnimation + + RenderZoom: + + + diff --git a/BrightSharp.Ui.Tests/MainWindow.xaml.cs b/BrightSharp.Ui.Tests/MainWindow.xaml.cs index 4c1ea23..a282ab4 100644 --- a/BrightSharp.Ui.Tests/MainWindow.xaml.cs +++ b/BrightSharp.Ui.Tests/MainWindow.xaml.cs @@ -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); + } + } } } diff --git a/BrightSharp.Ui.Tests/Properties/Resources.Designer.cs b/BrightSharp.Ui.Tests/Properties/Resources.Designer.cs index d35a73b..88c3cf2 100644 --- a/BrightSharp.Ui.Tests/Properties/Resources.Designer.cs +++ b/BrightSharp.Ui.Tests/Properties/Resources.Designer.cs @@ -8,10 +8,10 @@ // //------------------------------------------------------------------------------ -namespace BrightSharp.Ui.Tests.Properties -{ - - +namespace BrightSharp.Ui.Tests.Properties { + using System; + + /// /// A strongly-typed resource class, for looking up localized strings, etc. /// @@ -22,48 +22,40 @@ 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() { } - + /// /// Returns the cached ResourceManager instance used by this class. /// [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; } return resourceMan; } } - + /// /// Overrides the current thread's CurrentUICulture property for all /// resource lookups using this strongly typed resource class. /// [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; } } diff --git a/BrightSharp.Ui.Tests/Properties/Settings.Designer.cs b/BrightSharp.Ui.Tests/Properties/Settings.Designer.cs index d26b429..30f97d8 100644 --- a/BrightSharp.Ui.Tests/Properties/Settings.Designer.cs +++ b/BrightSharp.Ui.Tests/Properties/Settings.Designer.cs @@ -8,21 +8,17 @@ // //------------------------------------------------------------------------------ -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; } } diff --git a/BrightSharp.Ui.Tests/how_to_find_us.png b/BrightSharp.Ui.Tests/how_to_find_us.png new file mode 100644 index 0000000..ae8d1ab Binary files /dev/null and b/BrightSharp.Ui.Tests/how_to_find_us.png differ diff --git a/BrightSharp.sln b/BrightSharp.sln index 92398a7..dc19e5b 100644 --- a/BrightSharp.sln +++ b/BrightSharp.sln @@ -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 diff --git a/BrightSharp/BrightSharp.csproj b/BrightSharp/BrightSharp.csproj index 2624666..24aaaea 100644 --- a/BrightSharp/BrightSharp.csproj +++ b/BrightSharp/BrightSharp.csproj @@ -9,10 +9,11 @@ Properties BrightSharp BrightSharp - v4.5.2 + v4.5 512 {60dc8134-eba5-43b8-bcc9-bb4bc16c2548};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} 4 + true @@ -22,6 +23,7 @@ DEBUG;TRACE prompt 4 + false pdbonly @@ -30,6 +32,7 @@ TRACE prompt 4 + false @@ -40,7 +43,6 @@ - 4.0 @@ -52,11 +54,13 @@ + + @@ -127,9 +131,10 @@ - + + diff --git a/BrightSharp/Commands/AsyncCommand.cs b/BrightSharp/Commands/AsyncCommand.cs index 0e0c8e8..bd166d5 100644 --- a/BrightSharp/Commands/AsyncCommand.cs +++ b/BrightSharp/Commands/AsyncCommand.cs @@ -12,6 +12,10 @@ namespace BrightSharp.Commands private Action _onFail; private bool _isExecuting; + public AsyncCommand(Func execute) : this(p => execute?.Invoke()) + { + } + public AsyncCommand(Func execute) : this(execute, o => true) { } diff --git a/BrightSharp/Converters/StringHelpConverter.cs b/BrightSharp/Converters/StringHelpConverter.cs new file mode 100644 index 0000000..fd0dff9 --- /dev/null +++ b/BrightSharp/Converters/StringHelpConverter.cs @@ -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(); + } + } +} diff --git a/BrightSharp/Diagrams/Adorners/ResizeRotateAdorner.cs b/BrightSharp/Diagrams/Adorners/ResizeRotateAdorner.cs index dea7f1d..eb83507 100644 --- a/BrightSharp/Diagrams/Adorners/ResizeRotateAdorner.cs +++ b/BrightSharp/Diagrams/Adorners/ResizeRotateAdorner.cs @@ -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; diff --git a/BrightSharp/Diagrams/Adorners/ResizeRotateChrome.cs b/BrightSharp/Diagrams/Adorners/ResizeRotateChrome.cs index 2eda43e..99d814a 100644 --- a/BrightSharp/Diagrams/Adorners/ResizeRotateChrome.cs +++ b/BrightSharp/Diagrams/Adorners/ResizeRotateChrome.cs @@ -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() diff --git a/BrightSharp/Diagrams/Adorners/SizeAdorner.cs b/BrightSharp/Diagrams/Adorners/SizeAdorner.cs index 0236fdb..d91ce2f 100644 --- a/BrightSharp/Diagrams/Adorners/SizeAdorner.cs +++ b/BrightSharp/Diagrams/Adorners/SizeAdorner.cs @@ -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; diff --git a/BrightSharp/Diagrams/Adorners/SizeChrome.cs b/BrightSharp/Diagrams/Adorners/SizeChrome.cs index 04bcc63..22f068c 100644 --- a/BrightSharp/Diagrams/Adorners/SizeChrome.cs +++ b/BrightSharp/Diagrams/Adorners/SizeChrome.cs @@ -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() diff --git a/BrightSharp/Diagrams/DesignerItemDecorator.cs b/BrightSharp/Diagrams/DesignerItemDecorator.cs index fb9cc82..3febc28 100644 --- a/BrightSharp/Diagrams/DesignerItemDecorator.cs +++ b/BrightSharp/Diagrams/DesignerItemDecorator.cs @@ -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; diff --git a/BrightSharp/Diagrams/SelectionBehavior.cs b/BrightSharp/Diagrams/SelectionBehavior.cs index c85da65..85e6844 100644 --- a/BrightSharp/Diagrams/SelectionBehavior.cs +++ b/BrightSharp/Diagrams/SelectionBehavior.cs @@ -5,7 +5,7 @@ using System.Windows.Controls; using System.Windows.Controls.Primitives; using System; -namespace BrightSharp.Diagrams +namespace Diagrams { public static class SelectionBehavior { diff --git a/BrightSharp/Diagrams/Thumbs/MoveThumb.cs b/BrightSharp/Diagrams/Thumbs/MoveThumb.cs index 9027772..0883790 100644 --- a/BrightSharp/Diagrams/Thumbs/MoveThumb.cs +++ b/BrightSharp/Diagrams/Thumbs/MoveThumb.cs @@ -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; diff --git a/BrightSharp/Diagrams/Thumbs/ResizeThumb.cs b/BrightSharp/Diagrams/Thumbs/ResizeThumb.cs index df4a365..b9178c1 100644 --- a/BrightSharp/Diagrams/Thumbs/ResizeThumb.cs +++ b/BrightSharp/Diagrams/Thumbs/ResizeThumb.cs @@ -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; diff --git a/BrightSharp/Diagrams/Thumbs/RotateThumb.cs b/BrightSharp/Diagrams/Thumbs/RotateThumb.cs index 94eec14..dd076ba 100644 --- a/BrightSharp/Diagrams/Thumbs/RotateThumb.cs +++ b/BrightSharp/Diagrams/Thumbs/RotateThumb.cs @@ -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; diff --git a/BrightSharp/Diagrams/VisualExtensions.cs b/BrightSharp/Diagrams/VisualExtensions.cs new file mode 100644 index 0000000..df63bb6 --- /dev/null +++ b/BrightSharp/Diagrams/VisualExtensions.cs @@ -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 +{ + /// + /// If starts with a(A) then use animation, + /// $FromZoom-$ToZoom pattern + /// + 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(); + 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; } + } + } + +} diff --git a/BrightSharp/Generic.cs b/BrightSharp/Generic.cs index 66ffa37..7b41fc6 100644 --- a/BrightSharp/Generic.cs +++ b/BrightSharp/Generic.cs @@ -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; + } + } } diff --git a/BrightSharp/Generic.xaml b/BrightSharp/Generic.xaml index 6f3a9c2..7f80997 100644 --- a/BrightSharp/Generic.xaml +++ b/BrightSharp/Generic.xaml @@ -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"> @@ -757,7 +758,7 @@ - + @@ -780,7 +781,7 @@ - + @@ -813,7 +814,7 @@ - + @@ -855,7 +856,7 @@ - + @@ -1473,6 +1474,9 @@ - + + @@ -4380,7 +4384,7 @@ - + @@ -4652,6 +4656,8 @@ + + @@ -4675,7 +4681,7 @@ + + + + + + + + + + \ No newline at end of file diff --git a/BrightSharp/Mvvm/ViewModelBase.cs b/BrightSharp/Mvvm/ViewModelBase.cs index 438e106..515423a 100644 --- a/BrightSharp/Mvvm/ViewModelBase.cs +++ b/BrightSharp/Mvvm/ViewModelBase.cs @@ -59,11 +59,7 @@ namespace BrightSharp.Mvvm protected virtual void RaisePropertyChanged(Expression> propertyExpression) { - PropertyChangedEventHandler handler = PropertyChanged; - if(handler != null) - { - handler(this, new PropertyChangedEventArgs(GetPropertyName(propertyExpression))); - } + PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(GetPropertyName(propertyExpression))); } protected Boolean Set(Expression> propertyExpression, ref T field, T newValue) diff --git a/BrightSharp/Properties/AssemblyInfo.cs b/BrightSharp/Properties/AssemblyInfo.cs index 2559de7..1bb3d96 100644 --- a/BrightSharp/Properties/AssemblyInfo.cs +++ b/BrightSharp/Properties/AssemblyInfo.cs @@ -57,4 +57,9 @@ using System.Windows.Markup; [assembly: XmlnsPrefix("http://schemas.brightsharp.com/developer", "bs")] [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")] \ No newline at end of file +[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")] \ No newline at end of file diff --git a/BrightSharp/Properties/Resources.Designer.cs b/BrightSharp/Properties/Resources.Designer.cs index 15d4dd1..928ec85 100644 --- a/BrightSharp/Properties/Resources.Designer.cs +++ b/BrightSharp/Properties/Resources.Designer.cs @@ -9,6 +9,7 @@ //------------------------------------------------------------------------------ namespace BrightSharp.Properties { + using System; /// @@ -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; } diff --git a/BrightSharp/Properties/Settings.Designer.cs b/BrightSharp/Properties/Settings.Designer.cs index e7277ed..0e4f69e 100644 --- a/BrightSharp/Properties/Settings.Designer.cs +++ b/BrightSharp/Properties/Settings.Designer.cs @@ -8,21 +8,17 @@ // //------------------------------------------------------------------------------ -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; } } diff --git a/BrightSharp/ZoomControl.cs b/BrightSharp/ZoomControl.cs index c7a7889..d5cd917 100644 --- a/BrightSharp/ZoomControl.cs +++ b/BrightSharp/ZoomControl.cs @@ -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,13 +14,14 @@ namespace BrightSharp public ZoomControl() { Loaded += ZoomControl_Loaded; + } private void ZoomControl_Loaded(object sender, RoutedEventArgs e) { SelectionBehavior.Attach(this); } - + public ContentControl SelectedControl { get { return (ContentControl)GetValue(SelectedControlProperty); } @@ -206,5 +206,6 @@ namespace BrightSharp BeginAnimation(TranslateYProperty, null); } } + } } diff --git a/JetFrames.AppleJobs.Editor/App.config b/JetFrames.AppleJobs.Editor/App.config deleted file mode 100644 index 82297ec..0000000 --- a/JetFrames.AppleJobs.Editor/App.config +++ /dev/null @@ -1,33 +0,0 @@ - - - - -
- -
- - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/JetFrames.AppleJobs.Editor/App.xaml b/JetFrames.AppleJobs.Editor/App.xaml deleted file mode 100644 index 3c00a71..0000000 --- a/JetFrames.AppleJobs.Editor/App.xaml +++ /dev/null @@ -1,14 +0,0 @@ - - - - - - - - - - diff --git a/JetFrames.AppleJobs.Editor/EditorViewModel.cs b/JetFrames.AppleJobs.Editor/EditorViewModel.cs deleted file mode 100644 index 2f68d25..0000000 --- a/JetFrames.AppleJobs.Editor/EditorViewModel.cs +++ /dev/null @@ -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 _models; - public IEnumerable Models { get { return GetSingleton(ref _models, context.Models); } } - List _categories; - public IEnumerable Categories { get { return GetSingleton(ref _categories, context.ModelCategories); } } - private List _news; - public IEnumerable News { get { return GetSingleton(ref _news, context.News); } } - private List _newsCategories; - public IEnumerable NewsCategories { get { return GetSingleton(ref _newsCategories, context.NewsCategories); } } - List _modelJobPriceTemplates; - public IEnumerable ModelJobPriceTemplates - { - get - { - ModelJobs.Count(); - return GetSingleton(ref _modelJobPriceTemplates, context.ModelJobPriceTemplates); - } - } - List _modelJobs; - public IEnumerable ModelJobs { get { context.Models.Load(); return GetSingleton(ref _modelJobs, context.ModelJobs); } } - List _orders; - public IEnumerable Orders { get { return GetSingleton(ref _orders, context.Orders.OrderByDescending(o => o.DateCreated).Take(2000)); } } - List _orderStatuses; - public IEnumerable OrderStatuses { get { return GetSingleton(ref _orderStatuses, context.OrderStatuses); } } - List _accessories; - public IEnumerable Accessories { get { return GetSingleton(ref _accessories, context.Accessories); } } - List _employees; - public IEnumerable 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(); - 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(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 GetSingleton(ref List entities, IQueryable 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; - } - } -} diff --git a/JetFrames.AppleJobs.Editor/JetFrames.AppleJobs.Editor.csproj b/JetFrames.AppleJobs.Editor/JetFrames.AppleJobs.Editor.csproj deleted file mode 100644 index 84b13c1..0000000 --- a/JetFrames.AppleJobs.Editor/JetFrames.AppleJobs.Editor.csproj +++ /dev/null @@ -1,219 +0,0 @@ - - - - - Debug - AnyCPU - {FD3E36B5-444A-4115-B288-6C924BEA0BD3} - WinExe - Properties - JetFrames.AppleJobs.Editor - JetFrames.AppleJobs.Editor - v4.5.2 - 512 - {60dc8134-eba5-43b8-bcc9-bb4bc16c2548};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} - 4 - true - - - AnyCPU - true - full - false - bin\Debug\ - DEBUG;TRACE - prompt - 4 - - - AnyCPU - pdbonly - true - bin\Release\ - TRACE - prompt - 4 - - - appleicon.ico - - - - ..\packages\EntityFramework.6.1.0\lib\net45\EntityFramework.dll - True - - - ..\packages\EntityFramework.6.1.0\lib\net45\EntityFramework.SqlServer.dll - True - - - ..\packages\Microsoft.AspNet.Identity.Core.2.2.1\lib\net45\Microsoft.AspNet.Identity.Core.dll - True - - - ..\packages\Microsoft.AspNet.Identity.EntityFramework.2.2.1\lib\net45\Microsoft.AspNet.Identity.EntityFramework.dll - True - - - - ..\packages\MySql.Data.6.9.9\lib\net45\MySql.Data.dll - True - - - ..\packages\MySql.Data.Entity.6.9.9\lib\net45\MySql.Data.Entity.EF6.dll - True - - - - - - - - - - - - - 4.0 - - - - - - - - MSBuild:Compile - Designer - - - - - - Accessories.xaml - - - ModelCategories.xaml - - - ModelJobPriceTemplates.xaml - - - ModelJobs.xaml - - - Models.xaml - - - NewPriceTemplateDialog.xaml - - - News.xaml - - - NewsCategories.xaml - - - Orders.xaml - - - MSBuild:Compile - Designer - - - App.xaml - Code - - - MainWindow.xaml - Code - - - Designer - MSBuild:Compile - - - Designer - MSBuild:Compile - - - Designer - MSBuild:Compile - - - Designer - MSBuild:Compile - - - Designer - MSBuild:Compile - - - Designer - MSBuild:Compile - - - Designer - MSBuild:Compile - - - Designer - MSBuild:Compile - - - Designer - MSBuild:Compile - - - - - Code - - - True - True - Resources.resx - - - True - Settings.settings - True - - - ResXFileCodeGenerator - Resources.Designer.cs - - - - PublicSettingsSingleFileGenerator - Settings.Designer.cs - - - - - - - - - {b4695c76-31ff-4bf1-9dc6-1bc62d374091} - AppleJobs.Data - - - {acc3c556-f8e4-4f2a-a23d-8e8749679a1b} - BrightSharp - - - - - - - - - - - \ No newline at end of file diff --git a/JetFrames.AppleJobs.Editor/MainWindow.xaml b/JetFrames.AppleJobs.Editor/MainWindow.xaml deleted file mode 100644 index 99a812f..0000000 --- a/JetFrames.AppleJobs.Editor/MainWindow.xaml +++ /dev/null @@ -1,228 +0,0 @@ - - - - - - - - - - - - - Фильтрация - - - - - - - - - - - - - - - Фильтрация - - - - - - - - - - - - - - - Фильтрация - - - - - - - - - - - - - - - Фильтрация - - - - - - - - - - - - - - - Фильтрация - - - - - - - - - - - - - - - - Фильтрация - - - - - - - - - - - - - - - Фильтрация - - - - - - - - - - - - - - - Фильтрация - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/JetFrames.AppleJobs.Editor/MainWindow.xaml.cs b/JetFrames.AppleJobs.Editor/MainWindow.xaml.cs deleted file mode 100644 index f2a94cd..0000000 --- a/JetFrames.AppleJobs.Editor/MainWindow.xaml.cs +++ /dev/null @@ -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 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; - } - } - } -} diff --git a/JetFrames.AppleJobs.Editor/Properties/Settings.settings b/JetFrames.AppleJobs.Editor/Properties/Settings.settings deleted file mode 100644 index 8e615f2..0000000 --- a/JetFrames.AppleJobs.Editor/Properties/Settings.settings +++ /dev/null @@ -1,5 +0,0 @@ - - - - - \ No newline at end of file diff --git a/JetFrames.AppleJobs.Editor/ViewModelLocator.cs b/JetFrames.AppleJobs.Editor/ViewModelLocator.cs deleted file mode 100644 index 350a8ed..0000000 --- a/JetFrames.AppleJobs.Editor/ViewModelLocator.cs +++ /dev/null @@ -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; } - - } -} diff --git a/JetFrames.AppleJobs.Editor/ViewModels/NewPriceTemplateVm.cs b/JetFrames.AppleJobs.Editor/ViewModels/NewPriceTemplateVm.cs deleted file mode 100644 index 5492c99..0000000 --- a/JetFrames.AppleJobs.Editor/ViewModels/NewPriceTemplateVm.cs +++ /dev/null @@ -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 modelJobPriceTemplates; - private readonly IEnumerable modelJobs; - - public NewPriceTemplateVm(IEnumerable models, IEnumerable modelJobs, IEnumerable modelJobPriceTemplates, - Action 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 Models { get; private set; } - - public IEnumerable 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; - } - } -} diff --git a/JetFrames.AppleJobs.Editor/Views/Accessories.xaml b/JetFrames.AppleJobs.Editor/Views/Accessories.xaml deleted file mode 100644 index d0fca06..0000000 --- a/JetFrames.AppleJobs.Editor/Views/Accessories.xaml +++ /dev/null @@ -1,17 +0,0 @@ - - - - - - - - - diff --git a/JetFrames.AppleJobs.Editor/Views/ModelCategories.xaml b/JetFrames.AppleJobs.Editor/Views/ModelCategories.xaml deleted file mode 100644 index 2667c13..0000000 --- a/JetFrames.AppleJobs.Editor/Views/ModelCategories.xaml +++ /dev/null @@ -1,17 +0,0 @@ - - - - - - - - - diff --git a/JetFrames.AppleJobs.Editor/Views/ModelCategories.xaml.cs b/JetFrames.AppleJobs.Editor/Views/ModelCategories.xaml.cs deleted file mode 100644 index 5c838ee..0000000 --- a/JetFrames.AppleJobs.Editor/Views/ModelCategories.xaml.cs +++ /dev/null @@ -1,17 +0,0 @@ -using System.Windows.Controls; -using System.Windows.Input; - -namespace JetFrames.AppleJobs.Editor.Views -{ - /// - /// Interaction logic for ModelCategories.xaml - /// - public partial class ModelCategories : UserControl - { - public ModelCategories() - { - InitializeComponent(); - EditorViewModel.InitGrid(dg); - } - } -} diff --git a/JetFrames.AppleJobs.Editor/Views/ModelJobPriceTemplates.xaml b/JetFrames.AppleJobs.Editor/Views/ModelJobPriceTemplates.xaml deleted file mode 100644 index 55a2c22..0000000 --- a/JetFrames.AppleJobs.Editor/Views/ModelJobPriceTemplates.xaml +++ /dev/null @@ -1,29 +0,0 @@ - - - - - - - - - - - - - - diff --git a/JetFrames.AppleJobs.Editor/Views/ModelJobPriceTemplates.xaml.cs b/JetFrames.AppleJobs.Editor/Views/ModelJobPriceTemplates.xaml.cs deleted file mode 100644 index b5a41e2..0000000 --- a/JetFrames.AppleJobs.Editor/Views/ModelJobPriceTemplates.xaml.cs +++ /dev/null @@ -1,16 +0,0 @@ -using System.Windows.Controls; - -namespace JetFrames.AppleJobs.Editor.Views -{ - /// - /// Interaction logic for ModelJobPriceTemplates.xaml - /// - public partial class ModelJobPriceTemplates : UserControl - { - public ModelJobPriceTemplates() - { - InitializeComponent(); - EditorViewModel.InitGrid(dg); - } - } -} diff --git a/JetFrames.AppleJobs.Editor/Views/ModelJobs.xaml b/JetFrames.AppleJobs.Editor/Views/ModelJobs.xaml deleted file mode 100644 index a82d71b..0000000 --- a/JetFrames.AppleJobs.Editor/Views/ModelJobs.xaml +++ /dev/null @@ -1,26 +0,0 @@ - - - - - - - - - - - - - - diff --git a/JetFrames.AppleJobs.Editor/Views/ModelJobs.xaml.cs b/JetFrames.AppleJobs.Editor/Views/ModelJobs.xaml.cs deleted file mode 100644 index a912f5f..0000000 --- a/JetFrames.AppleJobs.Editor/Views/ModelJobs.xaml.cs +++ /dev/null @@ -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 -{ - /// - /// Interaction logic for ModelJobs.xaml - /// - public partial class ModelJobs : UserControl - { - public ModelJobs() - { - InitializeComponent(); - EditorViewModel.InitGrid(dg); - } - } -} diff --git a/JetFrames.AppleJobs.Editor/Views/Models.xaml b/JetFrames.AppleJobs.Editor/Views/Models.xaml deleted file mode 100644 index e1d9f5c..0000000 --- a/JetFrames.AppleJobs.Editor/Views/Models.xaml +++ /dev/null @@ -1,22 +0,0 @@ - - - - - - - - - - diff --git a/JetFrames.AppleJobs.Editor/Views/Models.xaml.cs b/JetFrames.AppleJobs.Editor/Views/Models.xaml.cs deleted file mode 100644 index 241b4f7..0000000 --- a/JetFrames.AppleJobs.Editor/Views/Models.xaml.cs +++ /dev/null @@ -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 -{ - /// - /// Interaction logic for Models.xaml - /// - public partial class Models : UserControl - { - public Models() - { - InitializeComponent(); - EditorViewModel.InitGrid(dg); - } - } -} diff --git a/JetFrames.AppleJobs.Editor/Views/NewPriceTemplateDialog.xaml b/JetFrames.AppleJobs.Editor/Views/NewPriceTemplateDialog.xaml deleted file mode 100644 index a429eaa..0000000 --- a/JetFrames.AppleJobs.Editor/Views/NewPriceTemplateDialog.xaml +++ /dev/null @@ -1,29 +0,0 @@ - - - - - - - - - - - - - - -