Add Outlook Inspired and Stock Market demos

This commit is contained in:
maxerokh
2018-12-13 18:49:44 +03:00
parent b5cab35919
commit 2e45b5d38f
833 changed files with 124450 additions and 47 deletions

359
.gitignore vendored
View File

@@ -1,52 +1,319 @@
# Prerequisites
*.d
## Ignore Visual Studio temporary files, build results, and
## files generated by popular Visual Studio add-ons.
##
## Get latest from https://github.com/github/gitignore/blob/master/VisualStudio.gitignore
# Object files
*.o
*.ko
*.obj
*.elf
# User-specific files
*.rsuser
*.suo
*.user
*.userosscache
*.sln.docstates
# Linker output
# User-specific files (MonoDevelop/Xamarin Studio)
*.userprefs
# Build results
[Dd]ebug/
[Dd]ebugPublic/
[Rr]elease/
[Rr]eleases/
x64/
x86/
[Aa][Rr][Mm]/
[Aa][Rr][Mm]64/
bld/
[Bb]in/
[Oo]bj/
[Ll]og/
# Visual Studio 2015/2017 cache/options directory
.vs/
# Uncomment if you have tasks that create the project's static files in wwwroot
#wwwroot/
# Visual Studio 2017 auto generated files
Generated\ Files/
# MSTest test Results
[Tt]est[Rr]esult*/
[Bb]uild[Ll]og.*
# NUNIT
*.VisualState.xml
TestResult.xml
# Build Results of an ATL Project
[Dd]ebugPS/
[Rr]eleasePS/
dlldata.c
# Benchmark Results
BenchmarkDotNet.Artifacts/
# .NET Core
project.lock.json
project.fragment.lock.json
artifacts/
# StyleCop
StyleCopReport.xml
# Files built by Visual Studio
*_i.c
*_p.c
*_h.h
*.ilk
*.map
*.exp
# Precompiled Headers
*.gch
*.meta
*.obj
*.iobj
*.pch
# Libraries
*.lib
*.a
*.la
*.lo
# Shared objects (inc. Windows DLLs)
*.dll
*.so
*.so.*
*.dylib
# Executables
*.exe
*.out
*.app
*.i*86
*.x86_64
*.hex
# Debug files
*.dSYM/
*.su
*.idb
*.pdb
*.ipdb
*.pgc
*.pgd
*.rsp
*.sbr
*.tlb
*.tli
*.tlh
*.tmp
*.tmp_proj
*_wpftmp.csproj
*.log
*.vspscc
*.vssscc
.builds
*.pidb
*.svclog
*.scc
# Kernel Module Compile Results
*.mod*
*.cmd
.tmp_versions/
modules.order
Module.symvers
Mkfile.old
dkms.conf
# Chutzpah Test files
_Chutzpah*
# Visual C++ cache files
ipch/
*.aps
*.ncb
*.opendb
*.opensdf
*.sdf
*.cachefile
*.VC.db
*.VC.VC.opendb
# Visual Studio profiler
*.psess
*.vsp
*.vspx
*.sap
# Visual Studio Trace Files
*.e2e
# TFS 2012 Local Workspace
$tf/
# Guidance Automation Toolkit
*.gpState
# ReSharper is a .NET coding add-in
_ReSharper*/
*.[Rr]e[Ss]harper
*.DotSettings.user
# JustCode is a .NET coding add-in
.JustCode
# TeamCity is a build add-in
_TeamCity*
# DotCover is a Code Coverage Tool
*.dotCover
# AxoCover is a Code Coverage Tool
.axoCover/*
!.axoCover/settings.json
# Visual Studio code coverage results
*.coverage
*.coveragexml
# NCrunch
_NCrunch_*
.*crunch*.local.xml
nCrunchTemp_*
# MightyMoose
*.mm.*
AutoTest.Net/
# Web workbench (sass)
.sass-cache/
# Installshield output folder
[Ee]xpress/
# DocProject is a documentation generator add-in
DocProject/buildhelp/
DocProject/Help/*.HxT
DocProject/Help/*.HxC
DocProject/Help/*.hhc
DocProject/Help/*.hhk
DocProject/Help/*.hhp
DocProject/Help/Html2
DocProject/Help/html
# Click-Once directory
publish/
# Publish Web Output
*.[Pp]ublish.xml
*.azurePubxml
# Note: Comment the next line if you want to checkin your web deploy settings,
# but database connection strings (with potential passwords) will be unencrypted
*.pubxml
*.publishproj
# Microsoft Azure Web App publish settings. Comment the next line if you want to
# checkin your Azure Web App publish settings, but sensitive information contained
# in these scripts will be unencrypted
PublishScripts/
# NuGet Packages
*.nupkg
# The packages folder can be ignored because of Package Restore
**/[Pp]ackages/*
# except build/, which is used as an MSBuild target.
!**/[Pp]ackages/build/
# Uncomment if necessary however generally it will be regenerated when needed
#!**/[Pp]ackages/repositories.config
# NuGet v3's project.json files produces more ignorable files
*.nuget.props
*.nuget.targets
# Microsoft Azure Build Output
csx/
*.build.csdef
# Microsoft Azure Emulator
ecf/
rcf/
# Windows Store app package directories and files
AppPackages/
BundleArtifacts/
Package.StoreAssociation.xml
_pkginfo.txt
*.appx
# Visual Studio cache files
# files ending in .cache can be ignored
*.[Cc]ache
# but keep track of directories ending in .cache
!*.[Cc]ache/
# Others
ClientBin/
~$*
*~
*.dbmdl
*.dbproj.schemaview
*.jfm
*.pfx
*.publishsettings
orleans.codegen.cs
# Backup & report files from converting an old project file
# to a newer Visual Studio version. Backup files are not needed,
# because we have git ;-)
_UpgradeReport_Files/
Backup*/
UpgradeLog*.XML
UpgradeLog*.htm
ServiceFabricBackup/
*.rptproj.bak
# SQL Server files
*.mdf
*.ldf
*.ndf
# Business Intelligence projects
*.rdl.data
*.bim.layout
*.bim_*.settings
*.rptproj.rsuser
# Microsoft Fakes
FakesAssemblies/
# GhostDoc plugin setting file
*.GhostDoc.xml
# Node.js Tools for Visual Studio
.ntvs_analysis.dat
node_modules/
# Visual Studio 6 build log
*.plg
# Visual Studio 6 workspace options file
*.opt
# Visual Studio 6 auto-generated workspace file (contains which files were open etc.)
*.vbw
# Visual Studio LightSwitch build output
**/*.HTMLClient/GeneratedArtifacts
**/*.DesktopClient/GeneratedArtifacts
**/*.DesktopClient/ModelManifest.xml
**/*.Server/GeneratedArtifacts
**/*.Server/ModelManifest.xml
_Pvt_Extensions
# Paket dependency manager
.paket/paket.exe
paket-files/
# FAKE - F# Make
.fake/
# JetBrains Rider
.idea/
*.sln.iml
# CodeRush personal settings
.cr/personal
# Cake - Uncomment if you are using it
# tools/**
# !tools/packages.config
# Tabs Studio
*.tss
# Telerik's JustMock configuration file
*.jmconfig
# BizTalk build output
*.btp.cs
*.btm.cs
*.odx.cs
*.xsd.cs
# OpenCover UI analysis results
OpenCover/
# Azure Stream Analytics local run output
ASALocalRun/
# MSBuild Binary and Structured Log
*.binlog
# MFractors (Xamarin productivity tool) working folder
.mfractor/
# Local History for Visual Studio
.localhistory/

6
NuGet.config Normal file
View File

@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<packageSources>
<add key="DevExpress-Early-Access" value="https://nuget.devexpress.com/early-access/api/" />
</packageSources>
</configuration>

View File

@@ -0,0 +1 @@
ABCDEFGHIJKLMNOPQRSTUVWXYZ

Binary file not shown.

View File

@@ -0,0 +1,56 @@
using System;
using System.ComponentModel;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using DevExpress.Common;
using DevExpress.DataAnnotations;
namespace DevExpress.DevAV {
[NotMapped]
public partial class Address : IDataErrorInfo {
[Display(Name = "Address")]
public string Line { get; set; }
public string City { get; set; }
public StateEnum State { get; set; }
[ZipCode, Display(Name = "Zip code")]
public string ZipCode { get; set; }
public double Latitude { get; set; }
public double Longitude { get; set; }
public string CityLine {
get { return GetCityLine(City, State, ZipCode); }
}
public override string ToString() {
return string.Format("{0}, {1}", Line, CityLine);
}
#region IDataErrorInfo
string IDataErrorInfo.Error { get { return null; } }
string IDataErrorInfo.this[string columnName] {
get { return IDataErrorInfoHelper.GetErrorText(this, columnName); }
}
#endregion
internal static string GetCityLine(string city, StateEnum state, string zipCode) {
return string.Format("{0}, {1} {2}", city, state, zipCode);
}
}
public static class AddressHelper {
public static Address DevAVHomeOffice { get { return devAVHomeOffice; } }
static Address devAVHomeOffice = new Address {
City = "Glendale",
Line = "505 N. Brand Blvd",
State = StateEnum.CA,
ZipCode = "91203",
Latitude = 34.1532866,
Longitude = -118.2555815
};
public static void UpdateAddress(Address address, string line, string city, StateEnum state, string zipCode, double latitude, double longtitude){
address.Line = line;
address.City = city;
address.State = state;
address.ZipCode = zipCode;
address.Latitude = latitude;
address.Longitude = longtitude;
}
}
}

View File

@@ -0,0 +1,13 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace DevExpress.DevAV {
public class TaskAttachedFile : DatabaseObject {
public virtual EmployeeTask EmployeeTask { get; set; }
public long? EmployeeTaskId { get; set; }
public string Name { get; set; }
public byte[] Content { get; set; }
}
}

View File

@@ -0,0 +1,37 @@
using System.ComponentModel;
using System.ComponentModel.DataAnnotations;
using System.Linq;
using System.Reflection;
namespace DevExpress.Common {
public static class IDataErrorInfoHelper {
public static string GetErrorText(object owner, string propertyName) {
string[] path = propertyName.Split('.');
if(path.Length > 1)
return GetErrorText(owner, path);
PropertyInfo propertyInfo = owner.GetType().GetProperty(propertyName);
if (propertyInfo == null) return null;
object propertyValue = propertyInfo.GetValue(owner, null);
ValidationContext validationContext = new ValidationContext(owner, null, null) { MemberName = propertyName };
string[] errors = propertyInfo
.GetCustomAttributes(false)
.OfType<ValidationAttribute>()
.Select(x => x.GetValidationResult(propertyValue, validationContext))
.Where(x => x != null)
.Select(x => x.ErrorMessage)
.Where(x => !string.IsNullOrEmpty(x))
.ToArray();
return string.Join(" ", errors);
}
static string GetErrorText(object owner, string[] path) {
string nestedPropertyName = string.Join(".", path.Skip(1));
string propertyName = path[0];
PropertyInfo propertyInfo = owner.GetType().GetProperty(propertyName);
if(propertyInfo == null)
return null;
object propertyValue = propertyInfo.GetValue(owner, null);
IDataErrorInfo nestedDataErrorInfo = propertyValue as IDataErrorInfo;
return nestedDataErrorInfo == null ? string.Empty : nestedDataErrorInfo[nestedPropertyName];
}
}
}

View File

@@ -0,0 +1,77 @@
using System;
using System.Collections;
using System.Collections.Generic;
using System.ComponentModel;
using System.ComponentModel.DataAnnotations;
using System.Globalization;
using System.Linq;
using System.Linq.Expressions;
using System.Reflection;
using System.Reflection.Emit;
using System.Resources;
using System.Security;
using System.Text;
using System.Text.RegularExpressions;
// This demo targets .NET Framework 4.0. A number of validation attributes that exist in .NET Framework 4.5 cannot be used.
// That is why we have created our own counterparts of these attributes for this demo.
// If your application targets .NET Framework 4.5, use default validation attributes.
// If your application targets .NET Framework 4.0, you can copy and use these attributes or use DevExpress Validation Fluent API instead.
namespace DevExpress.DataAnnotations {
public abstract class RegexAttributeBase : DataTypeAttribute {
protected const RegexOptions DefaultRegexOptions = RegexOptions.Compiled | RegexOptions.ExplicitCapture | RegexOptions.IgnoreCase;
readonly Regex regex;
public RegexAttributeBase(string regex, string defaultErrorMessage, DataType dataType)
: this(new Regex(regex, DefaultRegexOptions), defaultErrorMessage, dataType) {
}
public RegexAttributeBase(Regex regex, string defaultErrorMessage, DataType dataType)
: base(dataType) {
this.regex = (Regex)regex;
this.ErrorMessage = defaultErrorMessage;
}
public sealed override bool IsValid(object value) {
if(value == null)
return true;
string input = value as string;
return input != null && regex.Match(input).Length > 0;
}
}
public sealed class ZipCodeAttribute : RegexAttributeBase {
static Regex regex = new Regex(@"^[0-9][0-9][0-9][0-9][0-9]$", DefaultRegexOptions);
const string Message = "The {0} field is not a valid ZIP code.";
public ZipCodeAttribute()
: base(regex, Message, DataType.Url) {
}
}
public sealed class CreditCardAttribute : DataTypeAttribute {
const string Message = "The {0} field is not a valid credit card number.";
public CreditCardAttribute()
: base(DataType.Custom) {
this.ErrorMessage = Message;
}
public override bool IsValid(object value) {
if(value == null)
return true;
string stringValue = value as string;
if(stringValue == null)
return false;
stringValue = stringValue.Replace("-", "").Replace(" ", "");
int number = 0;
bool oddEvenFlag = false;
foreach(char ch in stringValue.Reverse()) {
if(ch < '0' || ch > '9')
return false;
int digitValue = (ch - '0') * (oddEvenFlag ? 2 : 1);
oddEvenFlag = !oddEvenFlag;
while(digitValue > 0) {
number += digitValue % 10;
digitValue = digitValue / 10;
}
}
return (number % 10) == 0;
}
}
}

View File

@@ -0,0 +1,55 @@
using System;
using System.Collections.Generic;
using System.Drawing;
using System.IO;
using System.Text;
namespace DevExpress.DevAV
{
public class DevAVByteImageConverter
{
public static Image FromByteArray(byte[] b)
{
if (b == null || b.Length == 0) return null;
Image i = null;
if (b.Length > 78)
{
if (b[0] == 0x15 && b[1] == 0x1c) //check signature
i = FromByteArray(b, 78);
}
if (i == null)
i = FromByteArray(b, 0);
return i;
}
protected static Image FromByteArray(byte[] b, int offset)
{
if (b == null || b.Length - offset <= 0) return null;
Image tempI = null;
System.IO.MemoryStream s = new System.IO.MemoryStream(b, offset, (int)b.Length - offset);
try
{
tempI = ImageFromStream(s);
}
catch { }
//s.Close();
return tempI;
}
static Image ImageFromStream(Stream stream)
{
if (Object.ReferenceEquals(stream, null))
return null;
//if (!IsWin7 || !IsUnmanagedCodeGranted)
// return Image.FromStream(stream);
//else
return Image.FromStream(stream, false, false);
}
static bool IsWin7 {
get {
Version version = Environment.OSVersion.Version;
return (version.Major == 6 && version.Minor >= 1) || version.Major > 6;
}
}
}
}

View File

@@ -0,0 +1,26 @@
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations.Schema;
using System.Drawing;
using System.Linq;
using System.Runtime.Serialization;
namespace DevExpress.DevAV {
public class Crest : DatabaseObject {
public string CityName { get; set; }
public byte[] SmallImage { get; set; }
public byte[] LargeImage { get; set; }
public virtual ICollection<CustomerStore> CustomerStores { get; set; }
Image img;
public Image LargeImageEx {
get {
if (img == null)
if (LargeImage == null)
return null; //ResourceImageHelper.CreateImageFromResourcesEx("DevExpress.DevAV.Resources.Unknown-user.png", typeof(Employee).Assembly);
else
img = DevAVByteImageConverter.FromByteArray(LargeImage);
return img;
}
}
}
}

View File

@@ -0,0 +1,107 @@
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using System.Drawing;
namespace DevExpress.DevAV {
public enum CustomerStatus {
Active,
Suspended
}
public partial class Customer : DatabaseObject {
public Customer() {
Employees = new List<CustomerEmployee>();
Orders = new List<Order>();
_homeOffice = new Address();
_billingAddress = new Address();
}
[Required]
public string Name { get; set; }
Address _homeOffice;
[NotMapped]
public Address HomeOffice {
get {
AddressHelper.UpdateAddress(_homeOffice, HomeOffice_Line, HomeOffice_City, HomeOffice_State, HomeOffice_ZipCode, HomeOffice_Latitude, HomeOffice_Longitude);
return _homeOffice;
}
set {
AddressHelper.UpdateAddress(_homeOffice, value.Line, value.City, value.State, value.ZipCode, value.Latitude, value.Longitude);
HomeOffice_Line = _homeOffice.Line;
HomeOffice_City = _homeOffice.City;
HomeOffice_State = _homeOffice.State;
HomeOffice_ZipCode = _homeOffice.ZipCode;
HomeOffice_Latitude = _homeOffice.Latitude;
HomeOffice_Longitude = _homeOffice.Longitude;
}
}
Address _billingAddress;
[NotMapped]
public Address BillingAddress {
get {
AddressHelper.UpdateAddress(_billingAddress, BillingAddress_Line, BillingAddress_City, BillingAddress_State, BillingAddress_ZipCode, BillingAddress_Latitude, BillingAddress_Longitude);
return _billingAddress;
}
set {
AddressHelper.UpdateAddress(_billingAddress, value.Line, value.City, value.State, value.ZipCode, value.Latitude, value.Longitude);
BillingAddress_Line = _billingAddress.Line;
BillingAddress_City = _billingAddress.City;
BillingAddress_State = _billingAddress.State;
BillingAddress_ZipCode = _billingAddress.ZipCode;
BillingAddress_Latitude = _billingAddress.Latitude;
BillingAddress_Longitude = _billingAddress.Longitude;
}
}
#region EFCore
public string HomeOffice_Line { get; set; }
public string HomeOffice_City { get; set; }
public StateEnum HomeOffice_State { get; set; }
public string HomeOffice_ZipCode { get; set; }
public double HomeOffice_Latitude { get; set; }
public double HomeOffice_Longitude { get; set; }
public string BillingAddress_Line { get; set; }
public string BillingAddress_City { get; set; }
public StateEnum BillingAddress_State { get; set; }
public string BillingAddress_ZipCode { get; set; }
public double BillingAddress_Latitude { get; set; }
public double BillingAddress_Longitude { get; set; }
#endregion
public virtual List<CustomerEmployee> Employees { get; set; }
[Phone]
public string Phone { get; set; }
[Phone]
public string Fax { get; set; }
[Url]
public string Website { get; set; }
[DataType(DataType.Currency)]
public decimal AnnualRevenue { get; set; }
[Display(Name = "Total Stores")]
public int TotalStores { get; set; }
[Display(Name = "Total Employees")]
public int TotalEmployees { get; set; }
public CustomerStatus Status { get; set; }
[InverseProperty("Customer")]
public virtual List<Order> Orders { get; set; }
[InverseProperty("Customer")]
public virtual List<Quote> Quotes { get; set; }
[InverseProperty("Customer")]
public virtual List<CustomerStore> CustomerStores { get; set; }
public virtual string Profile { get; set; }
public byte[] Logo { get; set; }
Image img = null;
public Image Image {
get {
if(img == null)
img = CreateImage(Logo);
return img;
}
}
internal static Image CreateImage(byte[] data) {
if (data == null)
return null;// ResourceImageHelper.CreateImageFromResourcesEx("DevExpress.DevAV.Resources.Unknown-user.png", typeof(Employee).Assembly);
else
return DevAVByteImageConverter.FromByteArray(data);
}
}
}

View File

@@ -0,0 +1,17 @@
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations.Schema;
using System.Linq;
using System.Runtime.Serialization;
namespace DevExpress.DevAV {
public class CustomerCommunication : DatabaseObject {
public virtual Employee Employee { get; set; }
public long? EmployeeId { get; set; }
public virtual CustomerEmployee CustomerEmployee { get; set; }
public long? CustomerEmployeeId { get; set; }
public DateTime Date { get; set; }
public string Type { get; set; }
public string Purpose { get; set; }
}
}

View File

@@ -0,0 +1,53 @@
using System;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using System.Drawing;
using System.Runtime.Serialization;
using DevExpress.DataAnnotations;
using System.Collections.Generic;
namespace DevExpress.DevAV {
public class CustomerEmployee : DatabaseObject {
[Required, Display(Name = "First Name")]
public string FirstName { get; set; }
[Required, Display(Name = "Last Name")]
public string LastName { get; set; }
[Display(Name = "Full Name")]
public string FullName { get; set; }
public PersonPrefix Prefix { get; set; }
[Required, Phone, Display(Name = "Mobile Phone")]
public string MobilePhone { get; set; }
[Required, EmailAddress]
public string Email { get; set; }
public virtual Picture Picture { get; set; }
public long? PictureId { get; set; }
public virtual Customer Customer { get; set; }
public long? CustomerId { get; set; }
public virtual CustomerStore CustomerStore { get; set; }
public long? CustomerStoreId { get; set; }
public string Position { get; set; }
public bool IsPurchaseAuthority { get; set; }
public virtual ICollection<CustomerCommunication> CustomerCommunications { get; set; }
public Address Address {
get { return (CustomerStore != null) ? CustomerStore.Address : null; }
set { }
}
public virtual ICollection<EmployeeTask> EmployeeTasks { get; set; }
Image _photo = null;
[NotMapped]
public Image Photo {
get {
if(_photo == null)
_photo = Picture.CreateImage();
return _photo;
}
set {
_photo = value;
Picture = PictureExtension.FromImage(value);
}
}
public override string ToString() {
return FullName;
}
}
}

View File

@@ -0,0 +1,89 @@
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations.Schema;
using System.Drawing;
using System.Linq;
using System.ComponentModel.DataAnnotations;
namespace DevExpress.DevAV {
public class CustomerStore : DatabaseObject {
public CustomerStore() {
_address = new Address();
}
public virtual Customer Customer { get; set; }
public long? CustomerId { get; set; }
Address _address;
[NotMapped]
public Address Address {
get {
AddressHelper.UpdateAddress(_address, Address_Line, Address_City, Address_State, Address_ZipCode, Address_Latitude, Address_Longitude);
return _address;
}
set {
AddressHelper.UpdateAddress(_address, value.Line, value.City, value.State, value.ZipCode, value.Latitude, value.Longitude);
Address_Line = _address.Line;
Address_City = _address.City;
Address_State = _address.State;
Address_ZipCode = _address.ZipCode;
Address_Latitude = _address.Latitude;
Address_Longitude = _address.Longitude;
}
}
#region EFCore
public string Address_Line { get; set; }
public string Address_City { get; set; }
public StateEnum Address_State { get; set; }
public string Address_ZipCode { get; set; }
public double Address_Latitude { get; set; }
public double Address_Longitude { get; set; }
#endregion
public string Phone { get; set; }
public string Fax { get; set; }
public int TotalEmployees { get; set; }
public int SquereFootage { get; set; }
[DataType(DataType.Currency)]
public decimal AnnualSales { get; set; }
public virtual Crest Crest { get; set; }
public long? CrestId { get; set; }
public string Location { get; set; }
public string City { get { return Address == null ? "" : Address.City; } }
public StateEnum State { get { return Address == null ? StateEnum.CA : Address.State; } }
public virtual ICollection<CustomerEmployee> CustomerEmployees { get; set; }
public virtual ICollection<Order> Orders { get; set; }
public virtual ICollection<Quote> Quotes { get; set; }
public string CustomerName {
get { return (Customer != null) ? Customer.Name : null; }
}
public string AddressLine {
get { return (Address != null) ? Address.ToString() : null; }
}
public string AddressLines {
get { return (Address != null) ? string.Format("{0}\r\n{1} {2}", Address.Line, Address.State, Address.ZipCode) : null; }
}
public string CrestCity {
get { return (Crest != null) ? Crest.CityName : null; }
}
Image smallImg;
public Image CrestSmallImage {
get {
if(smallImg == null && Crest != null)
smallImg = CreateImage(Crest.SmallImage);
return smallImg;
}
}
Image largeImg;
public Image CrestLargeImage {
get {
if(largeImg == null && Crest != null)
largeImg = CreateImage(Crest.LargeImage);
return largeImg;
}
}
Image CreateImage(byte[] data) {
if (data == null)
return null;// ResourceImageHelper.CreateImageFromResourcesEx("DevExpress.DevAV.Resources.Unknown-user.png", typeof(Employee).Assembly);
else
return DevAVByteImageConverter.FromByteArray(data);
}
}
}

View File

@@ -0,0 +1,19 @@
using System;
using System.ComponentModel;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using System.Runtime.Serialization;
using DevExpress.Common;
namespace DevExpress.DevAV {
public abstract class DatabaseObject : IDataErrorInfo {
[Key]
public long Id { get; set; }
#region IDataErrorInfo
string IDataErrorInfo.Error { get { return null; } }
string IDataErrorInfo.this[string columnName] {
get { return IDataErrorInfoHelper.GetErrorText(this, columnName); }
}
#endregion
}
}

View File

@@ -0,0 +1,130 @@
using Microsoft.EntityFrameworkCore;
using System;
namespace DevExpress.DevAV
{
public class DevAVDb : DbContext {
public DevAVDb(string connectionStringOrName) {
connectionString = connectionStringOrName;
}
string connectionString = @"Data Source=C:\Work\OutlookWpf\Data\devav.sqlite3";
public DevAVDb() : base()
{
}
protected override void OnConfiguring(DbContextOptionsBuilder optionbuilder)
{
optionbuilder.UseLazyLoadingProxies().UseSqlite(connectionString);
}
public DbSet<Customer> Customers { get; set; }
public DbSet<Employee> Employees { get; set; }
public DbSet<Product> Products { get; set; }
public DbSet<EmployeeTask> Tasks { get; set; }
public DbSet<Crest> Crests { get; set; }
public DbSet<CustomerCommunication> Communications { get; set; }
public DbSet<CustomerStore> CustomerStores { get; set; }
public DbSet<Order> Orders { get; set; }
public DbSet<OrderItem> OrderItems { get; set; }
public DbSet<Probation> Probations { get; set; }
public DbSet<ProductCatalog> ProductCatalogs { get; set; }
public DbSet<ProductImage> ProductImages { get; set; }
public DbSet<Quote> Quotes { get; set; }
public DbSet<QuoteItem> QuoteItems { get; set; }
public DbSet<State> States { get; set; }
public DbSet<CustomerEmployee> CustomerEmployees { get; set; }
public DbSet<Evaluation> Evaluations { get; set; }
public DbSet<Picture> Pictures { get; set; }
public DbSet<TaskAttachedFile> AttachedFiles { get; set; }
public DbSet<DatabaseVersion> Version { get; set; }
protected override void OnModelCreating(ModelBuilder modelBuilder) {
base.OnModelCreating(modelBuilder);
modelBuilder.Entity<Employee>()
.HasOne(x => x.Picture)
.WithMany(x => x.Employees);
modelBuilder.Entity<Employee>()
.HasOne(x => x.ProbationReason)
.WithMany(x => x.Employees)
.HasForeignKey(x => x.ProbationReason_Id);
modelBuilder.Entity<Evaluation>()
.HasOne(x => x.CreatedBy)
.WithMany(x => x.EvaluationsCreatedBy);
modelBuilder.Entity<CustomerEmployee>()
.HasOne(x => x.CustomerStore)
.WithMany(x => x.CustomerEmployees);
modelBuilder.Entity<CustomerEmployee>()
.HasOne(x => x.Picture)
.WithMany(x => x.CustomerEmployees);
modelBuilder.Entity<CustomerStore>()
.HasOne(x => x.Crest)
.WithMany(x => x.CustomerStores);
modelBuilder.Entity<Order>()
.HasOne(x => x.Employee)
.WithMany(x => x.Orders);
modelBuilder.Entity<Order>()
.HasOne(x => x.Store)
.WithMany(x => x.Orders);
modelBuilder.Entity<Product>()
.HasOne(x => x.Engineer)
.WithMany(x => x.Products);
modelBuilder.Entity<Product>()
.HasOne(x => x.PrimaryImage)
.WithMany(x => x.Products);
modelBuilder.Entity<Product>()
.HasOne(x => x.Support)
.WithMany(x => x.SupportedProducts);
modelBuilder.Entity<ProductImage>()
.HasOne(x => x.Picture)
.WithMany(x => x.ProductImages);
modelBuilder.Entity<Quote>()
.HasOne(x => x.CustomerStore)
.WithMany(x => x.Quotes);
modelBuilder.Entity<Quote>()
.HasOne(x => x.Employee)
.WithMany(x => x.Quotes);
modelBuilder.Entity<QuoteItem>()
.HasOne(x => x.Product)
.WithMany(x => x.QuoteItems);
modelBuilder.Entity<CustomerCommunication>()
.HasOne(x => x.CustomerEmployee)
.WithMany(x => x.CustomerCommunications);
modelBuilder.Entity<CustomerCommunication>()
.HasOne(x => x.Employee)
.WithMany(x => x.Employees);
modelBuilder.Entity<Employee>()
.Ignore(x => x.AssignedEmployeeTasks);
modelBuilder.Entity<EmployeeTask>()
.Ignore(x => x.AssignedEmployees);
modelBuilder.Entity<Employee>()
.Ignore(x => x.AssignedTasks);
modelBuilder.Entity<Employee>()
.Ignore(x => x.OwnedTasks);
modelBuilder.Entity<Employee>()
.Ignore(x => x.Employees);
}
}
public class DatabaseVersion : DatabaseObject {
public DateTime Date { get; set; }
}
}

View File

@@ -0,0 +1,15 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>netstandard2.0</TargetFramework>
<AppendTargetFrameworkToOutputPath>false</AppendTargetFrameworkToOutputPath>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="3.0.0-preview.18572.1" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Proxies" Version="2.2.0" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite" Version="3.0.0-preview.18572.1" />
<PackageReference Include="System.Drawing.Common" Version="4.5.1" />
</ItemGroup>
</Project>

View File

@@ -0,0 +1,25 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 16
VisualStudioVersion = 16.0.28315.86
MinimumVisualStudioVersion = 10.0.40219.1
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "DevExpress.DevAV", "DevExpress.DevAV.csproj", "{76AE4911-338A-43CA-81B9-C043FBB3B31E}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{76AE4911-338A-43CA-81B9-C043FBB3B31E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{76AE4911-338A-43CA-81B9-C043FBB3B31E}.Debug|Any CPU.Build.0 = Debug|Any CPU
{76AE4911-338A-43CA-81B9-C043FBB3B31E}.Release|Any CPU.ActiveCfg = Release|Any CPU
{76AE4911-338A-43CA-81B9-C043FBB3B31E}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {3FA2356F-A04A-43E2-9503-EFCD1578EB97}
EndGlobalSection
EndGlobal

View File

@@ -0,0 +1,163 @@
using DevExpress.DataAnnotations;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using System.Drawing;
using System.Runtime.Serialization;
namespace DevExpress.DevAV {
public enum EmployeeStatus {
[Display(Name = "Salaried")]
Salaried,
[Display(Name = "Commission")]
Commission,
[Display(Name = "Contract")]
Contract,
[Display(Name = "Terminated")]
Terminated,
[Display(Name = "On Leave")]
OnLeave
}
public enum EmployeeDepartment {
[Display(Name = "Sales")]
Sales = 1,
[Display(Name = "Support")]
Support,
[Display(Name = "Shipping")]
Shipping,
[Display(Name = "Engineering")]
Engineering,
[Display(Name = "Human Resources")]
HumanResources,
[Display(Name = "Management")]
Management,
[Display(Name = "IT")]
IT
}
public enum PersonPrefix {
Dr,
Mr,
Ms,
Miss,
Mrs
}
public partial class Employee : DatabaseObject {
public Employee() {
AssignedTasks = new List<EmployeeTask>();
OwnedTasks = new List<EmployeeTask>();
_address = new Address();
AssignedEmployeeTasks = new List<EmployeeTask>();
}
[InverseProperty("AssignedEmployees")]
public virtual List<EmployeeTask> AssignedEmployeeTasks { get; set; }
public EmployeeDepartment Department { get; set; }
[Required]
public string Title { get; set; }
public EmployeeStatus Status { get; set; }
[Display(Name = "Hire Date")]
public DateTime? HireDate { get; set; }
[InverseProperty("AssignedEmployee")]
public virtual List<EmployeeTask> AssignedTasks { get; set; }
[InverseProperty("Owner")]
public virtual List<EmployeeTask> OwnedTasks { get; set; }
[InverseProperty("Employee")]
public virtual List<Evaluation> Evaluations { get; set; }
public string PersonalProfile { get; set; }
public long? ProbationReason_Id { get; set; }
public virtual Probation ProbationReason { get; set; }
[Required, Display(Name = "First Name")]
public string FirstName { get; set; }
[Required, Display(Name = "Last Name")]
public string LastName { get; set; }
[Display(Name = "Full Name")]
public string FullName { get; set; }
public PersonPrefix Prefix { get; set; }
[Phone, Display(Name = "Home Phone")]
public string HomePhone { get; set; }
[Required, Phone, Display(Name = "Mobile Phone")]
public string MobilePhone { get; set; }
[Required, EmailAddress]
public string Email { get; set; }
public string Skype { get; set; }
[Display(Name = "Birth Date")]
public DateTime? BirthDate { get; set; }
public virtual Picture Picture { get; set; }
public long? PictureId { get; set; }
Address _address;
[NotMapped]
public Address Address { get {
AddressHelper.UpdateAddress(_address, Address_Line, Address_City, Address_State, Address_ZipCode, Address_Latitude, Address_Longitude);
return _address;
}
set {
AddressHelper.UpdateAddress(_address, value.Line, value.City, value.State, value.ZipCode, value.Latitude, value.Longitude);
Address_Line = _address.Line;
Address_City = _address.City;
Address_State = _address.State;
Address_ZipCode = _address.ZipCode;
Address_Latitude = _address.Latitude;
Address_Longitude = _address.Longitude;
}
}
#region EFCore
public string Address_Line { get; set; }
public string Address_City { get; set; }
public StateEnum Address_State { get; set; }
public string Address_ZipCode { get; set; }
public double Address_Latitude { get; set; }
public double Address_Longitude { get; set; }
#endregion
Image _photo = null;
[NotMapped]
public Image Photo {
get {
if(_photo == null)
_photo = Picture.CreateImage();
return _photo;
}
set {
if(_photo == value) return;
if(_photo != null)
_photo.Dispose();
_photo = value;
Picture = PictureExtension.FromImage(value);
}
}
bool unsetFullName = false;
public virtual ICollection<Evaluation> EvaluationsCreatedBy { get; set; }
public virtual ICollection<Order> Orders { get; set; }
public virtual ICollection<Product> Products { get; set; }
public virtual ICollection<Product> SupportedProducts { get; set; }
public virtual ICollection<Quote> Quotes { get; set; }
public virtual ICollection<CustomerCommunication> Employees { get; set; }
[NotMapped, Display(Name = "Full Name")]
public string FullNameBindable {
get {
return string.IsNullOrEmpty(FullName) || unsetFullName ? GetFullName() : FullName;
}
set {
unsetFullName = string.IsNullOrEmpty(value);
if(unsetFullName)
FullName = GetFullName();
else
FullName = value;
}
}
public void ResetBindable() {
if(_photo != null)
_photo.Dispose();
_photo = null;
unsetFullName = false;
}
string GetFullName() {
return string.Format("{0} {1}", FirstName, LastName);
}
public override string ToString() {
return FullName;
}
}
}

View File

@@ -0,0 +1 @@
ABCDEFGHIJKLMNOPQRSTUVWXYZ

View File

@@ -0,0 +1,24 @@
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations.Schema;
using System.Linq;
using System.Runtime.Serialization;
namespace DevExpress.DevAV {
public enum EvaluationRating {
Unset,
Good,
Average,
Poor
}
public partial class Evaluation : DatabaseObject {
public virtual Employee CreatedBy { get; set; }
public long? CreatedById { get; set; }
public DateTime CreatedOn { get; set; }
public virtual Employee Employee { get; set; }
public long? EmployeeId { get; set; }
public string Subject { get; set; }
public string Details { get; set; }
public virtual EvaluationRating Rating { get; set; }
}
}

View File

@@ -0,0 +1,98 @@
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
namespace DevExpress.DevAV {
public enum OrderShipMethod {
[Display(Name = "Ground")]
Ground,
[Display(Name = "Air")]
Air
}
public enum ShipmentCourier {
None,
[Display(Name = "FedEx")]
FedEx,
[Display(Name = "UPS")]
UPS,
[Display(Name = "DHL")]
DHL
}
public enum ShipmentStatus {
[Display(Name = "Awaiting")]
Awaiting,
[Display(Name = "Transit")]
Transit,
[Display(Name = "Received")]
Received
}
public enum PaymentStatus {
[Display(Name = "Unpaid")]
Unpaid,
[Display(Name = "Paid in full")]
PaidInFull,
[Display(Name = "Refund in full")]
RefundInFull,
[Display(Name = "")]
Other
}
//
public class Order : DatabaseObject {
public Order() {
OrderItems = new List<OrderItem>();
}
public string InvoiceNumber { get; set; }
public virtual Customer Customer { get; set; }
public long? CustomerId { get; set; }
public virtual CustomerStore Store { get; set; }
public long? StoreId { get; set; }
public string PONumber { get; set; }
public virtual Employee Employee { get; set; }
public long? EmployeeId { get; set; }
public DateTime OrderDate { get; set; }
[DataType(DataType.Currency)]
public decimal SaleAmount { get; set; }
[DataType(DataType.Currency)]
public decimal ShippingAmount { get; set; }
[DataType(DataType.Currency)]
public decimal TotalAmount { get; set; }
public DateTime? ShipDate { get; set; }
public OrderShipMethod ShipMethod { get; set; }
public string OrderTerms { get; set; }
public virtual List<OrderItem> OrderItems { get; set; }
public ShipmentCourier ShipmentCourier { get; set; }
public string ShipmentCourierId { get; set; }
public ShipmentStatus ShipmentStatus { get; set; }
public string Comments { get; set; }
// Payment/Refund
[DataType(DataType.Currency)]
public decimal RefundTotal { get; set; }
[DataType(DataType.Currency)]
public decimal PaymentTotal { get; set; }
[NotMapped]
public PaymentStatus PaymentStatus {
get {
if(PaymentTotal == decimal.Zero && RefundTotal == decimal.Zero)
return DevAV.PaymentStatus.Unpaid;
if(RefundTotal == TotalAmount)
return DevAV.PaymentStatus.RefundInFull;
if(PaymentTotal == TotalAmount)
return DevAV.PaymentStatus.PaidInFull;
return DevAV.PaymentStatus.Other;
}
}
[NotMapped]
public double ActualWeight {
get {
var weight = 0.0;
if(OrderItems != null)
foreach(var item in OrderItems)
if(item.Product != null)
weight += item.Product.Weight * item.ProductUnits;
return weight;
}
}
}
}

View File

@@ -0,0 +1,22 @@
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using System.Linq;
using System.Runtime.Serialization;
namespace DevExpress.DevAV {
public class OrderItem : DatabaseObject {
public virtual Order Order { get; set; }
public long? OrderId { get; set; }
public virtual Product Product { get; set; }
public long? ProductId { get; set; }
public int ProductUnits { get; set; }
[DataType(DataType.Currency)]
public decimal ProductPrice { get; set; }
[DataType(DataType.Currency)]
public decimal Discount { get; set; }
[DataType(DataType.Currency)]
public decimal Total { get; set; }
}
}

View File

@@ -0,0 +1 @@


View File

@@ -0,0 +1,33 @@
using System.Drawing;
using System.Collections.Generic;
namespace DevExpress.DevAV {
public class Picture : DatabaseObject {
public byte[] Data { get; set; }
public virtual ICollection<Employee> Employees { get; set; }
public virtual ICollection<CustomerEmployee> CustomerEmployees { get; set; }
public virtual ICollection<Product> Products { get; set; }
public virtual ICollection<ProductImage> ProductImages { get; set; }
}
static class PictureExtension {
public const string DefaultPic = DefaultUserPic;
public const string DefaultUserPic = "DevExpress.DevAV.Resources.Unknown-user.png";
internal static Image CreateImage(this Picture picture, string defaultImage = null) {
if (picture == null)
{
return null;
//if (string.IsNullOrEmpty(defaultImage))
// defaultImage = DefaultPic;
//return ResourceImageHelper.CreateImageFromResourcesEx(defaultImage, typeof(Picture).Assembly);
}
else return DevAVByteImageConverter.FromByteArray(picture.Data);
}
internal static Picture FromImage(Image image) {
return null;
//return (image == null) ? null : new Picture()
//{
// Data = DevAVByteImageConverter.ToByteArray(image, image.RawFormat)
//};
}
}
}

View File

@@ -0,0 +1,13 @@
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations.Schema;
using System.Linq;
using System.Runtime.Serialization;
namespace DevExpress.DevAV {
public class Probation : DatabaseObject {
public string Reason { get; set; }
public virtual ICollection<Employee> Employees { get; set; }
}
}

View File

@@ -0,0 +1,74 @@
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using System.Drawing;
using System.IO;
namespace DevExpress.DevAV {
public enum ProductCategory {
[Display(Name = "Automation")]
Automation,
[Display(Name = "Monitors")]
Monitors,
[Display(Name = "Projectors")]
Projectors,
[Display(Name = "Televisions")]
Televisions,
[Display(Name = "Video Players")]
VideoPlayers,
}
public class Product : DatabaseObject {
public string Name { get; set; }
public string Description { get; set; }
public DateTime ProductionStart { get; set; }
public bool Available { get; set; }
public byte[] Image { get; set; }
public virtual Employee Support { get; set; }
public long? SupportId { get; set; }
public virtual Employee Engineer { get; set; }
public long? EngineerId { get; set; }
public int? CurrentInventory { get; set; }
public int Backorder { get; set; }
public int Manufacturing { get; set; }
public byte[] Barcode { get; set; }
public virtual Picture PrimaryImage { get; set; }
public long? PrimaryImageId { get; set; }
[DataType(DataType.Currency)]
public decimal Cost { get; set; }
[DataType(DataType.Currency)]
public decimal SalePrice { get; set; }
[DataType(DataType.Currency)]
public decimal RetailPrice { get; set; }
public double Weight { get; set; }
public double ConsumerRating { get; set; }
public ProductCategory Category { get; set; }
[InverseProperty("Product")]
public virtual List<ProductCatalog> Catalog { get; set; }
[InverseProperty("Product")]
public virtual List<OrderItem> OrderItems { get; set; }
public virtual List<ProductImage> Images { get; set; }
public virtual ICollection<QuoteItem> QuoteItems { get; set; }
public Stream Brochure {
get {
if(Catalog != null && Catalog.Count > 0)
return Catalog[0].PdfStream;
return null;
}
}
Image img;
public Image ProductImage {
get {
if(img == null && PrimaryImage != null)
img = CreateImage(PrimaryImage.Data);
return img;
}
}
Image CreateImage(byte[] data) {
if (data == null)
return null;// ResourceImageHelper.CreateImageFromResourcesEx("DevExpress.DevAV.Resources.Unknown-user.png", typeof(Employee).Assembly);
else
return DevAVByteImageConverter.FromByteArray(data);
}
}
}

View File

@@ -0,0 +1,22 @@
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations.Schema;
using System.IO;
using System.Linq;
using System.Runtime.Serialization;
namespace DevExpress.DevAV {
public class ProductCatalog : DatabaseObject {
public virtual Product Product { get; set; }
public long? ProductId { get; set; }
public byte[] PDF { get; set; }
Stream _pdfStream;
public Stream PdfStream {
get {
if (_pdfStream == null)
_pdfStream = new MemoryStream(PDF);
return _pdfStream;
}
}
}
}

View File

@@ -0,0 +1,14 @@
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations.Schema;
using System.Linq;
using System.Runtime.Serialization;
namespace DevExpress.DevAV {
public class ProductImage : DatabaseObject {
public virtual Picture Picture { get; set; }
public long? PictureId { get; set; }
public virtual Product Product { get; set; }
public long? ProductId { get; set; }
}
}

View File

@@ -0,0 +1,583 @@
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Drawing;
using System.Linq;
using System.Linq.Expressions;
using System.Text;
namespace DevExpress.DevAV {
public class SaleSummaryInfo {
public DateTime OrderDate { get; set; }
public string InvoiceNumber { get; set; }
public int ProductUnits { get; set; }
public decimal ProductPrice { get; set; }
public decimal Discount { get; set; }
public decimal Total { get; set; }
public ProductCategory ProductCategory { get; set; }
public long StoreId { get; set; }
public string StoreCity { get; set; }
public string StoreCustomerName { get; set; }
}
public class SaleAnalisysInfo {
public DateTime OrderDate { get; set; }
public decimal ProductCost { get; set; }
public int ProductUnits { get; set; }
public decimal Total { get; set; }
}
public class CustomerSaleDetailOrderItemInfo {
public long OrderId { get; set; }
public DateTime OrderDate { get; set; }
public string InvoiceNumber { get; set; }
public ProductCategory ProductCategory { get; set; }
public string PONumber { get; set; }
public long StoreId { get; set; }
public string StoreCity { get; set; }
public string EmployeeFullName { get; set; }
public decimal ShippingAmount { get; set; }
public decimal TotalAmount { get; set; }
public string CustomerName { get; set; }
public string CustomerPhone { get; set; }
public string CustomerFax { get; set; }
public byte[] CustomerLogo { get; set; }
Image img = null;
public Image CustomerImage { get { return img ?? (img = Customer.CreateImage(CustomerLogo)); } }
public decimal Discount { get; set; }
public int ProductUnits { get; set; }
public decimal ProductPrice { get; set; }
public decimal Total { get; set; }
public string CustomerHomeOfficeLine { get; set; }
public string CustomerHomeOfficeCity { get; set; }
public StateEnum CustomerHomeOfficeState { get; set; }
public string CustomerHomeOfficeZipCode { get; set; }
public string CustomerHomeOfficeCityLine { get { return Address.GetCityLine(CustomerHomeOfficeCity, CustomerHomeOfficeState, CustomerHomeOfficeZipCode); } }
public string CustomerBillingAddressLine { get; set; }
public string CustomerBillingAddressCity { get; set; }
public StateEnum CustomerBillingAddressState { get; set; }
public string CustomerBillingAddressZipCode { get; set; }
public string CustomerBillingAddressCityLine { get { return Address.GetCityLine(CustomerBillingAddressCity, CustomerBillingAddressState, CustomerBillingAddressZipCode); } }
}
public class CustomerSaleDetailOrderInfo {
public CustomerSaleDetailOrderItemInfo[] OrderItems { get; set; }
public long OrderId { get; set; }
public ProductCategory ProductCategory { get; set; }
public DateTime OrderDate { get; set; }
public string InvoiceNumber { get; set; }
public string PONumber { get; set; }
public long StoreId { get; set; }
public string StoreCity { get; set; }
public string EmployeeFullName { get; set; }
public string CustomerName { get; set; }
public string CustomerPhone { get; set; }
public string CustomerFax { get; set; }
public Image CustomerImage { get; set; }
public decimal ShippingAmount { get; set; }
public decimal TotalAmount { get; set; }
public string CustomerHomeOfficeLine { get; set; }
public string CustomerHomeOfficeCityLine { get; set; }
public string CustomerBillingAddressLine { get; set; }
public string CustomerBillingAddressCityLine { get; set; }
}
public class QuoteInfo {
public long Id { get; set; }
public StateEnum State { get; set; }
public string City { get; set; }
public DateTime Date { get; set; }
public decimal Total { get; set; }
public double Opportunity { get; set; }
public decimal MoneyOpportunity { get { return Total * (decimal)Opportunity; } }
public decimal Percentage { get { return 100M * (decimal)Opportunity; } }
}
public class OrderInfo {
public string InvoiceNumber { get; set; }
public DateTime OrderDate { get; set; }
public string Company { get; set; }
public string Store { get; set; }
public decimal TotalAmount { get; set; }
}
public class SalesProductInfo {
public string Name { get; set; }
public decimal Value { get; set; }
}
public class SalesInfo {
public string Caption { get; set; }
public List<SalesProductInfo> ListProductInfo { get; set; }
public DateTime time { get; set; }
public SalesInfo() {
ListProductInfo = new List<SalesProductInfo>();
}
}
public class ProductInfoWithSales {
public long Id { get; set; }
public string Name { get; set; }
public decimal Cost { get; set; }
public decimal SalePrice { get; set; }
public decimal RetailPrice { get; set; }
public int? CurrentInventory { get; set; }
public int Backorder { get; set; }
public IEnumerable<double> MonthlySales { get; set; }
public decimal? TotalSales { get; set; }
}
public class CustomerInfoWithSales {
public long Id { get; set; }
public string Name { get; set; }
public string HomeOfficeLine { get; set; }
public string HomeOfficeCity { get; set; }
public StateEnum HomeOfficeState { get; set; }
public string HomeOfficeZipCode { get; set; }
public string Phone { get; set; }
public string Fax { get; set; }
public decimal? TotalSales { get; set; }
Lazy<IEnumerable<CustomerStore>> customerStores;
public IEnumerable<CustomerStore> CustomerStores { get { return customerStores.Value; } }
Lazy<IEnumerable<CustomerEmployee>> customerEmployees;
public IEnumerable<CustomerEmployee> Employees { get { return customerEmployees.Value; } }
public IEnumerable<decimal> MonthlySales { get; private set; }
public void Init(Func<IEnumerable<CustomerStore>> getStores, Func<IEnumerable<CustomerEmployee>> getEmployees, IEnumerable<decimal> monthlySales) {
this.customerStores = new Lazy<IEnumerable<CustomerStore>>(getStores);
this.customerEmployees = new Lazy<IEnumerable<CustomerEmployee>>(getEmployees);
this.MonthlySales = monthlySales;
}
}
public class MapItem {
public Address Address { get; set; }
public Customer Customer { get; set; }
public Product Product { get; set; }
public decimal Total { get; set; }
public string City { get { return Address.City; } }
public double Latitude { get { return Address.Latitude; } }
public double Longitude { get { return Address.Longitude; } }
public string CustomerName { get { return Customer.Name; } }
public string ProductName { get { return Product.Name; } }
public ProductCategory ProductCategory { get { return Product.Category; } }
}
public class QuoteMapItem {
public Address Address { get; set; }
public Stage Stage { get; set; }
public DateTime Date { get; set; }
public string City { get { return Address.City; } }
public double Latitude { get { return Address.Latitude; } }
public double Longitude { get { return Address.Longitude; } }
public string Name { get { return Enum.GetName(typeof(Stage), Stage); } }
public int Index { get { return (int)Stage; } }
public decimal Value { get; set; }
}
public enum Stage {
High,
Medium,
Low,
Unlikely,
Summary
}
public class SalesSummaryItem {
public ProductCategory Category { get; set; }
public decimal Sales { get; set; }
}
public class QuoteSummaryItem {
public string StageName { get; set; }
public decimal Summary { get; set; }
}
public class CostAverageItem {
public ProductCategory Category { get; set; }
public decimal Cost { get; set; }
}
public static class QueriesHelper {
public static IQueryable<Order> ActualOrders(this IQueryable<Order> orders) {
var actualDateTime = DateTime.Now.AddHours(0.5);
return orders.Where(x => x.OrderDate <= actualDateTime);
}
public static IQueryable<Quote> ActualQuotes(this IQueryable<Quote> quotes) {
var actualDateTime = DateTime.Now.AddHours(0.5);
return quotes.Where(x => x.Date <= actualDateTime);
}
public static IQueryable<QuoteInfo> GetQuoteInfo(IQueryable<Quote> quotes) {
return quotes.ActualQuotes().Select(x => new QuoteInfo {
Id = x.Id,
State = x.CustomerStore.Address.State,
City = x.CustomerStore.Address.City,
Date = x.Date,
Total = x.Total,
Opportunity = x.Opportunity,
});
}
public static decimal CustomSum<T>(this IEnumerable<T> query, Expression<Func<T, decimal>> selector) {
return query.AsQueryable<T>().Select(selector).DefaultIfEmpty(0).Sum();
}
public static IEnumerable<CustomerSaleDetailOrderInfo> GetCustomerSaleDetails(long customerId, IQueryable<OrderItem> orderItems) {
List<CustomerSaleDetailOrderItemInfo> detailInfo = GetCustomerSaleOrderItemDetails(customerId, orderItems);
return detailInfo
.GroupBy(x => x.OrderId)
.Select(x => new CustomerSaleDetailOrderInfo() {
OrderId = x.Key,
OrderItems = x.ToArray(),
ProductCategory = x.First().ProductCategory,
OrderDate = x.First().OrderDate,
InvoiceNumber = x.First().InvoiceNumber,
PONumber = x.First().PONumber,
StoreCity = x.First().StoreCity,
StoreId = x.First().StoreId,
EmployeeFullName = x.First().EmployeeFullName,
CustomerName = x.First().CustomerName,
CustomerPhone = x.First().CustomerPhone,
CustomerFax = x.First().CustomerFax,
CustomerImage = x.First().CustomerImage,
ShippingAmount = x.First().ShippingAmount,
TotalAmount = x.First().TotalAmount,
CustomerHomeOfficeLine = x.First().CustomerHomeOfficeLine,
CustomerHomeOfficeCityLine = x.First().CustomerHomeOfficeCityLine,
CustomerBillingAddressLine = x.First().CustomerBillingAddressLine,
CustomerBillingAddressCityLine = x.First().CustomerBillingAddressCityLine
}).ToArray();
}
public static List<CustomerSaleDetailOrderItemInfo> GetCustomerSaleOrderItemDetails(long customerId, IQueryable<OrderItem> orderItems) {
return orderItems
.Where(x => x.Order.CustomerId == customerId)
.Select(x => new CustomerSaleDetailOrderItemInfo() {
ProductCategory = x.Product.Category,
OrderDate = x.Order.OrderDate,
OrderId = x.OrderId.Value,
InvoiceNumber = x.Order.InvoiceNumber,
PONumber = x.Order.PONumber,
StoreId = x.Order.Store.Id,
StoreCity = x.Order.Store.Address.City,
EmployeeFullName = x.Order.Employee.FullName,
CustomerName = x.Order.Customer.Name,
CustomerPhone = x.Order.Customer.Phone,
CustomerFax = x.Order.Customer.Fax,
CustomerLogo = x.Order.Customer.Logo,
CustomerHomeOfficeLine = x.Order.Customer.HomeOffice.Line,
CustomerHomeOfficeCity = x.Order.Customer.HomeOffice.City,
CustomerHomeOfficeZipCode = x.Order.Customer.HomeOffice.ZipCode,
CustomerHomeOfficeState = x.Order.Customer.HomeOffice.State,
CustomerBillingAddressLine = x.Order.Customer.BillingAddress.Line,
CustomerBillingAddressCity = x.Order.Customer.BillingAddress.City,
CustomerBillingAddressZipCode = x.Order.Customer.BillingAddress.ZipCode,
CustomerBillingAddressState = x.Order.Customer.BillingAddress.State,
Total = x.Total,
TotalAmount = x.Order.TotalAmount,
Discount = x.Discount,
ProductUnits = x.ProductUnits,
ProductPrice = x.ProductPrice,
ShippingAmount = x.Order.ShippingAmount,
}).ToList();
}
public static IEnumerable<SaleSummaryInfo> GetSaleSummaries(IQueryable<OrderItem> orderItems) {
return orderItems.Select(x => new SaleSummaryInfo() {
OrderDate = x.Order.OrderDate,
InvoiceNumber = x.Order.InvoiceNumber,
ProductUnits = x.ProductUnits,
ProductPrice = x.ProductPrice,
Discount = x.Discount,
Total = x.Total,
ProductCategory = x.Product.Category,
StoreId = x.Order.Store.Id,
StoreCity = x.Order.Store.Address.City,
StoreCustomerName = x.Order.Store.Customer.Name,
}).ToList();
}
public static IEnumerable<SaleAnalisysInfo> GetSaleAnalysis(IQueryable<OrderItem> orderItems) {
return orderItems.Select(x => new SaleAnalisysInfo() {
OrderDate = x.Order.OrderDate,
ProductCost = x.Product.Cost,
ProductUnits = x.ProductUnits,
Total = x.Total,
}).ToList();
}
public static IEnumerable<string> GetStateNames(IQueryable<State> queryableStates, IEnumerable<StateEnum> states) {
return
from ss in queryableStates
join s in states on ss.ShortName equals s
select ss.LongName;
}
public static IList<OrderInfo> GetOrderInfo(IQueryable<Order> orders) {
return orders.ActualOrders().Select(x => new OrderInfo {
InvoiceNumber = x.InvoiceNumber,
OrderDate = x.OrderDate,
Company = x.Customer.Name,
//Store = x.Customer.HomeOffice.City,
TotalAmount = x.TotalAmount,
}).ToList();
}
public static List<Order> GetAverageOrders(IQueryable<Order> orders, int NumberOfPoints) {
DateTime startDate = orders.Min(q => q.OrderDate);
DateTime endDate = orders.Max(q => q.OrderDate);
int daysPerGroup = Math.Max(1, (endDate - startDate).Days / NumberOfPoints);
var constDate = new DateTime(1990, 1, 1);
List<decimal> groups = orders
.Select(x => new { OrderDate = x.OrderDate, TotalAmount = x.TotalAmount })
.ToList()
.GroupBy(q => (q.OrderDate - constDate).Days / daysPerGroup)
.Select(g => g.Average(q => q.TotalAmount))
.ToList();
DateTime currentDate = startDate;
List<Order> averageOrders = new List<Order>();
foreach(decimal total in groups) {
averageOrders.Add(new Order { OrderDate = currentDate, TotalAmount = total });
currentDate = currentDate.AddDays(daysPerGroup);
}
return averageOrders;
}
public static List<Quote> GetAverageQuotes(IQueryable<Quote> quotes, int NumberOfPoints) {
var startDate = quotes.Min(q => q.Date);
var endDate = quotes.Max(q => q.Date);
int daysPerGroup = Math.Max(1, (endDate - startDate).Days / NumberOfPoints);
var constDate = new DateTime(1990, 1, 1);
List<decimal> groups = quotes
.Select(x => new { Date = x.Date, Total = x.Total })
.ToList()
.GroupBy(q => (q.Date - constDate).Days / daysPerGroup)
.Select(g => g.Average(q => q.Total))
.ToList();
DateTime currentDate = startDate;
List<Quote> averageQuotes = new List<Quote>();
foreach(decimal total in groups) {
averageQuotes.Add(new Quote { Date = currentDate, Total = total });
currentDate = currentDate.AddDays(daysPerGroup);
}
return averageQuotes;
}
public static List<SalesInfo> GetSales(IQueryable<OrderItem> orderItems) {
var result = orderItems
.Select(x => new { OrderDate = x.Order.OrderDate, ProductCategory = x.Product.Category, Total = x.Total })
.OrderBy(x => x.OrderDate)
.ToList()
.GroupBy(x => x.OrderDate.Year)
.Select(x => new SalesInfo() {
time = new DateTime(x.Key, 1, 1),
Caption = "Sales (FY" + x.Key + ")",
ListProductInfo = x
.GroupBy(y => y.ProductCategory)
.Select(y => new SalesProductInfo() {
Name = y.Key.ToString(),
Value = y.Sum(z => z.Total)
})
.ToList()
}).ToList();
return result;
}
public static IQueryable<ProductInfoWithSales> GetProductInfoWithSales(IQueryable<Product> products) {
return products.Select(x => new ProductInfoWithSales {
Id = x.Id,
Name = x.Name,
Cost = x.Cost,
RetailPrice = x.RetailPrice,
SalePrice = x.SalePrice,
CurrentInventory = x.CurrentInventory,
Backorder = x.Backorder,
TotalSales = x.OrderItems.Sum(orderItem => orderItem.Total)
});
}
public static void UpdateMonthlySales(IQueryable<OrderItem> orderItems, IEnumerable<ProductInfoWithSales> products) {
foreach(var productInfo in products) {
var sales = orderItems
.Where(x => x.Product.Id == productInfo.Id)
.GroupBy(x => x.Order.OrderDate.Month)
.Select(x => new { Month = x.Key, Sum = (double)x.Sum(i => i.Total) }).ToArray();
double[] monthlySales = new double[12];
for(int i = 0; i < sales.Length; i++)
monthlySales[sales[i].Month - 1] = sales[i].Sum;
productInfo.MonthlySales = monthlySales;
}
}
public static IQueryable<CustomerInfoWithSales> GetCustomerInfoWithSales(IQueryable<Customer> customers) {
return customers.Select(x => new CustomerInfoWithSales {
Id = x.Id,
Name = x.Name,
HomeOfficeLine = x.HomeOffice.Line,
HomeOfficeCity = x.HomeOffice.City,
HomeOfficeState = x.HomeOffice.State,
HomeOfficeZipCode = x.HomeOffice.ZipCode,
Phone = x.Phone,
Fax = x.Fax,
TotalSales = x.Orders.Sum(orderItem => orderItem.TotalAmount)
});
}
public static void UpdateCustomerInfoWithSales(IEnumerable<CustomerInfoWithSales> entities, IQueryable<CustomerStore> stores, IQueryable<CustomerEmployee> employees, IQueryable<Order> orders) {
foreach(var item in entities) {
item.Init(
() => stores.Where(x => x.CustomerId == item.Id).ToArray(),
() => employees.Where(x => x.CustomerId == item.Id).ToArray(),
orders.Where(x => x.CustomerId == item.Id).GroupBy(o => o.OrderDate.Month).Select(g => g.Sum(i => i.TotalAmount)).ToArray()
);
}
}
public static IQueryable<Order> GetOrdersForPeriod(IQueryable<Order> orders, Period period, DateTime dateTime = new DateTime()) {
switch(period) {
case Period.ThisYear:
return orders.Where(o => o.OrderDate.Year == DateTime.Now.Year);
case Period.ThisMonth:
return orders.Where(o => o.OrderDate.Month == DateTime.Now.Month && o.OrderDate.Year == DateTime.Now.Year);
case Period.FixedDate:
return orders.Where(o => o.OrderDate.Month == dateTime.Month && o.OrderDate.Year == dateTime.Year
&& o.OrderDate.Day == dateTime.Day);
}
return orders;
}
public static IQueryable<Order> GetCustomerOrdersForPeriod(IQueryable<Order> orders, Period period, long customerId) {
return GetOrdersForPeriod(orders.Where(o => o.CustomerId == customerId), period);
}
public static IQueryable<OrderItem> GetOrderItemsForPeriod(IQueryable<OrderItem> orderItems, Period period, DateTime dateTime = new DateTime()) {
return orderItems.Where(GetOrderItemsForPeriodFilter(period, dateTime));
}
public static Expression<Func<OrderItem, bool>> GetOrderItemsForPeriodFilter(Period period, DateTime dateTime = new DateTime()) {
switch(period) {
case Period.ThisYear:
return x => x.Order.OrderDate.Year == DateTime.Now.Year;
case Period.ThisMonth:
return x => x.Order.OrderDate.Month == DateTime.Now.Month && x.Order.OrderDate.Year == DateTime.Now.Year;
case Period.FixedDate:
return x => x.Order.OrderDate.Month == dateTime.Month && x.Order.OrderDate.Year == dateTime.Year
&& x.Order.OrderDate.Day == dateTime.Day;
}
return x => true;
}
public static IEnumerable<CustomerStore> GetSalesStoresForPeriod(IQueryable<Order> orders, Period period = Period.Lifetime) {
return QueriesHelper.GetOrdersForPeriod(orders, period).GroupBy(o => o.Store).Select(g => g.Key).Distinct();
}
public static IEnumerable<MapItem> GetSaleMapItemsByCity(IQueryable<OrderItem> orderItems, long productId, string city, Period period = Period.Lifetime) {
return GetSaleMapItems(orderItems.Where(x => x.Order.Store.Address.City == city), productId, period);
}
public static IEnumerable<MapItem> GetSaleMapItems(IQueryable<OrderItem> orderItems, long productId, Period period = Period.Lifetime) {
return GetSaleMapItemsCore(orderItems.Where(QueriesHelper.GetOrderItemsForPeriodFilter(period)).Where(x => x.ProductId == productId));
}
public static IEnumerable<MapItem> GetSaleMapItemsByCustomer(IQueryable<OrderItem> orderItems, long customerId, Period period = Period.Lifetime) {
return GetSaleMapItemsCore(orderItems.Where(x => x.Order.CustomerId == customerId).Where(QueriesHelper.GetOrderItemsForPeriodFilter(period)));
}
public static IEnumerable<MapItem> GetSaleMapItemsByCustomerAndCity(IQueryable<OrderItem> orderItems, long customerId, string city, Period period = Period.Lifetime) {
return GetSaleMapItemsByCustomer(orderItems.Where(x => x.Order.Store.Address.City == city), customerId, period);
}
static IEnumerable<MapItem> GetSaleMapItemsCore(IQueryable<OrderItem> orderItems) {
return orderItems
.Select(x => new MapItem {
Customer = x.Order.Customer,
Product = x.Product,
Total = x.Total,
Address = x.Order.Store.Address
});
}
public static IEnumerable<SalesSummaryItem> GetSalesSummaryItems(IQueryable<OrderItem> orderItems, Period period, DateTime dateTime = new DateTime()) {
return GetOrderItemsForPeriod(orderItems, period, dateTime)
.GroupBy(oi => oi.Product.Category)
.Select(g => new SalesSummaryItem { Category = g.Key, Sales = g.Sum(oi => oi.Total) })
.ToList();
}
public static IEnumerable<CostAverageItem> GetCostAverageItems(IQueryable<OrderItem> orderItems, Period period, DateTime dateTime = new DateTime()) {
return GetOrderItemsForPeriod(orderItems, period, dateTime)
.GroupBy(oi => oi.Product.Category)
.Select(g => new CostAverageItem { Category = g.Key, Cost = g.Average(oi => oi.ProductPrice) })
.ToList();
}
public static IEnumerable<CustomerStore> GetDistinctStoresForPeriod(IQueryable<Order> orders, long customerId, Period period = Period.Lifetime) {
return QueriesHelper.GetCustomerOrdersForPeriod(orders, period, customerId).GroupBy(o => o.Store).Select(g => g.Key).Distinct();
}
public static decimal GetQuotesTotal(IQueryable<Quote> quotes, CustomerStore store, DateTime begin, DateTime end) {
return quotes.Where(x => x.CustomerStoreId == store.Id && x.Date >= begin && x.Date <= end).CustomSum(x => x.Total);
}
public static IEnumerable<QuoteSummaryItem> GetSummaryOpportunities(IQueryable<Quote> quotes) {
yield return GetSummaryItem(quotes, Stage.High);
yield return GetSummaryItem(quotes, Stage.Medium);
yield return GetSummaryItem(quotes, Stage.Low);
yield return GetSummaryItem(quotes, Stage.Unlikely);
}
public static IEnumerable<QuoteMapItem> GetOpportunities(IQueryable<Quote> quotes, IQueryable<Customer> customers, Stage stage) {
string name = Enum.GetName(typeof(Stage), stage);
return from q in GetQuotes(quotes, stage)
join c in customers on q.CustomerId equals c.Id
select new QuoteMapItem { Stage = stage, Address = q.CustomerStore.Address, Value = q.Total, Date = q.Date };
}
public static IEnumerable<QuoteMapItem> GetOpportunities(IQueryable<Quote> quotes) {
yield return GetOpportunity(quotes, Stage.High);
yield return GetOpportunity(quotes, Stage.Medium);
yield return GetOpportunity(quotes, Stage.Low);
yield return GetOpportunity(quotes, Stage.Unlikely);
}
static QuoteMapItem GetOpportunity(IQueryable<Quote> quotes, Stage stage) {
return new QuoteMapItem {
Stage = stage,
Value = GetQuotes(quotes, stage).CustomSum(q => q.Total)
};
}
public static decimal GetOpportunity(IQueryable<Quote> quotes, Stage stage, string city) {
return GetQuotes(quotes, stage).Where(q => q.CustomerStore.Address.City == city).CustomSum(q => q.Total);
}
public static IEnumerable<CustomerStore> GetCustomerStore(IQueryable<CustomerStore> stores, IQueryable<Quote> quotes, Stage stage) {
return from q in GetQuotes(quotes, stage)
join s in stores on q.CustomerStoreId equals s.Id
select s;
}
public static IEnumerable<OrderItem> GetRevenueReportItems(IQueryable<OrderItem> orderItems) {
bool hasItemsInCurrentMonth = orderItems.Where(x => x.Order.OrderDate.Month == DateTime.Now.Month && x.Order.OrderDate.Year == DateTime.Now.Year).Any();
var dateOfLastOrder = orderItems.Max(x => x.Order.OrderDate);
var revenueMonth = hasItemsInCurrentMonth ? DateTime.Now.Month : dateOfLastOrder.Month;
var revenueYear = hasItemsInCurrentMonth ? DateTime.Now.Year : dateOfLastOrder.Year;
return orderItems.Where(x => x.Order.OrderDate.Month == revenueMonth && x.Order.OrderDate.Year == revenueYear).ToList();
}
public static IEnumerable<OrderItem> GetRevenueAnalysisReportItems(IQueryable<OrderItem> orderItems, long storeId) {
return orderItems.Where(x => x.Order.StoreId.Value == storeId).ToList();
}
static QuoteSummaryItem GetSummaryItem(IQueryable<Quote> quotes, Stage stage) {
var query = GetQuotes(quotes, stage);
return new QuoteSummaryItem {
StageName = stage.ToString(),
Summary = !query.Any() ? 0 : query.CustomSum(q => q.Total)
};
}
static IQueryable<Quote> GetQuotes(IQueryable<Quote> quotes, Stage stage) {
double min, max;
switch(stage) {
case Stage.High:
max = 1.0;
min = 0.6;
break;
case Stage.Medium:
min = 0.3;
max = 0.6;
break;
case Stage.Low:
min = 0.12;
max = 0.3;
break;
case Stage.Summary:
min = 0.0;
max = 1.0;
break;
default:
min = 0.0;
max = 0.12;
break;
}
return quotes.Where(q => q.Opportunity > min && q.Opportunity < max);
}
}
public enum Period {
[Display(Name = "Lifetime")]
Lifetime,
[Display(Name = "This Year")]
ThisYear,
[Display(Name = "This Month")]
ThisMonth,
[Display(Name = "Fixed Date")]
FixedDate
}
}

View File

@@ -0,0 +1,27 @@
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using System.Linq;
using System.Runtime.Serialization;
namespace DevExpress.DevAV {
public class Quote : DatabaseObject {
public string Number { get; set; }
public virtual Customer Customer { get; set; }
public long? CustomerId { get; set; }
public virtual CustomerStore CustomerStore { get; set; }
public long? CustomerStoreId { get; set; }
public virtual Employee Employee { get; set; }
public long? EmployeeId { get; set; }
public virtual DateTime Date { get; set; }
[DataType(DataType.Currency)]
public decimal SubTotal { get; set; }
[DataType(DataType.Currency)]
public decimal ShippingAmount { get; set; }
[DataType(DataType.Currency)]
public decimal Total { get; set; }
public double Opportunity { get; set; }
public virtual List<QuoteItem> QuoteItems { get; set; }
}
}

View File

@@ -0,0 +1,23 @@
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using System.Linq;
using System.Runtime.Serialization;
namespace DevExpress.DevAV {
public class QuoteItem : DatabaseObject {
public virtual Quote Quote { get; set; }
public long? QuoteId { get; set; }
public virtual Product Product { get; set; }
public long? ProductId { get; set; }
public int ProductUnits { get; set; }
[DataType(DataType.Currency)]
public decimal ProductPrice { get; set; }
[DataType(DataType.Currency)]
public decimal Discount { get; set; }
[DataType(DataType.Currency)]
public decimal Total { get; set; }
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.3 KiB

View File

@@ -0,0 +1,16 @@
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using System.Linq;
namespace DevExpress.DevAV {
public class State {
[Key]
public StateEnum ShortName { get; set; }
public string LongName { get; set; }
public byte[] Flag48px { get; set; }
public byte[] Flag24px { get; set; }
}
}

View File

@@ -0,0 +1,57 @@
using System;
namespace DevExpress.DevAV {
public enum StateEnum {
CA,
AR,
AL,
AK,
AZ,
CO,
CT,
DE,
DC,
FL,
GA,
HI,
ID,
IL,
IN,
IA,
KS,
KY,
LA,
ME,
MD,
MA,
MI,
MN,
MS,
MO,
MT,
NE,
NV,
NH,
NJ,
NM,
NY,
NC,
OH,
OK,
OR,
PA,
RI,
SC,
SD,
TN,
TX,
UT,
VT,
VA,
WA,
WV,
WI,
WY,
ND
}
}

View File

@@ -0,0 +1,97 @@
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using System.IO;
using System.Runtime.Serialization;
//using System.Windows.Media;
using System.Linq;
namespace DevExpress.DevAV {
public enum EmployeeTaskStatus {
[Display(Name = "Not Started")]
NotStarted,
[Display(Name = "Completed")]
Completed,
[Display(Name = "In Progress")]
InProgress,
[Display(Name = "Need Assistance")]
NeedAssistance,
[Display(Name = "Deferred")]
Deferred
}
public enum EmployeeTaskPriority {
Low,
Normal,
High,
Urgent
}
public enum EmployeeTaskFollowUp {
[Display(Name = "Today")]
Today,
[Display(Name = "Tomorrow")]
Tomorrow,
[Display(Name = "This Week")]
ThisWeek,
[Display(Name = "Next Week")]
NextWeek,
[Display(Name = "No Date")]
NoDate,
[Display(Name = "Custom")]
Custom
}
public class EmployeeTask : DatabaseObject {
public EmployeeTask() {
AssignedEmployees = new List<Employee>();
}
public virtual List<Employee> AssignedEmployees { get; set; }
[Required]
public string Subject { get; set; }
public string Description { get; set; }
public string RtfTextDescription { get; set; }
public DateTime? StartDate { get; set; }
public DateTime? DueDate { get; set; }
public EmployeeTaskStatus Status { get; set; }
public EmployeeTaskPriority Priority { get; set; }
public int Completion { get; set; }
public bool Reminder { get; set; }
public DateTime? ReminderDateTime { get; set; }
public virtual Employee AssignedEmployee { get; set; }
public long? AssignedEmployeeId { get; set; }
public virtual Employee Owner { get; set; }
public long? OwnerId { get; set; }
public virtual CustomerEmployee CustomerEmployee { get; set; }
public long? CustomerEmployeeId { get; set; }
public EmployeeTaskFollowUp FollowUp { get; set; }
public bool Private { get; set; }
public string Category { get; set; }
public virtual List<TaskAttachedFile> AttachedFiles { get; set; }
public bool AttachedCollectionsChanged { get; set; }
public override string ToString() {
return string.Format("{0} - {1}, due {2}, {3},\r\nOwner: {4}", Subject, Description, DueDate, Status, Owner);
}
public bool Overdue {
get {
if(Status == EmployeeTaskStatus.Completed || !DueDate.HasValue) return false;
DateTime dDate = DueDate.Value.Date.AddDays(1);
if(DateTime.Now >= dDate) return true;
return false;
}
}
public int AttachedFilesCount {
get {
return (AttachedFiles == null) ? 0 : AttachedFiles.Count;
}
}
public string AssignedEmployeesFullList {
get {
if(AssignedEmployees == null)
return "";
return string.Join(", ", AssignedEmployees.Select(x => x.FullName));
}
}
}
}

View File

@@ -0,0 +1,31 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 15
VisualStudioVersion = 15.0.28307.168
MinimumVisualStudioVersion = 10.0.40219.1
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "DevExpress.OutlookInspiredApp", "DevExpress.OutlookInspiredApp\DevExpress.OutlookInspiredApp.csproj", "{3E1753D3-E331-4156-9DC1-C3B49B1BB281}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "DevExpress.DevAV", "DevExpress.DevAV\DevExpress.DevAV.csproj", "{4BBCECE2-D8E1-41AB-BB97-D90C33575067}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{3E1753D3-E331-4156-9DC1-C3B49B1BB281}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{3E1753D3-E331-4156-9DC1-C3B49B1BB281}.Debug|Any CPU.Build.0 = Debug|Any CPU
{3E1753D3-E331-4156-9DC1-C3B49B1BB281}.Release|Any CPU.ActiveCfg = Release|Any CPU
{3E1753D3-E331-4156-9DC1-C3B49B1BB281}.Release|Any CPU.Build.0 = Release|Any CPU
{4BBCECE2-D8E1-41AB-BB97-D90C33575067}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{4BBCECE2-D8E1-41AB-BB97-D90C33575067}.Debug|Any CPU.Build.0 = Debug|Any CPU
{4BBCECE2-D8E1-41AB-BB97-D90C33575067}.Release|Any CPU.ActiveCfg = Release|Any CPU
{4BBCECE2-D8E1-41AB-BB97-D90C33575067}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {EF4B80D3-8139-4F5C-B054-BD71E5337C2A}
EndGlobalSection
EndGlobal

View File

@@ -0,0 +1,163 @@
using System;
using System.ComponentModel;
// This class was auto-generated.
// To add or remove a member, edit your .ResX file then rerun ResGen
// with the /str option, or rebuild your VS project.
namespace DevExpress.DevAV.Common {
/// <summary>
/// A strongly-typed resource class, for looking up localized strings, etc.
/// </summary>
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
internal class CommonResources {
private static global::System.Resources.ResourceManager resourceMan;
private static global::System.Globalization.CultureInfo resourceCulture;
[global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
internal CommonResources() {
}
/// <summary>
/// Returns the cached ResourceManager instance used by this class.
/// </summary>
[global::System.ComponentModel.EditorBrowsableAttribute(EditorBrowsableState.Advanced)]
internal static global::System.Resources.ResourceManager ResourceManager {
get {
if (object.ReferenceEquals(resourceMan, null)) {
global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("DevExpress.DevAV.Common.CommonResources", typeof(CommonResources).Assembly);
resourceMan = temp;
}
return resourceMan;
}
}
/// <summary>
/// Overrides the current thread's CurrentUICulture property for all
/// resource lookups using this strongly typed resource class.
/// </summary>
[global::System.ComponentModel.EditorBrowsableAttribute(EditorBrowsableState.Advanced)]
internal static global::System.Globalization.CultureInfo Culture {
get {
return resourceCulture;
}
set {
resourceCulture = value;
}
}
/// <summary>
/// Looks up a localized string similar to Do you want to delete this {0}?.
/// </summary>
internal static string Confirmation_Delete {
get {
return ResourceManager.GetString("Confirmation_Delete", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Do you want to save changes?.
/// </summary>
internal static string Confirmation_Save {
get {
return ResourceManager.GetString("Confirmation_Save", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Click OK to reload the entity and lose unsaved changes. Click Cancel to continue editing data..
/// </summary>
internal static string Confirmation_Reset {
get {
return ResourceManager.GetString("Confirmation_Reset", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Confirmation.
/// </summary>
internal static string Confirmation_Caption {
get {
return ResourceManager.GetString("Confirmation_Caption", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Warning.
/// </summary>
internal static string Warning_Caption {
get {
return ResourceManager.GetString("Warning_Caption", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Some fields contain invalid data. Click OK to close the page and lose unsaved changes. Press Cancel to continue editing data..
/// </summary>
internal static string Warning_SomeFieldsContainInvalidData {
get {
return ResourceManager.GetString("Warning_SomeFieldsContainInvalidData", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Update Error.
/// </summary>
internal static string Exception_UpdateErrorCaption {
get {
return ResourceManager.GetString("Exception_UpdateErrorCaption", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Validation Error.
/// </summary>
internal static string Exception_ValidationErrorCaption {
get {
return ResourceManager.GetString("Exception_ValidationErrorCaption", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to DataService Request Error.
/// </summary>
internal static string Exception_DataServiceRequestErrorCaption {
get {
return ResourceManager.GetString("Exception_DataServiceRequestErrorCaption", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to *.
/// </summary>
internal static string Entity_Changed {
get {
return ResourceManager.GetString("Entity_Changed", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to (New).
/// </summary>
internal static string Entity_New {
get {
return ResourceManager.GetString("Entity_New", resourceCulture);
}
}
}
}

View File

@@ -0,0 +1,153 @@
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<data name="Confirmation_Delete" xml:space="preserve">
<value>Do you want to delete this {0}?</value>
</data>
<data name="Confirmation_Save" xml:space="preserve">
<value>Do you want to save changes?</value>
</data>
<data name="Confirmation_Reset" xml:space="preserve">
<value>Click OK to reload the entity and lose unsaved changes. Click Cancel to continue editing data.</value>
</data>
<data name="Confirmation_Caption" xml:space="preserve">
<value>Confirmation</value>
</data>
<data name="Warning_Caption" xml:space="preserve">
<value>Warning</value>
</data>
<data name="Warning_SomeFieldsContainInvalidData" xml:space="preserve">
<value>Some fields contain invalid data. Click OK to close the page and lose unsaved changes. Press Cancel to continue editing data.</value>
</data>
<data name="Exception_UpdateErrorCaption" xml:space="preserve">
<value>Update Error</value>
</data>
<data name="Exception_ValidationErrorCaption" xml:space="preserve">
<value>Validation Error</value>
</data>
<data name="Exception_DataServiceRequestErrorCaption" xml:space="preserve">
<value>DataService Request Error</value>
</data>
<data name="Entity_Changed" xml:space="preserve">
<value> *</value>
</data>
<data name="Entity_New" xml:space="preserve">
<value> (New)</value>
</data>
</root>

View File

@@ -0,0 +1,36 @@
using System;
using System.ComponentModel;
using System.ComponentModel.DataAnnotations;
using System.Linq;
using System.Reflection;
using DevExpress.DataAnnotations;
namespace DevExpress.DevAV.Common.Utils {
public static class DataAnnotationHelper {
public static bool IsRequired<TEntity>(string propertyName) {
return IsSet<RequiredAttribute>(typeof(TEntity), propertyName);
}
public static bool IsPhone<TEntity>(string propertyName) {
return IsSet<PhoneAttribute>(typeof(TEntity), propertyName);
}
public static bool IsEmail<TEntity>(string propertyName) {
return IsSet<EmailAddressAttribute>(typeof(TEntity), propertyName);
}
public static bool IsZipcode<TEntity>(string propertyName) {
return IsSet<ZipCodeAttribute>(typeof(TEntity), propertyName);
}
public static bool IsSet<TAttribute>(System.Type type, string propertyName) where TAttribute : ValidationAttribute {
string[] path = propertyName.Split('.');
if(path.Length > 1) {
PropertyInfo nestedPropertyInfo = type.GetProperty(path[0]);
if(nestedPropertyInfo == null)
return false;
return IsSet<TAttribute>(nestedPropertyInfo.PropertyType, string.Join(".", path.Skip(1)));
}
PropertyInfo propertyInfo = type.GetProperty(propertyName);
if(propertyInfo == null)
return false;
return propertyInfo.GetCustomAttributes(false).OfType<TAttribute>().Any();
}
}
}

View File

@@ -0,0 +1,22 @@
using System;
using System.Collections;
using System.Linq;
namespace DevExpress.DevAV.Common.Utils {
/// <summary>
/// Provides the extension method for implementations of the IQueryable interface.
/// </summary>
public static class DbExtensions {
/// <summary>
/// Forces entities to be loaded locally from the IQueryable instance.
/// </summary>
/// <param name="source">An instance of the IQueryable interface from which to load entities.</param>
public static void Load(this IQueryable source) {
IEnumerator enumerator = source.GetEnumerator();
while(enumerator.MoveNext()) {
}
}
}
}

View File

@@ -0,0 +1,145 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Linq.Expressions;
using System.Reflection;
namespace DevExpress.DevAV.Common.Utils {
/// <summary>
/// Provides methods to perform operations with lambda expression trees.
/// </summary>
public class ExpressionHelper {
class ValueHolder<T> {
public readonly T value;
public ValueHolder(T value) {
this.value = value;
}
}
static readonly Dictionary<Type, object> TraitsCache = new Dictionary<Type, object>();
/// <summary>
/// Builds a lambda expression that compares an entity property value with a given constant value.
/// </summary>
/// <typeparam name="TPropertyOwner">An owner type of the property.</typeparam>
/// <typeparam name="TProperty">A primary key property type.</typeparam>
/// <param name="getPropertyExpression">A lambda expression that returns the property value for a given entity.</param>
/// <param name="constant">A constant value to compare with entity property value.</param>
public static Expression<Func<TPropertyOwner, bool>> GetValueEqualsExpression<TPropertyOwner, TProperty>(Expression<Func<TPropertyOwner, TProperty>> getPropertyExpression, TProperty constant) {
Expression equalExpression = Expression.Equal(getPropertyExpression.Body, Expression.Convert(Expression.Field(Expression.Constant(new ValueHolder<TProperty>(constant)), "value"), getPropertyExpression.Body.Type));
return Expression.Lambda<Func<TPropertyOwner, bool>>(equalExpression, getPropertyExpression.Parameters.Single());
}
/// <summary>
/// Returns an instance of the EntityTraits class that encapsulates operations to obtain and set the primary key value of a given entity.
/// </summary>
/// <typeparam name="TOwner">A type used as a key to cache compiled lambda expressions.</typeparam>
/// <typeparam name="TPropertyOwner">An owner type of the primary key property.</typeparam>
/// <typeparam name="TProperty">A primary key property type.</typeparam>
/// <param name="owner">An instance of the TOwner type which type is used as a key to cache compiled lambda expressions.</param>
/// <param name="getPropertyExpression">A lambda expression that returns the primary key value for a given entity.</param>
public static EntityTraits<TPropertyOwner, TProperty> GetEntityTraits<TOwner, TPropertyOwner, TProperty>(TOwner owner, Expression<Func<TPropertyOwner, TProperty>> getPropertyExpression) {
object traits = null;
if(!TraitsCache.TryGetValue(owner.GetType(), out traits)) {
traits = new EntityTraits<TPropertyOwner, TProperty>(getPropertyExpression.Compile(), GetSetValueActionExpression(getPropertyExpression).Compile(), GetHasValueFunctionExpression(getPropertyExpression).Compile());
TraitsCache[owner.GetType()] = traits;
}
return (EntityTraits<TPropertyOwner, TProperty>)traits;
}
/// <summary>
/// Determines whether the given entity satisfies the condition represented by a lambda expression.
/// </summary>
/// <typeparam name="TEntity">A type of the given object.</typeparam>
/// <param name="entity">An object to test.</param>
/// <param name="predicate">A function that determines whether the given object satisfies the condition.</param>
public static bool IsFitEntity<TEntity>(TEntity entity, Expression<Func<TEntity, bool>> predicate) where TEntity : class {
return predicate == null || (new TEntity[] { entity }.AsQueryable().Any(predicate));
}
/// <summary>
/// Converts a property reference represented as a lambda expression to a property name.
/// </summary>
/// <param name="expression">A lambda expression that returns the property value.</param>
public static string GetPropertyName(LambdaExpression expression) {
Expression body = expression.Body;
if(body is UnaryExpression) {
body = ((UnaryExpression)body).Operand;
}
var memberExpression = ValidateMemberExpression((MemberExpression)body);
return memberExpression.Member.Name;
}
static MemberExpression ValidateMemberExpression(MemberExpression memberExpression) {
if(IsNullableValueExpression(memberExpression))
memberExpression = (MemberExpression)memberExpression.Expression;
return memberExpression;
}
static bool IsNullableValueExpression(MemberExpression memberExpression) {
var propertyInfo = (PropertyInfo)memberExpression.Member;
return propertyInfo.PropertyType.IsValueType && propertyInfo.ReflectedType == typeof(Nullable<>).MakeGenericType(propertyInfo.PropertyType) && propertyInfo.Name == "Value";
}
static Expression<Action<TPropertyOwner, TProperty>> GetSetValueActionExpression<TPropertyOwner, TProperty>(Expression<Func<TPropertyOwner, TProperty>> getPropertyExpression) {
MemberExpression body = ValidateMemberExpression((MemberExpression)getPropertyExpression.Body);
ParameterExpression thisParameter = getPropertyExpression.Parameters.Single();
ParameterExpression propertyValueParameter = Expression.Parameter(typeof(TProperty), "propertyValue");
Expression keyValueExpression = propertyValueParameter;
if(IsNullableValueExpression((MemberExpression)getPropertyExpression.Body)) {
var constructor = typeof(Nullable<>).MakeGenericType(typeof(TProperty)).GetConstructor(new Type[] { typeof(TProperty) });
keyValueExpression = Expression.New(constructor, keyValueExpression);
}
BinaryExpression assignPropertyValueExpression = Expression.Assign(body, keyValueExpression);
return Expression.Lambda<Action<TPropertyOwner, TProperty>>(assignPropertyValueExpression, thisParameter, propertyValueParameter);
}
static Expression<Func<TPropertyOwner, bool>> GetHasValueFunctionExpression<TPropertyOwner, TProperty>(Expression<Func<TPropertyOwner, TProperty>> getPropertyExpression) {
MemberExpression memberExpression = (MemberExpression)getPropertyExpression.Body;
if(IsNullableValueExpression(memberExpression)) {
Expression equalExpression = Expression.NotEqual(memberExpression.Expression, Expression.Constant(null));
return Expression.Lambda<Func<TPropertyOwner, bool>>(equalExpression, getPropertyExpression.Parameters.Single());
}
return x => true;
}
}
/// <summary>
/// Incapsulates operations to obtain and set the primary key value of a given entity.
/// </summary>
/// <typeparam name="TEntity">An owner type of the primary key property.</typeparam>
/// <typeparam name="TPrimaryKey">A primary key property type.</typeparam>
public class EntityTraits<TEntity, TPrimaryKey> {
/// <summary>
/// Initializes a new instance of EntityTraits class.
/// </summary>
/// <param name="getPrimaryKeyFunction">A function that returns the primary key value of a given entity.</param>
/// <param name="setPrimaryKeyAction">An action that assigns the primary key value to a given entity.</param>
/// <param name="hasPrimaryKeyFunction">A function that determines whether given the entity has a primary key assigned.</param>
public EntityTraits(Func<TEntity, TPrimaryKey> getPrimaryKeyFunction, Action<TEntity, TPrimaryKey> setPrimaryKeyAction, Func<TEntity, bool> hasPrimaryKeyFunction) {
this.GetPrimaryKey = getPrimaryKeyFunction;
this.SetPrimaryKey = setPrimaryKeyAction;
this.HasPrimaryKey = hasPrimaryKeyFunction;
}
/// <summary>
/// The function that returns the primary key value of a given entity.
/// </summary>
public Func<TEntity, TPrimaryKey> GetPrimaryKey { get; private set; }
/// <summary>
/// The action that assigns the primary key value to a given entity.
/// </summary>
public Action<TEntity, TPrimaryKey> SetPrimaryKey { get; private set; }
/// <summary>
/// A function that determines whether the given entity has a primary key assigned (the primary key is not null). Always returns true if the primary key is a non-nullable value type.
/// </summary>
/// <returns></returns>
public Func<TEntity, bool> HasPrimaryKey { get; private set; }
}
}

View File

@@ -0,0 +1,60 @@
namespace DevExpress.DevAV {
using System;
using System.Collections.Generic;
abstract class ProcessTracker : IObservable<string> {
IList<IObserver<string>> observers;
protected ProcessTracker() {
observers = new List<IObserver<string>>();
}
public IDisposable StartTracking(IProcess process) {
return new TrackingContext(process, this);
}
IDisposable IObservable<string>.Subscribe(IObserver<string> observer) {
return new Subscription(this, observer);
}
void process_Start(object sender, ProcessStatusEventArgs e) {
foreach(IObserver<string> observer in observers)
observer.OnNext(e.Status);
}
void process_Running(object sender, ProcessStatusEventArgs e) {
foreach(IObserver<string> observer in observers)
observer.OnNext(e.Status);
}
void process_Complete(object sender, EventArgs e) {
foreach(IObserver<string> observer in observers)
observer.OnCompleted();
}
class TrackingContext : IDisposable {
IProcess process;
ProcessTracker tracker;
public TrackingContext(IProcess process, ProcessTracker tracker) {
process.Start += tracker.process_Start;
process.Running += tracker.process_Running;
process.Complete += tracker.process_Complete;
this.process = process;
this.tracker = tracker;
}
void IDisposable.Dispose() {
process.Start -= tracker.process_Start;
process.Running -= tracker.process_Running;
process.Complete -= tracker.process_Complete;
this.tracker = null;
this.process = null;
}
}
class Subscription : IDisposable {
IObserver<string> observer;
ProcessTracker tracker;
public Subscription(ProcessTracker tracker, IObserver<string> observer) {
if(!tracker.observers.Contains(observer))
tracker.observers.Add(observer);
this.tracker = tracker;
this.observer = observer;
}
void IDisposable.Dispose() {
tracker.observers.Remove(observer);
}
}
}
}

View File

@@ -0,0 +1,80 @@
namespace DevExpress.DevAV {
using System;
public interface IProcess {
event ProcessStatusEventHandler Start;
event ProcessStatusEventHandler Running;
event EventHandler Complete;
}
public delegate void ProcessStatusEventHandler(
object sender, ProcessStatusEventArgs e
);
public class ProcessStatusEventArgs : EventArgs {
public ProcessStatusEventArgs(string status) {
Status = status;
}
public string Status { get; private set; }
}
//
class StartUpProcess : IProcess, IDisposable {
static StartUpProcess process;
IDisposable tracker;
public StartUpProcess() {
process = this;
tracker = StartUpProcessTracker.Instance.StartTracking(this);
}
void IDisposable.Dispose() {
tracker.Dispose();
process = null;
}
public static IObservable<string> Status {
get { return StartUpProcessTracker.Instance; }
}
public static void OnStart(string status) {
if(process != null)
process.RaiseStart(status);
}
public static void OnRunning(string status) {
if(process != null)
process.RaiseRunning(status);
}
public static void OnComplete() {
if(process != null)
process.RaiseComplete();
}
#region ProcessTracker
class StartUpProcessTracker : ProcessTracker {
internal static StartUpProcessTracker Instance = new StartUpProcessTracker();
}
#endregion ProcessTracker
#region IProcess Members
ProcessStatusEventHandler startCore;
event ProcessStatusEventHandler IProcess.Start {
add { startCore += value; }
remove { startCore -= value; }
}
ProcessStatusEventHandler runningCore;
event ProcessStatusEventHandler IProcess.Running {
add { runningCore += value; }
remove { runningCore -= value; }
}
EventHandler completeCore;
event EventHandler IProcess.Complete {
add { completeCore += value; }
remove { completeCore -= value; }
}
void RaiseStart(string status) {
if(startCore != null)
startCore(this, new ProcessStatusEventArgs(status));
}
void RaiseRunning(string status) {
if(runningCore != null)
runningCore(this, new ProcessStatusEventArgs(status));
}
void RaiseComplete() {
if(completeCore != null)
completeCore(this, EventArgs.Empty);
}
#endregion
}
}

View File

@@ -0,0 +1,433 @@
using System;
using System.ComponentModel;
using System.ComponentModel.DataAnnotations;
using System.Collections.Generic;
using System.Linq;
using System.Linq.Expressions;
using DevExpress.Mvvm;
using DevExpress.Mvvm.POCO;
using DevExpress.Mvvm.DataAnnotations;
using DevExpress.DevAV.Common.Utils;
using DevExpress.Mvvm.DataModel;
namespace DevExpress.DevAV.Common.ViewModel {
/// <summary>
/// The base class for a POCO view models exposing a colection of entities of a given type and CRUD operations against these entities.
/// This is a partial class that provides extension point to add custom properties, commands and override methods without modifying the auto-generated code.
/// </summary>
/// <typeparam name="TEntity">An entity type.</typeparam>
/// <typeparam name="TPrimaryKey">A primary key value type.</typeparam>
/// <typeparam name="TUnitOfWork">A unit of work type.</typeparam>
public partial class CollectionViewModel<TEntity, TPrimaryKey, TUnitOfWork> : CollectionViewModel<TEntity, TEntity, TPrimaryKey, TUnitOfWork>
where TEntity : class
where TUnitOfWork : IUnitOfWork {
/// <summary>
/// Creates a new instance of CollectionViewModel as a POCO view model.
/// </summary>
/// <param name="unitOfWorkFactory">A factory used to create a unit of work instance.</param>
/// <param name="getRepositoryFunc">A function that returns a repository representing entities of the given type.</param>
/// <param name="projection">An optional parameter that provides a LINQ function used to customize a query for entities. The parameter, for example, can be used for sorting data.</param>
/// <param name="newEntityInitializer">An optional parameter that provides a function to initialize a new entity. This parameter is used in the detail collection view models when creating a single object view model for a new entity.</param>
/// <param name="ignoreSelectEntityMessage">An optional parameter that used to specify that the selected entity should not be managed by PeekCollectionViewModel.</param>
public static CollectionViewModel<TEntity, TPrimaryKey, TUnitOfWork> CreateCollectionViewModel(
IUnitOfWorkFactory<TUnitOfWork> unitOfWorkFactory,
Func<TUnitOfWork, IRepository<TEntity, TPrimaryKey>> getRepositoryFunc,
Func<IRepositoryQuery<TEntity>, IQueryable<TEntity>> projection = null,
Action<TEntity> newEntityInitializer = null,
bool ignoreSelectEntityMessage = false) {
return ViewModelSource.Create(() => new CollectionViewModel<TEntity, TPrimaryKey, TUnitOfWork>(unitOfWorkFactory, getRepositoryFunc, projection, newEntityInitializer, ignoreSelectEntityMessage));
}
/// <summary>
/// Initializes a new instance of the CollectionViewModel class.
/// This constructor is declared protected to avoid an undesired instantiation of the CollectionViewModel type without the POCO proxy factory.
/// </summary>
/// <param name="unitOfWorkFactory">A factory used to create a unit of work instance.</param>
/// <param name="getRepositoryFunc">A function that returns a repository representing entities of the given type.</param>
/// <param name="projection">An optional parameter that provides a LINQ function used to customize a query for entities. The parameter, for example, can be used for sorting data.</param>
/// <param name="newEntityInitializer">An optional parameter that provides a function to initialize a new entity. This parameter is used in the detail collection view models when creating a single object view model for a new entity.</param>
/// <param name="ignoreSelectEntityMessage">An optional parameter that used to specify that the selected entity should not be managed by PeekCollectionViewModel.</param>
protected CollectionViewModel(
IUnitOfWorkFactory<TUnitOfWork> unitOfWorkFactory,
Func<TUnitOfWork, IRepository<TEntity, TPrimaryKey>> getRepositoryFunc,
Func<IRepositoryQuery<TEntity>, IQueryable<TEntity>> projection = null,
Action<TEntity> newEntityInitializer = null,
bool ignoreSelectEntityMessage = false
) : base(unitOfWorkFactory, getRepositoryFunc, projection, newEntityInitializer, ignoreSelectEntityMessage) {
}
}
/// <summary>
/// The base class for a POCO view models exposing a collection of entities of a given type and CRUD operations against these entities.
/// This is a partial class that provides extension point to add custom properties, commands and override methods without modifying the auto-generated code.
/// </summary>
/// <typeparam name="TEntity">A repository entity type.</typeparam>
/// <typeparam name="TProjection">A projection entity type.</typeparam>
/// <typeparam name="TPrimaryKey">A primary key value type.</typeparam>
/// <typeparam name="TUnitOfWork">A unit of work type.</typeparam>
public partial class CollectionViewModel<TEntity, TProjection, TPrimaryKey, TUnitOfWork> : CollectionViewModelBase<TEntity, TProjection, TPrimaryKey, TUnitOfWork>
where TEntity : class
where TProjection : class
where TUnitOfWork : IUnitOfWork {
/// <summary>
/// Creates a new instance of CollectionViewModel as a POCO view model.
/// </summary>
/// <param name="unitOfWorkFactory">A factory used to create a unit of work instance.</param>
/// <param name="getRepositoryFunc">A function that returns a repository representing entities of the given type.</param>
/// <param name="projection">A LINQ function used to customize a query for entities. The parameter, for example, can be used for sorting data and/or for projecting data to a custom type that does not match the repository entity type.</param>
/// <param name="newEntityInitializer">An optional parameter that provides a function to initialize a new entity. This parameter is used in the detail collection view models when creating a single object view model for a new entity.</param>
/// <param name="ignoreSelectEntityMessage">An optional parameter that used to specify that the selected entity should not be managed by PeekCollectionViewModel.</param>
public static CollectionViewModel<TEntity, TProjection, TPrimaryKey, TUnitOfWork> CreateProjectionCollectionViewModel(
IUnitOfWorkFactory<TUnitOfWork> unitOfWorkFactory,
Func<TUnitOfWork, IRepository<TEntity, TPrimaryKey>> getRepositoryFunc,
Func<IRepositoryQuery<TEntity>, IQueryable<TProjection>> projection,
Action<TEntity> newEntityInitializer = null,
bool ignoreSelectEntityMessage = false) {
return ViewModelSource.Create(() => new CollectionViewModel<TEntity, TProjection, TPrimaryKey, TUnitOfWork>(unitOfWorkFactory, getRepositoryFunc, projection, newEntityInitializer, ignoreSelectEntityMessage));
}
/// <summary>
/// Initializes a new instance of the CollectionViewModel class.
/// This constructor is declared protected to avoid an undesired instantiation of the CollectionViewModel type without the POCO proxy factory.
/// </summary>
/// <param name="unitOfWorkFactory">A factory used to create a unit of work instance.</param>
/// <param name="getRepositoryFunc">A function that returns a repository representing entities of the given type.</param>
/// <param name="projection">A LINQ function used to customize a query for entities. The parameter, for example, can be used for sorting data and/or for projecting data to a custom type that does not match the repository entity type.</param>
/// <param name="newEntityInitializer">An optional parameter that provides a function to initialize a new entity. This parameter is used in the detail collection view models when creating a single object view model for a new entity.</param>
/// <param name="ignoreSelectEntityMessage">An optional parameter that used to specify that the selected entity should not be managed by PeekCollectionViewModel.</param>
protected CollectionViewModel(
IUnitOfWorkFactory<TUnitOfWork> unitOfWorkFactory,
Func<TUnitOfWork, IRepository<TEntity, TPrimaryKey>> getRepositoryFunc,
Func<IRepositoryQuery<TEntity>, IQueryable<TProjection>> projection,
Action<TEntity> newEntityInitializer = null,
bool ignoreSelectEntityMessage = false
) : base(unitOfWorkFactory, getRepositoryFunc, projection, newEntityInitializer, ignoreSelectEntityMessage) {
}
}
/// <summary>
/// The base class for POCO view models exposing a collection of entities of a given type and CRUD operations against these entities.
/// It is not recommended to inherit directly from this class. Use the CollectionViewModel class instead.
/// </summary>
/// <typeparam name="TEntity">A repository entity type.</typeparam>
/// <typeparam name="TProjection">A projection entity type.</typeparam>
/// <typeparam name="TPrimaryKey">A primary key value type.</typeparam>
/// <typeparam name="TUnitOfWork">A unit of work type.</typeparam>
public abstract class CollectionViewModelBase<TEntity, TProjection, TPrimaryKey, TUnitOfWork> : ReadOnlyCollectionViewModel<TEntity, TProjection, TUnitOfWork>
where TEntity : class
where TProjection : class
where TUnitOfWork : IUnitOfWork {
EntitiesChangeTracker<TPrimaryKey> ChangeTrackerWithKey { get { return (EntitiesChangeTracker<TPrimaryKey>)ChangeTracker; } }
readonly Action<TEntity> newEntityInitializer;
IRepository<TEntity, TPrimaryKey> Repository { get { return (IRepository<TEntity, TPrimaryKey>)ReadOnlyRepository; } }
/// <summary>
/// Initializes a new instance of the CollectionViewModelBase class.
/// </summary>
/// <param name="unitOfWorkFactory">A factory used to create a unit of work instance.</param>
/// <param name="getRepositoryFunc">A function that returns a repository representing entities of the given type.</param>
/// <param name="projection">A LINQ function used to customize a query for entities. The parameter, for example, can be used for sorting data and/or for projecting data to a custom type that does not match the repository entity type.</param>
/// <param name="newEntityInitializer">A function to initialize a new entity. This parameter is used in the detail collection view models when creating a single object view model for a new entity.</param>
/// <param name="ignoreSelectEntityMessage">A parameter used to specify whether the selected entity should be managed by PeekCollectionViewModel.</param>
protected CollectionViewModelBase(
IUnitOfWorkFactory<TUnitOfWork> unitOfWorkFactory,
Func<TUnitOfWork, IRepository<TEntity, TPrimaryKey>> getRepositoryFunc,
Func<IRepositoryQuery<TEntity>, IQueryable<TProjection>> projection,
Action<TEntity> newEntityInitializer,
bool ignoreSelectEntityMessage
) : base(unitOfWorkFactory, getRepositoryFunc, projection) {
VerifyProjectionType();
this.newEntityInitializer = newEntityInitializer;
this.ignoreSelectEntityMessage = ignoreSelectEntityMessage;
if(!this.IsInDesignMode())
RegisterSelectEntityMessage();
}
/// <summary>
/// Creates and shows a document that contains a single object view model for new entity.
/// Since CollectionViewModelBase is a POCO view model, an the instance of this class will also expose the NewCommand property that can be used as a binding source in views.
/// </summary>
public virtual void New() {
GetDocumentManagerService().ShowNewEntityDocument(this, newEntityInitializer);
}
/// <summary>
/// Creates and shows a document that contains a single object view model for the existing entity.
/// Since CollectionViewModelBase is a POCO view model, an the instance of this class will also expose the EditCommand property that can be used as a binding source in views.
/// </summary>
/// <param name="projectionEntity">Entity to edit.</param>
public virtual void Edit(TProjection projectionEntity) {
if(Repository.IsDetached(projectionEntity))
return;
TPrimaryKey primaryKey = Repository.GetProjectionPrimaryKey(projectionEntity);
int index = Entities.IndexOf(projectionEntity);
projectionEntity = ChangeTrackerWithKey.FindActualProjectionByKey(primaryKey);
if(index >= 0) {
if(projectionEntity == null)
Entities.RemoveAt(index);
else
Entities[index] = projectionEntity;
}
if(projectionEntity == null) {
DestroyDocument(GetDocumentManagerService().FindEntityDocument<TEntity, TPrimaryKey>(primaryKey));
return;
}
GetDocumentManagerService().ShowExistingEntityDocument<TEntity, TPrimaryKey>(this, primaryKey);
}
/// <summary>
/// Determines whether an entity can be edited.
/// Since CollectionViewModelBase is a POCO view model, this method will be used as a CanExecute callback for EditCommand.
/// </summary>
/// <param name="projectionEntity">An entity to edit.</param>
public bool CanEdit(TProjection projectionEntity) {
return projectionEntity != null && !IsLoading;
}
/// <summary>
/// Deletes a given entity from the repository and saves changes if confirmed by the user.
/// Since CollectionViewModelBase is a POCO view model, an the instance of this class will also expose the DeleteCommand property that can be used as a binding source in views.
/// </summary>
/// <param name="projectionEntity">An entity to edit.</param>
public virtual void Delete(TProjection projectionEntity) {
if(MessageBoxService.ShowMessage(string.Format(CommonResources.Confirmation_Delete, typeof(TEntity).Name), CommonResources.Confirmation_Caption, MessageButton.YesNo) != MessageResult.Yes)
return;
try {
Entities.Remove(projectionEntity);
TPrimaryKey primaryKey = Repository.GetProjectionPrimaryKey(projectionEntity);
TEntity entity = Repository.Find(primaryKey);
if(entity != null) {
OnBeforeEntityDeleted(primaryKey, entity);
Repository.Remove(entity);
Repository.UnitOfWork.SaveChanges();
OnEntityDeleted(primaryKey, entity);
}
} catch (DbException e) {
Refresh();
MessageBoxService.ShowMessage(e.ErrorMessage, e.ErrorCaption, MessageButton.OK, MessageIcon.Error);
}
}
/// <summary>
/// Determines whether an entity can be deleted.
/// Since CollectionViewModelBase is a POCO view model, this method will be used as a CanExecute callback for DeleteCommand.
/// </summary>
/// <param name="projectionEntity">An entity to edit.</param>
public virtual bool CanDelete(TProjection projectionEntity) {
return projectionEntity != null && !IsLoading;
}
/// <summary>
/// Saves the given entity.
/// Since CollectionViewModelBase is a POCO view model, the instance of this class will also expose the SaveCommand property that can be used as a binding source in views.
/// </summary>
/// <param name="projectionEntity">An entity to save.</param>
[Display(AutoGenerateField = false)]
public virtual void Save(TProjection projectionEntity) {
TPrimaryKey primaryKey = Repository.GetProjectionPrimaryKey(projectionEntity);
TEntity entity = Repository.Find(primaryKey);
if(typeof(TProjection) != typeof(TEntity))
ApplyProjectionPropertiesToEntity(projectionEntity, entity);
try {
OnBeforeEntitySaved(primaryKey, entity);
Repository.UnitOfWork.SaveChanges();
OnEntitySaved(primaryKey, entity);
} catch (DbException e) {
MessageBoxService.ShowMessage(e.ErrorMessage, e.ErrorCaption, MessageButton.OK, MessageIcon.Error);
}
}
/// <summary>
/// Determines whether entity local changes can be saved.
/// Since CollectionViewModelBase is a POCO view model, this method will be used as a CanExecute callback for SaveCommand.
/// </summary>
/// <param name="projectionEntity">An entity to save.</param>
public virtual bool CanSave(TProjection projectionEntity) {
return projectionEntity != null && !IsLoading;
}
/// <summary>
/// Notifies that SelectedEntity has been changed by raising the PropertyChanged event.
/// Since CollectionViewModelBase is a POCO view model, an the instance of this class will also expose the UpdateSelectedEntityCommand property that can be used as a binding source in views.
/// </summary>
[Display(AutoGenerateField = false)]
public virtual void UpdateSelectedEntity() {
this.RaisePropertyChanged(x => x.SelectedEntity);
}
/// <summary>
/// Closes the corresponding view.
/// Since CollectionViewModelBase is a POCO view model, an the instance of this class will also expose the CloseCommand property that can be used as a binding source in views.
/// </summary>
[Display(AutoGenerateField = false)]
public void Close() {
if(DocumentOwner != null)
DocumentOwner.Close(this);
}
protected IMessageBoxService MessageBoxService { get { return this.GetRequiredService<IMessageBoxService>(); } }
protected virtual IDocumentManagerService GetDocumentManagerService() { return this.GetService<IDocumentManagerService>(); }
protected virtual void OnBeforeEntityDeleted(TPrimaryKey primaryKey, TEntity entity) { }
protected virtual void OnEntityDeleted(TPrimaryKey primaryKey, TEntity entity) {
Messenger.Default.Send(new EntityMessage<TEntity, TPrimaryKey>(primaryKey, EntityMessageType.Deleted));
}
protected override Func<TProjection> GetSelectedEntityCallback() {
var entity = SelectedEntity;
return () => FindLocalProjectionWithSameKey(entity);
}
TProjection FindLocalProjectionWithSameKey(TProjection projectionEntity) {
bool primaryKeyAvailable = projectionEntity != null && Repository.ProjectionHasPrimaryKey(projectionEntity);
return primaryKeyAvailable ? ChangeTrackerWithKey.FindLocalProjectionByKey(Repository.GetProjectionPrimaryKey(projectionEntity)) : null;
}
protected virtual void OnBeforeEntitySaved(TPrimaryKey primaryKey, TEntity entity) { }
protected virtual void OnEntitySaved(TPrimaryKey primaryKey, TEntity entity) {
Messenger.Default.Send(new EntityMessage<TEntity, TPrimaryKey>(primaryKey, EntityMessageType.Changed));
}
protected virtual void ApplyProjectionPropertiesToEntity(TProjection projectionEntity, TEntity entity) {
throw new NotImplementedException("Override this method in the collection view model class and apply projection properties to the entity so that it can be correctly saved by unit of work.");
}
protected override void OnSelectedEntityChanged() {
base.OnSelectedEntityChanged();
UpdateCommands();
}
protected override void RestoreSelectedEntity(TProjection existingProjectionEntity, TProjection newProjectionEntity) {
base.RestoreSelectedEntity(existingProjectionEntity, newProjectionEntity);
if(ReferenceEquals(SelectedEntity, existingProjectionEntity))
SelectedEntity = newProjectionEntity;
}
protected override void OnIsLoadingChanged() {
base.OnIsLoadingChanged();
UpdateCommands();
if(!IsLoading)
RequestSelectedEntity();
}
void UpdateCommands() {
TProjection projectionEntity = null;
this.RaiseCanExecuteChanged(x => x.Edit(projectionEntity));
this.RaiseCanExecuteChanged(x => x.Delete(projectionEntity));
this.RaiseCanExecuteChanged(x => x.Save(projectionEntity));
}
protected void DestroyDocument(IDocument document) {
if(document != null)
document.Close();
}
protected IRepository<TEntity, TPrimaryKey> CreateRepository() {
return (IRepository<TEntity, TPrimaryKey>)CreateReadOnlyRepository();
}
protected override IEntitiesChangeTracker CreateEntitiesChangeTracker() {
return new EntitiesChangeTracker<TPrimaryKey>(this);
}
void VerifyProjectionType() {
//string primaryKeyPropertyName = CreateRepository().GetPrimaryKeyExpression.Name;
//if (TypeDescriptor.GetProperties(typeof(TProjection))[primaryKeyPropertyName] == null)
// throw new ArgumentException(string.Format("Projection type {0} should have primary key property {1}", typeof(TProjection).Name, primaryKeyPropertyName), "TProjection");
}
#region SelectEntityMessage
protected class SelectEntityMessage {
public SelectEntityMessage(TPrimaryKey primaryKey) {
PrimaryKey = primaryKey;
}
public TPrimaryKey PrimaryKey { get; private set; }
}
protected class SelectedEntityRequest { }
readonly bool ignoreSelectEntityMessage;
void RegisterSelectEntityMessage() {
if(!ignoreSelectEntityMessage)
Messenger.Default.Register<SelectEntityMessage>(this, x => OnSelectEntityMessage(x));
}
void RequestSelectedEntity() {
if(!ignoreSelectEntityMessage)
Messenger.Default.Send(new SelectedEntityRequest());
}
void OnSelectEntityMessage(SelectEntityMessage message) {
if(!IsLoaded)
return;
var projectionEntity = ChangeTrackerWithKey.FindActualProjectionByKey(message.PrimaryKey);
if(projectionEntity == null) {
FilterExpression = null;
projectionEntity = ChangeTrackerWithKey.FindActualProjectionByKey(message.PrimaryKey);
}
SelectedEntity = projectionEntity;
}
#endregion
}
/// <summary>
/// Provides the extension methods that are used to implement the IDocumentManagerService interface.
/// </summary>
public static class DocumentManagerServiceExtensions {
/// <summary>
/// Creates and shows a document containing a single object view model for the existing entity.
/// </summary>
/// <param name="documentManagerService">An instance of the IDocumentManager interface used to create and show the document.</param>
/// <param name="parentViewModel">An object that is passed to the view model of the created view.</param>
/// <param name="primaryKey">An entity primary key.</param>
public static void ShowExistingEntityDocument<TEntity, TPrimaryKey>(this IDocumentManagerService documentManagerService, object parentViewModel, TPrimaryKey primaryKey) {
IDocument document = FindEntityDocument<TEntity, TPrimaryKey>(documentManagerService, primaryKey) ?? CreateDocument<TEntity>(documentManagerService, primaryKey, parentViewModel);
if(document != null)
document.Show();
}
/// <summary>
/// Creates and shows a document containing a single object view model for new entity.
/// </summary>
/// <param name="documentManagerService">An instance of the IDocumentManager interface used to create and show the document.</param>
/// <param name="parentViewModel">An object that is passed to the view model of the created view.</param>
/// <param name="newEntityInitializer">An optional parameter that provides a function that initializes a new entity.</param>
public static void ShowNewEntityDocument<TEntity>(this IDocumentManagerService documentManagerService, object parentViewModel, Action<TEntity> newEntityInitializer = null) {
IDocument document = CreateDocument<TEntity>(documentManagerService, newEntityInitializer != null ? newEntityInitializer : x => DefaultEntityInitializer(x), parentViewModel);
if(document != null)
document.Show();
}
/// <summary>
/// Searches for a document that contains a single object view model editing entity with a specified primary key.
/// </summary>
/// <param name="documentManagerService">An instance of the IDocumentManager interface used to find a document.</param>
/// <param name="primaryKey">An entity primary key.</param>
public static IDocument FindEntityDocument<TEntity, TPrimaryKey>(this IDocumentManagerService documentManagerService, TPrimaryKey primaryKey) {
if(documentManagerService == null)
return null;
foreach(IDocument document in documentManagerService.Documents) {
ISingleObjectViewModel<TEntity, TPrimaryKey> entityViewModel = document.Content as ISingleObjectViewModel<TEntity, TPrimaryKey>;
if(entityViewModel != null && object.Equals(entityViewModel.PrimaryKey, primaryKey))
return document;
}
return null;
}
static void DefaultEntityInitializer<TEntity>(TEntity entity) { }
static IDocument CreateDocument<TEntity>(IDocumentManagerService documentManagerService, object parameter, object parentViewModel) {
if(documentManagerService == null)
return null;
return documentManagerService.CreateDocument(typeof(TEntity).Name + "View", parameter, parentViewModel);
}
}
}

View File

@@ -0,0 +1,109 @@
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Linq;
using System.Linq.Expressions;
using DevExpress.Mvvm.DataModel;
using DevExpress.Mvvm;
using DevExpress.Mvvm.DataAnnotations;
namespace DevExpress.DevAV.Common.ViewModel {
partial class CollectionViewModel<TEntity, TPrimaryKey, TUnitOfWork> : ISupportParameter, IDocumentContent
where TEntity : class
where TUnitOfWork : IUnitOfWork {
protected override void OnInitializeInRuntime() {
base.OnInitializeInRuntime();
Messenger.Default.Register<SelectedItemSynchronizationMessage<TEntity>>(this, x => OnSelectedItemSynchronizationMessage(x));
Messenger.Default.Register<EntityMessage<TEntity, TPrimaryKey>>(this, x => OnEntityMessage(x));
}
void OnEntityMessage(EntityMessage<TEntity, TPrimaryKey> m) {
if(m.MessageType == EntityMessageType.Changed) {
TEntity entity = ((EntitiesChangeTracker<TPrimaryKey>)ChangeTracker).FindLocalProjectionByKey(m.PrimaryKey);
if(entity != null)
OnEntityChanged(entity);
RaiseEntityChanged(m.PrimaryKey);
}
else RaiseEntitiesCountChanged(Entities.Count);
}
protected virtual void OnEntityChanged(TEntity entity) { }
protected override void OnIsLoadingChanged() {
base.OnIsLoadingChanged();
if(!IsLoading)
RaiseEntitiesCountChanged(Entities.Count);
}
public event EventHandler<EntitiesCountEventArgs> EntitiesCountChanged;
public event EventHandler<EntityEventArgs<TPrimaryKey>> EntityChanged;
void RaiseEntityChanged(TPrimaryKey key) {
EventHandler<EntityEventArgs<TPrimaryKey>> handler = EntityChanged;
if(handler != null)
handler(this, new EntityEventArgs<TPrimaryKey>(key));
}
void RaiseEntitiesCountChanged(int count) {
EventHandler<EntitiesCountEventArgs> handler = EntitiesCountChanged;
if(handler != null)
handler(this, new EntitiesCountEventArgs(count));
}
[Command, Display(AutoGenerateField = false)]
public virtual void OnLoaded() {
//SelectedEntity = Parameter == null ? Entities.FirstOrDefault() : FindEntity((TPrimaryKey)Parameter); // TODO
}
public event EventHandler SelectedEntityChanged; // move to descendand
protected override void OnSelectedEntityChanged() {
//Parameter = SelectedEntity == null ? (object)null : CreateRepository().GetPrimaryKey(SelectedEntity);
base.OnSelectedEntityChanged();
Messenger.Default.Send(new SelectedItemSynchronizationMessage<TEntity>(SelectedEntity));
if(SelectedEntityChanged != null)
SelectedEntityChanged(this, EventArgs.Empty);
}
void OnSelectedItemSynchronizationMessage(SelectedItemSynchronizationMessage<TEntity> message) {
//SelectedEntity = message.Entity == null ? null : FindEntity(GetPrimaryKey(message.Entity)); TODO
}
public event EventHandler ParameterChanged;
protected virtual object GetTitle() {
return null;
}
#region ISupportParameter
object parameterCore;
protected object Parameter {
get { return parameterCore; }
private set {
parameterCore = value;
EventHandler handler = ParameterChanged;
if(handler != null)
handler(this, EventArgs.Empty);
}
}
object ISupportParameter.Parameter {
get { return Parameter; }
set { Parameter = value; }
}
#endregion
protected IDocumentManagerService DocumentManagerService { get { return GetDocumentManagerService(); } }
protected IDocument FindDocument<TViewModel>() {
if(DocumentManagerService == null) return null;
return DocumentManagerService.Documents.FirstOrDefault(d => d.Content is TViewModel);
}
protected IDocument FindDocument<TViewModel>(TPrimaryKey key) {
if(DocumentManagerService == null) return null;
foreach(IDocument document in DocumentManagerService.Documents) {
ISingleObjectViewModel<TEntity, TPrimaryKey> entityViewModel = document.Content as ISingleObjectViewModel<TEntity, TPrimaryKey>;
if(entityViewModel != null && entityViewModel is TViewModel && object.Equals(entityViewModel.PrimaryKey, key))
return document;
}
return null;
}
public TPrimaryKey SelectedEntityKey {
get { return (SelectedEntity != null) ? CreateRepository().GetPrimaryKey(SelectedEntity) : default(TPrimaryKey); }
}
public virtual IQueryable<TEntity> GetEntities(Expression<Func<TEntity, bool>> filter = null) {
try {
return getRepositoryFunc(CreateUnitOfWork()).GetFilteredEntities(filter);
}
catch(Exception e) { throw new NotSupportedException("Error in Expression:" + filter.ToString(), e); }
}
public Data.Filtering.CriteriaOperator GetInOperator(IEnumerable<TEntity> entities) {
string keyName = ((MemberExpression)CreateRepository().GetPrimaryKeyExpression.Body).Member.Name;
return new Data.Filtering.InOperator(keyName, entities.Select(e => CreateRepository().GetPrimaryKey(e)));
}
}
}

View File

@@ -0,0 +1,24 @@
namespace DevExpress.DevAV {
using System.ComponentModel;
using DevExpress.Mvvm;
using DevExpress.Mvvm.DataAnnotations;
public abstract class DocumentContentViewModelBase : IDocumentContent {
protected DocumentContentViewModelBase() { }
[Command]
public void Close() {
((IDocumentContent)this).DocumentOwner.Close(this);
}
#region IDocumentContent
void IDocumentContent.OnClose(CancelEventArgs e) { }
void IDocumentContent.OnDestroy() { }
IDocumentOwner IDocumentContent.DocumentOwner { get; set; }
object IDocumentContent.Title {
get { return GetTitle(); }
}
protected virtual string GetTitle() {
return null;
}
#endregion
}
}

View File

@@ -0,0 +1,309 @@
using System;
using System.Linq;
using System.Linq.Expressions;
using System.Collections;
using System.Collections.Generic;
using System.ComponentModel;
using DevExpress.Mvvm;
using DevExpress.Mvvm.POCO;
using DevExpress.Mvvm.DataAnnotations;
using System.Collections.ObjectModel;
using System.Threading;
using System.Threading.Tasks;
using DevExpress.DevAV.Common.Utils;
using DevExpress.Mvvm.DataModel;
namespace DevExpress.DevAV.Common.ViewModel {
/// <summary>
/// The base class for POCO view models exposing a collection of entities of the given type.
/// This is a partial class that provides an extension point to add custom properties, commands and override methods without modifying the auto-generated code.
/// </summary>
/// <typeparam name="TEntity">A repository entity type.</typeparam>
/// <typeparam name="TProjection">A projection entity type.</typeparam>
/// <typeparam name="TUnitOfWork">A unit of work type.</typeparam>
public abstract partial class EntitiesViewModel<TEntity, TProjection, TUnitOfWork> :
EntitiesViewModelBase<TEntity, TProjection, TUnitOfWork>
where TEntity : class
where TProjection : class
where TUnitOfWork : IUnitOfWork {
/// <summary>
/// Initializes a new instance of the EntitiesViewModel class.
/// </summary>
/// <param name="unitOfWorkFactory">A factory used to create a unit of work instance.</param>
/// <param name="getRepositoryFunc">A function that returns a repository representing entities of the given type.</param>
/// <param name="projection">A LINQ function used to customize a query for entities. The parameter, for example, can be used for sorting data and/or for projecting data to a custom type that does not match the repository entity type.</param>
protected EntitiesViewModel(
IUnitOfWorkFactory<TUnitOfWork> unitOfWorkFactory,
Func<TUnitOfWork, IReadOnlyRepository<TEntity>> getRepositoryFunc,
Func<IRepositoryQuery<TEntity>, IQueryable<TProjection>> projection)
: base(unitOfWorkFactory, getRepositoryFunc, projection) {
}
}
/// <summary>
/// The base class for a POCO view models exposing a collection of entities of the given type.
/// It is not recommended to inherit directly from this class. Use the EntitiesViewModel class instead.
/// </summary>
/// <typeparam name="TEntity">A repository entity type.</typeparam>
/// <typeparam name="TProjection">A projection entity type.</typeparam>
/// <typeparam name="TUnitOfWork">A unit of work type.</typeparam>
[POCOViewModel]
public abstract class EntitiesViewModelBase<TEntity, TProjection, TUnitOfWork> : IEntitiesViewModel<TProjection>
where TEntity : class
where TProjection : class
where TUnitOfWork : IUnitOfWork {
#region inner classes
protected interface IEntitiesChangeTracker {
void RegisterMessageHandler();
void UnregisterMessageHandler();
}
protected class EntitiesChangeTracker<TPrimaryKey> : IEntitiesChangeTracker {
readonly EntitiesViewModelBase<TEntity, TProjection, TUnitOfWork> owner;
ObservableCollection<TProjection> Entities { get { return owner.Entities; } }
IRepository<TEntity, TPrimaryKey> Repository { get { return (IRepository<TEntity, TPrimaryKey>)owner.ReadOnlyRepository; } }
public EntitiesChangeTracker(EntitiesViewModelBase<TEntity, TProjection, TUnitOfWork> owner) {
this.owner = owner;
}
void IEntitiesChangeTracker.RegisterMessageHandler() {
Messenger.Default.Register<EntityMessage<TEntity, TPrimaryKey>>(this, x => OnMessage(x));
}
void IEntitiesChangeTracker.UnregisterMessageHandler() {
Messenger.Default.Unregister(this);
}
public TProjection FindLocalProjectionByKey(TPrimaryKey primaryKey) {
var primaryKeyEqualsExpression = RepositoryExtensions.GetProjectionPrimaryKeyEqualsExpression<TEntity, TProjection, TPrimaryKey>(Repository, primaryKey);
return Entities.AsQueryable().FirstOrDefault(primaryKeyEqualsExpression);
}
public TProjection FindActualProjectionByKey(TPrimaryKey primaryKey) {
var projectionEntity = Repository.FindActualProjectionByKey(owner.Projection, primaryKey);
if(projectionEntity != null && ExpressionHelper.IsFitEntity(Repository.Find(primaryKey), owner.GetFilterExpression())) {
owner.OnEntitiesLoaded(GetUnitOfWork(Repository), new TProjection[] { projectionEntity });
return projectionEntity;
}
return null;
}
void OnMessage(EntityMessage<TEntity, TPrimaryKey> message) {
if(!owner.IsLoaded)
return;
switch(message.MessageType) {
case EntityMessageType.Added:
OnEntityAdded(message.PrimaryKey);
break;
case EntityMessageType.Changed:
OnEntityChanged(message.PrimaryKey);
break;
case EntityMessageType.Deleted:
OnEntityDeleted(message.PrimaryKey);
break;
}
}
void OnEntityAdded(TPrimaryKey primaryKey) {
var projectionEntity = FindActualProjectionByKey(primaryKey);
if(projectionEntity != null)
Entities.Add(projectionEntity);
}
void OnEntityChanged(TPrimaryKey primaryKey) {
var existingProjectionEntity = FindLocalProjectionByKey(primaryKey);
var projectionEntity = FindActualProjectionByKey(primaryKey);
if(projectionEntity == null) {
Entities.Remove(existingProjectionEntity);
return;
}
if(existingProjectionEntity != null) {
Entities[Entities.IndexOf(existingProjectionEntity)] = projectionEntity;
owner.RestoreSelectedEntity(existingProjectionEntity, projectionEntity);
return;
}
OnEntityAdded(primaryKey);
}
void OnEntityDeleted(TPrimaryKey primaryKey) {
Entities.Remove(FindLocalProjectionByKey(primaryKey));
}
}
#endregion
ObservableCollection<TProjection> entities = new ObservableCollection<TProjection>();
CancellationTokenSource loadCancellationTokenSource;
protected readonly IUnitOfWorkFactory<TUnitOfWork> unitOfWorkFactory;
protected readonly Func<TUnitOfWork, IReadOnlyRepository<TEntity>> getRepositoryFunc;
protected Func<IRepositoryQuery<TEntity>, IQueryable<TProjection>> Projection { get; private set; }
/// <summary>
/// Initializes a new instance of the EntitiesViewModelBase class.
/// </summary>
/// <param name="unitOfWorkFactory">A factory used to create a unit of work instance.</param>
/// <param name="getRepositoryFunc">A function that returns a repository representing entities of the given type.</param>
/// <param name="projection">A LINQ function used to customize a query for entities. The parameter, for example, can be used for sorting data and/or for projecting data to a custom type that does not match the repository entity type.</param>
protected EntitiesViewModelBase(
IUnitOfWorkFactory<TUnitOfWork> unitOfWorkFactory,
Func<TUnitOfWork, IReadOnlyRepository<TEntity>> getRepositoryFunc,
Func<IRepositoryQuery<TEntity>, IQueryable<TProjection>> projection
) {
this.unitOfWorkFactory = unitOfWorkFactory;
this.getRepositoryFunc = getRepositoryFunc;
this.Projection = projection;
this.ChangeTracker = CreateEntitiesChangeTracker();
if(!this.IsInDesignMode())
OnInitializeInRuntime();
}
/// <summary>
/// Used to check whether entities are currently being loaded in the background. The property can be used to show the progress indicator.
/// </summary>
public virtual bool IsLoading { get; protected set; }
/// <summary>
/// The collection of entities loaded from the unit of work.
/// </summary>
public ObservableCollection<TProjection> Entities {
get {
if(!IsLoaded)
LoadEntities(false);
return entities;
}
}
protected IEntitiesChangeTracker ChangeTracker { get; private set; }
protected IReadOnlyRepository<TEntity> ReadOnlyRepository { get; private set; }
protected bool IsLoaded { get { return ReadOnlyRepository != null; } }
protected void LoadEntities(bool forceLoad) {
if(forceLoad) {
if(loadCancellationTokenSource != null)
loadCancellationTokenSource.Cancel();
} else if(IsLoading) {
return;
}
loadCancellationTokenSource = LoadCore();
}
void CancelLoading() {
if(loadCancellationTokenSource != null)
loadCancellationTokenSource.Cancel();
IsLoading = false;
}
CancellationTokenSource LoadCore() {
IsLoading = true;
var cancellationTokenSource = new CancellationTokenSource();
var selectedEntityCallback = GetSelectedEntityCallback();
Task.Factory.StartNew(() => {
var repository = CreateReadOnlyRepository();
var entities = new ObservableCollection<TProjection>(repository.GetFilteredEntities(GetFilterExpression(), Projection));
OnEntitiesLoaded(GetUnitOfWork(repository), entities);
return new Tuple<IReadOnlyRepository<TEntity>, ObservableCollection<TProjection>>(repository, entities);
}).ContinueWith(x => {
if(!x.IsFaulted) {
ReadOnlyRepository = x.Result.Item1;
entities = x.Result.Item2;
this.RaisePropertyChanged(y => y.Entities);
OnEntitiesAssigned(selectedEntityCallback);
}
IsLoading = false;
}, cancellationTokenSource.Token, TaskContinuationOptions.None, TaskScheduler.FromCurrentSynchronizationContext());
return cancellationTokenSource;
}
static TUnitOfWork GetUnitOfWork(IReadOnlyRepository<TEntity> repository) {
return (TUnitOfWork)repository.UnitOfWork;
}
protected virtual void OnEntitiesLoaded(TUnitOfWork unitOfWork, IEnumerable<TProjection> entities) {
}
protected virtual void OnEntitiesAssigned(Func<TProjection> getSelectedEntityCallback) {
}
protected virtual Func<TProjection> GetSelectedEntityCallback() {
return null;
}
protected virtual void RestoreSelectedEntity(TProjection existingProjectionEntity, TProjection projectionEntity) {
}
protected virtual Expression<Func<TEntity, bool>> GetFilterExpression() {
return null;
}
protected virtual void OnInitializeInRuntime() {
if(ChangeTracker != null)
ChangeTracker.RegisterMessageHandler();
}
protected virtual void OnDestroy() {
CancelLoading();
if(ChangeTracker != null)
ChangeTracker.UnregisterMessageHandler();
}
protected virtual void OnIsLoadingChanged() {
}
protected IReadOnlyRepository<TEntity> CreateReadOnlyRepository() {
return getRepositoryFunc(CreateUnitOfWork());
}
protected TUnitOfWork CreateUnitOfWork() {
return unitOfWorkFactory.CreateUnitOfWork();
}
protected virtual IEntitiesChangeTracker CreateEntitiesChangeTracker() {
return null;
}
protected IDocumentOwner DocumentOwner { get; private set; }
#region IDocumentContent
object IDocumentContent.Title { get { return null; } }
void IDocumentContent.OnClose(CancelEventArgs e) { }
void IDocumentContent.OnDestroy() {
OnDestroy();
}
IDocumentOwner IDocumentContent.DocumentOwner {
get { return DocumentOwner; }
set { DocumentOwner = value; }
}
#endregion
#region IEntitiesViewModel
ObservableCollection<TProjection> IEntitiesViewModel<TProjection>.Entities { get { return Entities; } }
bool IEntitiesViewModel<TProjection>.IsLoading { get { return IsLoading; } }
#endregion
}
/// <summary>
/// The base interface for view models exposing a collection of entities of the given type.
/// </summary>
/// <typeparam name="TEntity">An entity type.</typeparam>
public interface IEntitiesViewModel<TEntity> : IDocumentContent where TEntity : class {
/// <summary>
/// The loaded collection of entities.
/// </summary>
ObservableCollection<TEntity> Entities { get; }
/// <summary>
/// Used to check whether entities are currently being loaded in the background. The property can be used to show the progress indicator.
/// </summary>
bool IsLoading { get; }
}
}

View File

@@ -0,0 +1,29 @@
using System;
using System.ComponentModel.DataAnnotations;
using System.Linq;
using System.Linq.Expressions;
using DevExpress.Mvvm;
using DevExpress.Mvvm.POCO;
using DevExpress.Mvvm.DataAnnotations;
using DevExpress.DevAV.Common.Utils;
using DevExpress.Mvvm.DataModel;
namespace DevExpress.DevAV.Common.ViewModel {
/// <summary>
/// The base interface for view models representing a single entity.
/// </summary>
/// <typeparam name="TEntity">An entity type.</typeparam>
/// <typeparam name="TPrimaryKey">An entity primary key type.</typeparam>
public interface ISingleObjectViewModel<TEntity, TPrimaryKey> {
/// <summary>
/// The entity represented by a view model.
/// </summary>
TEntity Entity { get; }
/// <summary>
/// The entity primary key value.
/// </summary>
TPrimaryKey PrimaryKey { get; }
}
}

View File

@@ -0,0 +1,55 @@
using System;
using System.Linq;
using System.ComponentModel;
using DevExpress.Mvvm;
using DevExpress.Mvvm.POCO;
using System.Collections.ObjectModel;
using DevExpress.DevAV.Common.Utils;
using DevExpress.Mvvm.DataModel;
namespace DevExpress.DevAV.Common.ViewModel {
/// <summary>
/// Represents a POCO view models used by SingleObjectViewModel to exposing collections of related entities.
/// This is a partial class that provides an extension point to add custom properties, commands and override methods without modifying the auto-generated code.
/// </summary>
/// <typeparam name="TEntity">A repository entity type.</typeparam>
/// <typeparam name="TProjection">A projection entity type.</typeparam>
/// <typeparam name="TPrimaryKey">A primary key value type.</typeparam>
/// <typeparam name="TUnitOfWork">A unit of work type.</typeparam>
public class LookUpEntitiesViewModel<TEntity, TProjection, TPrimaryKey, TUnitOfWork> : EntitiesViewModel<TEntity, TProjection, TUnitOfWork>, IDocumentContent
where TEntity : class
where TProjection : class
where TUnitOfWork : IUnitOfWork {
/// <summary>
/// Creates a new instance of LookUpEntitiesViewModel as a POCO view model.
/// </summary>
/// <param name="unitOfWorkFactory">A factory used to create a unit of work instance.</param>
/// <param name="getRepositoryFunc">A function that returns a repository representing entities of the given type.</param>
/// <param name="projection">An optional parameter that provides a LINQ function used to customize a query for entities. The parameter, for example, can be used for sorting data and/or for projecting data to a custom type that does not match the repository entity type.</param>
public static LookUpEntitiesViewModel<TEntity, TProjection, TPrimaryKey, TUnitOfWork> Create(
IUnitOfWorkFactory<TUnitOfWork> unitOfWorkFactory,
Func<TUnitOfWork, IReadOnlyRepository<TEntity>> getRepositoryFunc,
Func<IRepositoryQuery<TEntity>, IQueryable<TProjection>> projection = null) {
return ViewModelSource.Create(() => new LookUpEntitiesViewModel<TEntity, TProjection, TPrimaryKey, TUnitOfWork>(unitOfWorkFactory, getRepositoryFunc, projection));
}
/// <summary>
/// Initializes a new instance of the LookUpEntitiesViewModel class.
/// This constructor is declared protected to avoid an undesired instantiation of the LookUpEntitiesViewModel type without the POCO proxy factory.
/// </summary>
/// <param name="unitOfWorkFactory">A factory used to create a unit of work instance.</param>
/// <param name="getRepositoryFunc">A function that returns a repository representing entities of the given type.</param>
/// <param name="projection">A LINQ function used to customize a query for entities. The parameter, for example, can be used for sorting data and/or for projecting data to a custom type that does not match the repository entity type.</param>
protected LookUpEntitiesViewModel(
IUnitOfWorkFactory<TUnitOfWork> unitOfWorkFactory,
Func<TUnitOfWork, IReadOnlyRepository<TEntity>> getRepositoryFunc,
Func<IRepositoryQuery<TEntity>, IQueryable<TProjection>> projection
) : base(unitOfWorkFactory, getRepositoryFunc, projection) {
}
protected override IEntitiesChangeTracker CreateEntitiesChangeTracker() {
return new EntitiesChangeTracker<TPrimaryKey>(this);
}
}
}

View File

@@ -0,0 +1,104 @@
using System;
using System.Linq;
using System.ComponentModel;
namespace DevExpress.DevAV.Common.ViewModel {
/// <summary>
/// Represents the type of an entity state change notification that is shown when the IUnitOfWork.SaveChanges method has been called.
/// </summary>
public enum EntityMessageType {
/// <summary>
/// A new entity has been added to the unit of work.
/// </summary>
Added,
/// <summary>
/// An entity has been removed from the unit of work.
/// </summary>
Deleted,
/// <summary>
/// One of the entity properties has been modified.
/// </summary>
Changed
}
/// <summary>
/// Provides the information about an entity state change notification that is shown when an entity has been added, removed or modified, and the IUnitOfWork.SaveChanges method has been called.
/// </summary>
/// <typeparam name="TEntity">An entity type.</typeparam>
/// <typeparam name="TPrimaryKey">A primary key value type.</typeparam>
public class EntityMessage<TEntity, TPrimaryKey> {
/// <summary>
/// Initializes a new instance of the EntityMessage class.
/// </summary>
/// <param name="primaryKey">A primary key of an entity that has been added, removed or modified.</param>
/// <param name="messageType">An entity state change notification type.</param>
public EntityMessage(TPrimaryKey primaryKey, EntityMessageType messageType) {
this.PrimaryKey = primaryKey;
this.MessageType = messageType;
}
/// <summary>
/// The primary key of entity that has been added, deleted or modified.
/// </summary>
public TPrimaryKey PrimaryKey { get; private set; }
/// <summary>
/// The entity state change notification type.
/// </summary>
public EntityMessageType MessageType { get; private set; }
}
/// <summary>
/// A message notifying that all view models should save changes. Usually sent by DocumentsViewModel when the SaveAll command is executed.
/// </summary>
public class SaveAllMessage {
}
/// <summary>
/// A message notifying that all view models should close itself. Usually sent by DocumentsViewModel when the CloseAll command is executed.
/// </summary>
public class CloseAllMessage {
readonly CancelEventArgs cancelEventArgs;
/// <summary>
/// Initializes a new instance of the CloseAllMessage class.
/// </summary>
/// <param name="cancelEventArgs">An argument of the System.ComponentModel.CancelEventArgs type which can be used to cancel closing.</param>
public CloseAllMessage(CancelEventArgs cancelEventArgs) {
this.cancelEventArgs = cancelEventArgs;
}
/// <summary>
/// Used to cancel closing and check whether the closing has already been cancelled.
/// </summary>
public bool Cancel {
get { return cancelEventArgs.Cancel; }
set { cancelEventArgs.Cancel = value; }
}
}
/// <summary>
/// Used by the PeekCollectionViewModel to notify that DocumentsViewModel should navigate to the specified module.
/// </summary>
/// <typeparam name="TNavigationToken">The navigation token type.</typeparam>
public class NavigateMessage<TNavigationToken> {
/// <summary>
/// Initializes a new instance of the NavigateMessage class.
/// </summary>
/// <param name="token">An object that is used to identify the module to which the DocumentsViewModel should navigate.</param>
public NavigateMessage(TNavigationToken token) {
Token = token;
}
/// <summary>
/// An object that is used to identify the module to which the DocumentsViewModel should navigate.
/// </summary>
public TNavigationToken Token { get; private set; }
}
}

View File

@@ -0,0 +1,10 @@
using System;
namespace DevExpress.DevAV.Common.ViewModel {
public class SelectedItemSynchronizationMessage<TEntity> where TEntity : class {
public SelectedItemSynchronizationMessage(TEntity entity) {
Entity = entity;
}
public TEntity Entity { get; private set; }
}
}

View File

@@ -0,0 +1,92 @@
using System;
using System.ComponentModel;
using System.ComponentModel.DataAnnotations;
using System.Collections.Generic;
using System.Linq;
using System.Linq.Expressions;
using DevExpress.Mvvm;
using DevExpress.Mvvm.POCO;
using DevExpress.Mvvm.DataAnnotations;
using DevExpress.DevAV.Common.Utils;
using DevExpress.Mvvm.DataModel;
namespace DevExpress.DevAV.Common.ViewModel {
/// <summary>
/// A POCO view model exposing a read-only collection of entities of a given type. It is designed for quick navigation between collection views.
/// This is a partial class that provides an extension point to add custom properties, commands and override methods without modifying the auto-generated code.
/// </summary>
/// <typeparam name="TNavigationToken">A navigation token type.</typeparam>
/// <typeparam name="TEntity">An entity type.</typeparam>
/// <typeparam name="TPrimaryKey">A primary key value type.</typeparam>
/// <typeparam name="TUnitOfWork">A unit of work type.</typeparam>
public partial class PeekCollectionViewModel<TNavigationToken, TEntity, TPrimaryKey, TUnitOfWork> : CollectionViewModelBase<TEntity, TEntity, TPrimaryKey, TUnitOfWork>
where TEntity : class
where TUnitOfWork : IUnitOfWork {
/// <summary>
/// Creates a new instance of PeekCollectionViewModel as a POCO view model.
/// </summary>
/// <param name="navigationToken">Identifies the module that is the navigation target.</param>
/// <param name="unitOfWorkFactory">A factory that is used to create a unit of work instance.</param>
/// <param name="getRepositoryFunc">A function that returns a repository representing entities of a given type.</param>
/// <param name="projection">An optional parameter that provides a LINQ function used to customize a query for entities. The parameter, for example, can be used for sorting data.</param>
public static PeekCollectionViewModel<TNavigationToken, TEntity, TPrimaryKey, TUnitOfWork> Create(
TNavigationToken navigationToken,
IUnitOfWorkFactory<TUnitOfWork> unitOfWorkFactory,
Func<TUnitOfWork, IRepository<TEntity, TPrimaryKey>> getRepositoryFunc,
Func<IRepositoryQuery<TEntity>, IQueryable<TEntity>> projection = null) {
return ViewModelSource.Create(() => new PeekCollectionViewModel<TNavigationToken, TEntity, TPrimaryKey, TUnitOfWork>(navigationToken, unitOfWorkFactory, getRepositoryFunc, projection));
}
TNavigationToken navigationToken;
TEntity pickedEntity;
/// <summary>
/// Initializes a new instance of the PeekCollectionViewModel class.
/// This constructor is declared protected to avoid an undesired instantiation of the PeekCollectionViewModel type without the POCO proxy factory.
/// </summary>
/// <param name="navigationToken">Identifies the module that is the navigation target.</param>
/// <param name="unitOfWorkFactory">A factory that is used to create a unit of work instance.</param>
/// <param name="getRepositoryFunc">A function that returns a repository representing entities of a given type.</param>
/// <param name="projection">An optional parameter that provides a LINQ function used to customize a query for entities. The parameter, for example, can be used for sorting data.</param>
protected PeekCollectionViewModel(
TNavigationToken navigationToken,
IUnitOfWorkFactory<TUnitOfWork> unitOfWorkFactory,
Func<TUnitOfWork, IRepository<TEntity, TPrimaryKey>> getRepositoryFunc,
Func<IRepositoryQuery<TEntity>, IQueryable<TEntity>> projection = null
) : base(unitOfWorkFactory, getRepositoryFunc, projection, null, true) {
this.navigationToken = navigationToken;
}
/// <summary>
/// Navigates to the corresponding collection view and selects the given entity.
/// Since PeekCollectionViewModel is a POCO view model, an instance of this class will also expose the NavigateCommand property that can be used as a binding source in views.
/// </summary>
/// <param name="projectionEntity">An entity to select within the collection view.</param>
[Display(AutoGenerateField = false)]
public void Navigate(TEntity projectionEntity) {
pickedEntity = projectionEntity;
SendSelectEntityMessage();
Messenger.Default.Send(new NavigateMessage<TNavigationToken>(navigationToken), navigationToken);
}
/// <summary>
/// Determines if a navigation to corresponding collection view can be performed.
/// Since PeekCollectionViewModel is a POCO view model, this method will be used as a CanExecute callback for NavigateCommand.
/// </summary>
/// <param name="projectionEntity">An entity to select in the collection view.</param>
public bool CanNavigate(TEntity projectionEntity) {
return projectionEntity != null;
}
protected override void OnInitializeInRuntime() {
base.OnInitializeInRuntime();
Messenger.Default.Register<SelectedEntityRequest>(this, x => SendSelectEntityMessage());
}
void SendSelectEntityMessage() {
if(IsLoaded && pickedEntity != null)
Messenger.Default.Send(new SelectEntityMessage(CreateRepository().GetProjectionPrimaryKey(pickedEntity)));
}
}
}

View File

@@ -0,0 +1,175 @@
using System;
using System.Linq;
using System.Linq.Expressions;
using System.Collections;
using System.Collections.Generic;
using System.ComponentModel;
using DevExpress.Mvvm;
using DevExpress.Mvvm.POCO;
using DevExpress.Mvvm.DataAnnotations;
using System.Collections.ObjectModel;
using System.Threading;
using System.Threading.Tasks;
using DevExpress.DevAV.Common.Utils;
using DevExpress.Mvvm.DataModel;
namespace DevExpress.DevAV.Common.ViewModel {
/// <summary>
/// The base class for POCO view models exposing a read-only collection of entities of a given type.
/// This is a partial class that provides the extension point to add custom properties, commands and override methods without modifying the auto-generated code.
/// </summary>
/// <typeparam name="TEntity">An entity type.</typeparam>
/// <typeparam name="TUnitOfWork">A unit of work type.</typeparam>
public partial class ReadOnlyCollectionViewModel<TEntity, TUnitOfWork> : ReadOnlyCollectionViewModel<TEntity, TEntity, TUnitOfWork>
where TEntity : class
where TUnitOfWork : IUnitOfWork {
/// <summary>
/// Creates a new instance of ReadOnlyCollectionViewModel as a POCO view model.
/// </summary>
/// <param name="unitOfWorkFactory">A factory used to create a unit of work instance.</param>
/// <param name="getRepositoryFunc">A function that returns a repository representing entities of the given type.</param>
/// <param name="projection">An optional parameter that provides a LINQ function used to customize a query for entities. The parameter, for example, can be used for sorting data.</param>
public static ReadOnlyCollectionViewModel<TEntity, TUnitOfWork> CreateReadOnlyCollectionViewModel(
IUnitOfWorkFactory<TUnitOfWork> unitOfWorkFactory,
Func<TUnitOfWork, IReadOnlyRepository<TEntity>> getRepositoryFunc,
Func<IRepositoryQuery<TEntity>, IQueryable<TEntity>> projection = null) {
return ViewModelSource.Create(() => new ReadOnlyCollectionViewModel<TEntity, TUnitOfWork>(unitOfWorkFactory, getRepositoryFunc, projection));
}
/// <summary>
/// Initializes a new instance of the ReadOnlyCollectionViewModel class.
/// This constructor is declared protected to avoid an undesired instantiation of the PeekCollectionViewModel type without the POCO proxy factory.
/// </summary>
/// <param name="unitOfWorkFactory">A factory used to create a unit of work instance.</param>
/// <param name="getRepositoryFunc">A function that returns a repository representing entities of the given type.</param>
/// <param name="projection">An optional parameter that provides a LINQ function used to customize a query for entities. The parameter, for example, can be used for sorting data.</param>
protected ReadOnlyCollectionViewModel(
IUnitOfWorkFactory<TUnitOfWork> unitOfWorkFactory,
Func<TUnitOfWork, IReadOnlyRepository<TEntity>> getRepositoryFunc,
Func<IRepositoryQuery<TEntity>, IQueryable<TEntity>> projection = null)
: base(unitOfWorkFactory, getRepositoryFunc, projection) {
}
}
/// <summary>
/// The base class for POCO view models exposing a read-only collection of entities of a given type.
/// This is a partial class that provides the extension point to add custom properties, commands and override methods without modifying the auto-generated code.
/// </summary>
/// <typeparam name="TEntity">A repository entity type.</typeparam>
/// <typeparam name="TProjection">A projection entity type.</typeparam>
/// <typeparam name="TUnitOfWork">A unit of work type.</typeparam>
public partial class ReadOnlyCollectionViewModel<TEntity, TProjection, TUnitOfWork> : ReadOnlyCollectionViewModelBase<TEntity, TProjection, TUnitOfWork>
where TEntity : class
where TProjection : class
where TUnitOfWork : IUnitOfWork {
/// <summary>
/// Creates a new instance of ReadOnlyCollectionViewModel as a POCO view model.
/// </summary>
/// <param name="unitOfWorkFactory">A factory used to create a unit of work instance.</param>
/// <param name="getRepositoryFunc">A function that returns the repository representing entities of a given type.</param>
/// <param name="projection">A LINQ function used to customize a query for entities. The parameter, for example, can be used for sorting data and/or for projecting data to a custom type that does not match the repository entity type.</param>
public static ReadOnlyCollectionViewModel<TEntity, TProjection, TUnitOfWork> CreateReadOnlyProjectionCollectionViewModel(
IUnitOfWorkFactory<TUnitOfWork> unitOfWorkFactory,
Func<TUnitOfWork, IReadOnlyRepository<TEntity>> getRepositoryFunc,
Func<IRepositoryQuery<TEntity>, IQueryable<TProjection>> projection) {
return ViewModelSource.Create(() => new ReadOnlyCollectionViewModel<TEntity, TProjection, TUnitOfWork>(unitOfWorkFactory, getRepositoryFunc, projection));
}
/// <summary>
/// Initializes a new instance of the ReadOnlyCollectionViewModel class.
/// This constructor is declared protected to avoid an undesired instantiation of the PeekCollectionViewModel type without the POCO proxy factory.
/// </summary>
/// <param name="unitOfWorkFactory">A factory used to create a unit of work instance.</param>
/// <param name="getRepositoryFunc">A function that returns the repository representing entities of a given type.</param>
/// <param name="projection">A LINQ function used to customize a query for entities. The parameter, for example, can be used for sorting data and/or for projecting data to a custom type that does not match the repository entity type.</param>
protected ReadOnlyCollectionViewModel(
IUnitOfWorkFactory<TUnitOfWork> unitOfWorkFactory,
Func<TUnitOfWork, IReadOnlyRepository<TEntity>> getRepositoryFunc,
Func<IRepositoryQuery<TEntity>, IQueryable<TProjection>> projection)
: base(unitOfWorkFactory, getRepositoryFunc, projection) {
}
}
/// <summary>
/// The base class for POCO view models exposing a read-only collection of entities of a given type.
/// It is not recommended to inherit directly from this class. Use the ReadOnlyCollectionViewModel class instead.
/// </summary>
/// <typeparam name="TEntity">A repository entity type.</typeparam>
/// <typeparam name="TProjection">A projection entity type.</typeparam>
/// <typeparam name="TUnitOfWork">A unit of work type.</typeparam>
[POCOViewModel]
public abstract class ReadOnlyCollectionViewModelBase<TEntity, TProjection, TUnitOfWork> : EntitiesViewModel<TEntity, TProjection, TUnitOfWork>
where TEntity : class
where TProjection : class
where TUnitOfWork : IUnitOfWork {
/// <summary>
/// Initializes a new instance of the ReadOnlyCollectionViewModelBase class.
/// </summary>
/// <param name="unitOfWorkFactory">A factory used to create a unit of work instance.</param>
/// <param name="getRepositoryFunc">A function that returns the repository representing entities of a given type.</param>
/// <param name="projection">A LINQ function used to customize a query for entities. The parameter, for example, can be used for sorting data and/or for projecting data to a custom type that does not match the repository entity type.</param>
protected ReadOnlyCollectionViewModelBase(
IUnitOfWorkFactory<TUnitOfWork> unitOfWorkFactory,
Func<TUnitOfWork, IReadOnlyRepository<TEntity>> getRepositoryFunc,
Func<IRepositoryQuery<TEntity>, IQueryable<TProjection>> projection
) : base(unitOfWorkFactory, getRepositoryFunc, projection) {
}
/// <summary>
/// The selected enity.
/// Since ReadOnlyCollectionViewModelBase is a POCO view model, this property will raise INotifyPropertyChanged.PropertyEvent when modified so it can be used as a binding source in views.
/// </summary>
public virtual TProjection SelectedEntity { get; set; }
/// <summary>
/// The lambda expression used to filter which entities will be loaded locally from the unit of work.
/// Since ReadOnlyCollectionViewModelBase is a POCO view model, this property will raise INotifyPropertyChanged.PropertyEvent when modified so it can be used as a binding source in views.
/// </summary>
public virtual Expression<Func<TEntity, bool>> FilterExpression { get; set; }
/// <summary>
/// Reloads entities.
/// Since CollectionViewModelBase is a POCO view model, an instance of this class will also expose the RefreshCommand property that can be used as a binding source in views.
/// </summary>
public virtual void Refresh() {
LoadEntities(false);
}
/// <summary>
/// Determines whether entities can be reloaded.
/// Since CollectionViewModelBase is a POCO view model, this method will be used as a CanExecute callback for RefreshCommand.
/// </summary>
public bool CanRefresh() {
return !IsLoading;
}
protected override void OnEntitiesAssigned(Func<TProjection> getSelectedEntityCallback) {
base.OnEntitiesAssigned(getSelectedEntityCallback);
SelectedEntity = getSelectedEntityCallback() ?? Entities.FirstOrDefault();
}
protected override Func<TProjection> GetSelectedEntityCallback() {
int selectedItemIndex = Entities.IndexOf(SelectedEntity);
return () => (selectedItemIndex >= 0 && selectedItemIndex < Entities.Count) ? Entities[selectedItemIndex] : null;
}
protected override void OnIsLoadingChanged() {
base.OnIsLoadingChanged();
this.RaiseCanExecuteChanged(x => x.Refresh());
}
protected virtual void OnSelectedEntityChanged() { }
protected virtual void OnFilterExpressionChanged() {
if(IsLoaded || IsLoading)
LoadEntities(true);
}
protected override Expression<Func<TEntity, bool>> GetFilterExpression() {
return FilterExpression;
}
}
}

View File

@@ -0,0 +1,27 @@
using System;
using DevExpress.Mvvm;
using DevExpress.Mvvm.DataAnnotations;
using DevExpress.Mvvm.POCO;
namespace DevExpress.DevAV.Common.ViewModel {
public class SingleObjectChildViewModel<TEntity> : ISupportParameter where TEntity : class {
public static SingleObjectChildViewModel<TEntity> Create() {
return ViewModelSource.Create(() => new SingleObjectChildViewModel<TEntity>());
}
protected SingleObjectChildViewModel() { }
public virtual TEntity Entity { get; set; }
public virtual bool IsEnabled { get; protected set; }
protected virtual void OnEntityChanged() {
IsEnabled = Entity != null;
}
#region ISupportParameter
object ISupportParameter.Parameter {
get { return Entity; }
set { Entity = (TEntity)value; }
}
#endregion
}
}

View File

@@ -0,0 +1,510 @@
using System;
using System.ComponentModel;
using System.ComponentModel.DataAnnotations;
using System.Collections.Generic;
using System.Linq;
using System.Linq.Expressions;
using DevExpress.Mvvm;
using DevExpress.Mvvm.POCO;
using DevExpress.Mvvm.DataAnnotations;
using DevExpress.DevAV.Common.Utils;
using DevExpress.Mvvm.DataModel;
namespace DevExpress.DevAV.Common.ViewModel {
/// <summary>
/// The base class for POCO view models exposing a single entity of a given type and CRUD operations against this entity.
/// This is a partial class that provides the extension point to add custom properties, commands and override methods without modifying the auto-generated code.
/// </summary>
/// <typeparam name="TEntity">An entity type.</typeparam>
/// <typeparam name="TPrimaryKey">A primary key value type.</typeparam>
/// <typeparam name="TUnitOfWork">A unit of work type.</typeparam>
public abstract partial class SingleObjectViewModel<TEntity, TPrimaryKey, TUnitOfWork> : SingleObjectViewModelBase<TEntity, TPrimaryKey, TUnitOfWork>
where TEntity : class
where TUnitOfWork : IUnitOfWork {
/// <summary>
/// Initializes a new instance of the SingleObjectViewModel class.
/// </summary>
/// <param name="unitOfWorkFactory">A factory used to create the unit of work instance.</param>
/// <param name="getRepositoryFunc">A function that returns the repository representing entities of a given type.</param>
/// <param name="getEntityDisplayNameFunc">An optional parameter that provides a function to obtain the display text for a given entity. If ommited, the primary key value is used as a display text.</param>
protected SingleObjectViewModel(IUnitOfWorkFactory<TUnitOfWork> unitOfWorkFactory, Func<TUnitOfWork, IRepository<TEntity, TPrimaryKey>> getRepositoryFunc, Func<TEntity, object> getEntityDisplayNameFunc = null)
: base(unitOfWorkFactory, getRepositoryFunc, getEntityDisplayNameFunc) {
}
}
/// <summary>
/// The base class for POCO view models exposing a single entity of a given type and CRUD operations against this entity.
/// It is not recommended to inherit directly from this class. Use the SingleObjectViewModel class instead.
/// </summary>
/// <typeparam name="TEntity">An entity type.</typeparam>
/// <typeparam name="TPrimaryKey">A primary key value type.</typeparam>
/// <typeparam name="TUnitOfWork">A unit of work type.</typeparam>
[POCOViewModel]
public abstract class SingleObjectViewModelBase<TEntity, TPrimaryKey, TUnitOfWork> : ISingleObjectViewModel<TEntity, TPrimaryKey>, ISupportParameter, IDocumentContent
where TEntity : class
where TUnitOfWork : IUnitOfWork {
object title;
protected readonly Func<TUnitOfWork, IRepository<TEntity, TPrimaryKey>> getRepositoryFunc;
protected readonly Func<TEntity, object> getEntityDisplayNameFunc;
Action<TEntity> entityInitializer;
bool isEntityNewAndUnmodified;
readonly Dictionary<string, IDocumentContent> lookUpViewModels = new Dictionary<string, IDocumentContent>();
/// <summary>
/// Initializes a new instance of the SingleObjectViewModelBase class.
/// </summary>
/// <param name="unitOfWorkFactory">A factory used to create the unit of work instance.</param>
/// <param name="getRepositoryFunc">A function that returns repository representing entities of a given type.</param>
/// <param name="getEntityDisplayNameFunc">An optional parameter that provides a function to obtain the display text for a given entity. If ommited, the primary key value is used as a display text.</param>
protected SingleObjectViewModelBase(IUnitOfWorkFactory<TUnitOfWork> unitOfWorkFactory, Func<TUnitOfWork, IRepository<TEntity, TPrimaryKey>> getRepositoryFunc, Func<TEntity, object> getEntityDisplayNameFunc) {
UnitOfWorkFactory = unitOfWorkFactory;
this.getRepositoryFunc = getRepositoryFunc;
this.getEntityDisplayNameFunc = getEntityDisplayNameFunc;
UpdateUnitOfWork();
if(this.IsInDesignMode())
this.Entity = this.Repository.FirstOrDefault();
else
OnInitializeInRuntime();
}
/// <summary>
/// The display text for a given entity used as a title in the corresponding view.
/// </summary>
/// <returns></returns>
public object Title { get { return title; } }
/// <summary>
/// An entity represented by this view model.
/// Since SingleObjectViewModelBase is a POCO view model, this property will raise INotifyPropertyChanged.PropertyEvent when modified so it can be used as a binding source in views.
/// </summary>
/// <returns></returns>
public virtual TEntity Entity { get; protected set; }
/// <summary>
/// Updates the Title property value and raises CanExecute changed for relevant commands.
/// Since SingleObjectViewModelBase is a POCO view model, an instance of this class will also expose the UpdateCommand property that can be used as a binding source in views.
/// </summary>
[Display(AutoGenerateField = false)]
public void Update() {
isEntityNewAndUnmodified = false;
UpdateTitle();
UpdateCommands();
}
/// <summary>
/// Saves changes in the underlying unit of work.
/// Since SingleObjectViewModelBase is a POCO view model, an instance of this class will also expose the SaveCommand property that can be used as a binding source in views.
/// </summary>
public virtual void Save() {
SaveCore();
}
/// <summary>
/// Determines whether entity has local changes that can be saved.
/// Since SingleObjectViewModelBase is a POCO view model, this method will be used as a CanExecute callback for SaveCommand.
/// </summary>
public virtual bool CanSave() {
return Entity != null && !HasValidationErrors() && NeedSave();
}
/// <summary>
/// Saves changes in the underlying unit of work and closes the corresponding view.
/// Since SingleObjectViewModelBase is a POCO view model, an instance of this class will also expose the SaveAndCloseCommand property that can be used as a binding source in views.
/// </summary>
[Command(CanExecuteMethodName = "CanSave")]
public void SaveAndClose() {
if(SaveCore())
Close();
}
/// <summary>
/// Saves changes in the underlying unit of work and create new entity.
/// Since SingleObjectViewModelBase is a POCO view model, an instance of this class will also expose the SaveAndNewCommand property that can be used as a binding source in views.
/// </summary>
[Command(CanExecuteMethodName = "CanSave")]
public void SaveAndNew() {
if(SaveCore())
CreateAndInitializeEntity(this.entityInitializer);
}
/// <summary>
/// Reset entity local changes.
/// Since SingleObjectViewModelBase is a POCO view model, an instance of this class will also expose the ResetCommand property that can be used as a binding source in views.
/// </summary>
[Display(Name = "Reset Changes")]
public void Reset() {
MessageResult confirmationResult = MessageBoxService.ShowMessage(CommonResources.Confirmation_Reset, CommonResources.Confirmation_Caption, MessageButton.OKCancel);
if(confirmationResult == MessageResult.OK)
Reload();
}
/// <summary>
/// Determines whether entity has local changes.
/// Since SingleObjectViewModelBase is a POCO view model, this method will be used as a CanExecute callback for ResetCommand.
/// </summary>
public bool CanReset() {
return NeedReset();
}
/// <summary>
/// Deletes the entity, save changes and closes the corresponding view if confirmed by a user.
/// Since SingleObjectViewModelBase is a POCO view model, an instance of this class will also expose the DeleteCommand property that can be used as a binding source in views.
/// </summary>
public virtual void Delete() {
if(MessageBoxService.ShowMessage(string.Format(CommonResources.Confirmation_Delete, typeof(TEntity).Name), GetConfirmationMessageTitle(), MessageButton.YesNo) != MessageResult.Yes)
return;
try {
OnBeforeEntityDeleted(PrimaryKey, Entity);
Repository.Remove(Entity);
UnitOfWork.SaveChanges();
TPrimaryKey primaryKeyForMessage = PrimaryKey;
TEntity entityForMessage = Entity;
Entity = null;
OnEntityDeleted(primaryKeyForMessage, entityForMessage);
Close();
} catch (DbException e) {
MessageBoxService.ShowMessage(e.ErrorMessage, e.ErrorCaption, MessageButton.OK, MessageIcon.Error);
}
}
/// <summary>
/// Determines whether the entity can be deleted.
/// Since SingleObjectViewModelBase is a POCO view model, this method will be used as a CanExecute callback for DeleteCommand.
/// </summary>
public virtual bool CanDelete() {
return Entity != null && !IsNew();
}
/// <summary>
/// Closes the corresponding view.
/// Since SingleObjectViewModelBase is a POCO view model, an instance of this class will also expose the CloseCommand property that can be used as a binding source in views.
/// </summary>
public void Close() {
if(!TryClose())
return;
if(DocumentOwner != null)
DocumentOwner.Close(this);
}
protected IUnitOfWorkFactory<TUnitOfWork> UnitOfWorkFactory { get; private set; }
protected TUnitOfWork UnitOfWork { get; private set; }
protected virtual bool SaveCore() {
try {
bool isNewEntity = IsNew();
if(!isNewEntity) {
Repository.SetPrimaryKey(Entity, PrimaryKey);
Repository.Update(Entity);
}
OnBeforeEntitySaved(PrimaryKey, Entity, isNewEntity);
UnitOfWork.SaveChanges();
LoadEntityByKey(Repository.GetPrimaryKey(Entity));
OnEntitySaved(PrimaryKey, Entity, isNewEntity);
return true;
} catch (DbException e) {
MessageBoxService.ShowMessage(e.ErrorMessage, e.ErrorCaption, MessageButton.OK, MessageIcon.Error);
return false;
}
}
protected virtual void OnBeforeEntitySaved(TPrimaryKey primaryKey, TEntity entity, bool isNewEntity) { }
protected virtual void OnEntitySaved(TPrimaryKey primaryKey, TEntity entity, bool isNewEntity) {
Messenger.Default.Send(new EntityMessage<TEntity, TPrimaryKey>(primaryKey, isNewEntity ? EntityMessageType.Added : EntityMessageType.Changed));
}
protected virtual void OnBeforeEntityDeleted(TPrimaryKey primaryKey, TEntity entity) { }
protected virtual void OnEntityDeleted(TPrimaryKey primaryKey, TEntity entity) {
Messenger.Default.Send(new EntityMessage<TEntity, TPrimaryKey>(primaryKey, EntityMessageType.Deleted));
}
protected virtual void OnInitializeInRuntime() {
Messenger.Default.Register<EntityMessage<TEntity, TPrimaryKey>>(this, x => OnEntityMessage(x));
Messenger.Default.Register<SaveAllMessage>(this, x => Save());
Messenger.Default.Register<CloseAllMessage>(this, x => OnClosing(x));
}
protected virtual void OnEntityMessage(EntityMessage<TEntity, TPrimaryKey> message) {
if(Entity == null) return;
if(message.MessageType == EntityMessageType.Deleted && object.Equals(message.PrimaryKey, PrimaryKey))
Close();
}
protected virtual void OnEntityChanged() {
if(Entity != null && Repository.HasPrimaryKey(Entity)) {
PrimaryKey = Repository.GetPrimaryKey(Entity);
RefreshLookUpCollections(true);
}
Update();
}
protected IRepository<TEntity, TPrimaryKey> Repository { get { return getRepositoryFunc(UnitOfWork); } }
protected TPrimaryKey PrimaryKey { get; private set; }
protected IMessageBoxService MessageBoxService { get { return this.GetRequiredService<IMessageBoxService>(); } }
protected virtual void OnParameterChanged(object parameter) {
var initializer = parameter as Action<TEntity>;
if(initializer != null)
CreateAndInitializeEntity(initializer);
else if(parameter is TPrimaryKey)
LoadEntityByKey((TPrimaryKey)parameter);
else
Entity = null;
}
protected virtual TEntity CreateEntity() {
return Repository.Create();
}
protected void Reload() {
if(Entity == null || IsNew())
CreateAndInitializeEntity(this.entityInitializer);
else
LoadEntityByKey(PrimaryKey);
}
protected void CreateAndInitializeEntity(Action<TEntity> entityInitializer) {
UpdateUnitOfWork();
this.entityInitializer = entityInitializer;
var entity = CreateEntity();
if(this.entityInitializer != null)
this.entityInitializer(entity);
Entity = entity;
isEntityNewAndUnmodified = true;
}
protected void LoadEntityByKey(TPrimaryKey primaryKey) {
UpdateUnitOfWork();
Entity = Repository.Find(primaryKey);
}
void UpdateUnitOfWork() {
UnitOfWork = UnitOfWorkFactory.CreateUnitOfWork();
}
void UpdateTitle() {
if(Entity == null)
title = null;
else if(IsNew())
title = GetTitleForNewEntity();
else
title = GetTitle(GetState() == EntityState.Modified);
this.RaisePropertyChanged(x => x.Title);
}
protected virtual void UpdateCommands() {
this.RaiseCanExecuteChanged(x => x.Save());
this.RaiseCanExecuteChanged(x => x.SaveAndClose());
this.RaiseCanExecuteChanged(x => x.SaveAndNew());
this.RaiseCanExecuteChanged(x => x.Delete());
this.RaiseCanExecuteChanged(x => x.Reset());
}
protected IDocumentOwner DocumentOwner { get; private set; }
protected virtual void OnDestroy() {
Messenger.Default.Unregister(this);
RefreshLookUpCollections(false);
}
protected virtual bool TryClose() {
if(HasValidationErrors()) {
MessageResult warningResult = MessageBoxService.ShowMessage(CommonResources.Warning_SomeFieldsContainInvalidData, CommonResources.Warning_Caption, MessageButton.OKCancel);
return warningResult == MessageResult.OK;
}
if(!NeedReset()) return true;
MessageResult result = MessageBoxService.ShowMessage(CommonResources.Confirmation_Save, GetConfirmationMessageTitle(), MessageButton.YesNoCancel);
if(result == MessageResult.Yes)
return SaveCore();
return result != MessageResult.Cancel;
}
protected virtual void OnClosing(CloseAllMessage message) {
if(!message.Cancel)
message.Cancel = !TryClose();
}
protected virtual string GetConfirmationMessageTitle() {
return GetTitle();
}
protected bool IsNew() {
return GetState() == EntityState.Added;
}
protected virtual bool NeedSave() {
if(Entity == null)
return false;
EntityState state = GetState();
return state == EntityState.Modified || state == EntityState.Added;
}
protected virtual bool NeedReset() {
return NeedSave() && !isEntityNewAndUnmodified;
}
protected virtual bool HasValidationErrors() {
IDataErrorInfo dataErrorInfo = Entity as IDataErrorInfo;
return dataErrorInfo != null && IDataErrorInfoHelper.HasErrors(dataErrorInfo);
}
string GetTitle(bool entityModified) {
return GetTitle() + (entityModified ? CommonResources.Entity_Changed : string.Empty);
}
protected virtual string GetTitleForNewEntity() {
return typeof(TEntity).Name + CommonResources.Entity_New;
}
protected virtual string GetTitle() {
return (typeof(TEntity).Name + " - " + Convert.ToString(getEntityDisplayNameFunc != null ? getEntityDisplayNameFunc(Entity) : PrimaryKey))
.Split(new string[] { "\r", "\n" }, StringSplitOptions.RemoveEmptyEntries).FirstOrDefault();
}
protected EntityState GetState() {
try {
return Repository.GetState(Entity);
} catch(InvalidOperationException) {
Repository.SetPrimaryKey(Entity, PrimaryKey);
return Repository.GetState(Entity);
}
}
#region look up and detail view models
protected virtual void RefreshLookUpCollections(bool raisePropertyChanged) {
var values = lookUpViewModels.ToArray();
lookUpViewModels.Clear();
foreach(var item in values) {
item.Value.OnDestroy();
if(raisePropertyChanged)
((IPOCOViewModel)this).RaisePropertyChanged(item.Key);
}
}
protected CollectionViewModel<TDetailEntity, TDetailPrimaryKey, TUnitOfWork> GetDetailsCollectionViewModel<TViewModel, TDetailEntity, TDetailPrimaryKey, TForeignKey>(
Expression<Func<TViewModel, CollectionViewModel<TDetailEntity, TDetailPrimaryKey, TUnitOfWork>>> propertyExpression,
Func<TUnitOfWork, IRepository<TDetailEntity, TDetailPrimaryKey>> getRepositoryFunc,
Expression<Func<TDetailEntity, TForeignKey>> foreignKeyExpression,
Action<TDetailEntity, TPrimaryKey> setMasterEntityKeyAction,
Func<IRepositoryQuery<TDetailEntity>, IQueryable<TDetailEntity>> projection = null) where TDetailEntity : class {
return GetCollectionViewModelCore<CollectionViewModel<TDetailEntity, TDetailPrimaryKey, TUnitOfWork>, TDetailEntity, TDetailEntity, TForeignKey>(propertyExpression, foreignKeyExpression,
() => CollectionViewModel<TDetailEntity, TDetailPrimaryKey, TUnitOfWork>.CreateCollectionViewModel(UnitOfWorkFactory, getRepositoryFunc, projection, CreateForeignKeyPropertyInitializer(setMasterEntityKeyAction, PrimaryKey), true));
}
protected CollectionViewModel<TDetailEntity, TDetailProjection, TDetailPrimaryKey, TUnitOfWork> GetDetailProjectionsCollectionViewModel<TViewModel, TDetailEntity, TDetailProjection, TDetailPrimaryKey, TForeignKey>(
Expression<Func<TViewModel, CollectionViewModel<TDetailEntity, TDetailProjection, TDetailPrimaryKey, TUnitOfWork>>> propertyExpression,
Func<TUnitOfWork, IRepository<TDetailEntity, TDetailPrimaryKey>> getRepositoryFunc,
Expression<Func<TDetailEntity, TForeignKey>> foreignKeyExpression,
Action<TDetailEntity, TPrimaryKey> setMasterEntityKeyAction,
Func<IRepositoryQuery<TDetailEntity>, IQueryable<TDetailProjection>> projection = null) where TDetailEntity : class where TDetailProjection : class {
return GetCollectionViewModelCore<CollectionViewModel<TDetailEntity, TDetailProjection, TDetailPrimaryKey, TUnitOfWork>, TDetailEntity, TDetailProjection, TForeignKey>(propertyExpression, foreignKeyExpression,
() => CollectionViewModel<TDetailEntity, TDetailProjection, TDetailPrimaryKey, TUnitOfWork>.CreateProjectionCollectionViewModel(UnitOfWorkFactory, getRepositoryFunc, projection, CreateForeignKeyPropertyInitializer(setMasterEntityKeyAction, PrimaryKey), true));
}
protected ReadOnlyCollectionViewModel<TDetailEntity, TUnitOfWork> GetReadOnlyDetailsCollectionViewModel<TViewModel, TDetailEntity, TForeignKey>(
Expression<Func<TViewModel, ReadOnlyCollectionViewModel<TDetailEntity, TDetailEntity, TUnitOfWork>>> propertyExpression,
Func<TUnitOfWork, IReadOnlyRepository<TDetailEntity>> getRepositoryFunc,
Expression<Func<TDetailEntity, TForeignKey>> foreignKeyExpression,
Func<IRepositoryQuery<TDetailEntity>, IQueryable<TDetailEntity>> projection = null) where TDetailEntity : class {
return GetCollectionViewModelCore<ReadOnlyCollectionViewModel<TDetailEntity, TUnitOfWork>, TDetailEntity, TDetailEntity, TForeignKey>(propertyExpression, foreignKeyExpression,
() => ReadOnlyCollectionViewModel<TDetailEntity, TUnitOfWork>.CreateReadOnlyCollectionViewModel(UnitOfWorkFactory, getRepositoryFunc, projection));
}
protected ReadOnlyCollectionViewModel<TDetailEntity, TDetailProjection, TUnitOfWork> GetReadOnlyDetailProjectionsCollectionViewModel<TViewModel, TDetailEntity, TDetailProjection, TForeignKey>(
Expression<Func<TViewModel, ReadOnlyCollectionViewModel<TDetailEntity, TDetailProjection, TUnitOfWork>>> propertyExpression,
Func<TUnitOfWork, IReadOnlyRepository<TDetailEntity>> getRepositoryFunc,
Expression<Func<TDetailEntity, TForeignKey>> foreignKeyExpression,
Func<IRepositoryQuery<TDetailEntity>, IQueryable<TDetailProjection>> projection) where TDetailEntity : class where TDetailProjection : class {
return GetCollectionViewModelCore<ReadOnlyCollectionViewModel<TDetailEntity, TDetailProjection, TUnitOfWork>, TDetailEntity, TDetailProjection, TForeignKey>(propertyExpression, foreignKeyExpression,
() => ReadOnlyCollectionViewModel<TDetailEntity, TDetailProjection, TUnitOfWork>.CreateReadOnlyProjectionCollectionViewModel(UnitOfWorkFactory, getRepositoryFunc, projection));
}
protected IEntitiesViewModel<TLookUpEntity> GetLookUpEntitiesViewModel<TViewModel, TLookUpEntity, TLookUpEntityKey>(Expression<Func<TViewModel, IEntitiesViewModel<TLookUpEntity>>> propertyExpression, Func<TUnitOfWork, IRepository<TLookUpEntity, TLookUpEntityKey>> getRepositoryFunc, Func<IRepositoryQuery<TLookUpEntity>, IQueryable<TLookUpEntity>> projection = null) where TLookUpEntity : class {
return GetLookUpProjectionsViewModel(propertyExpression, getRepositoryFunc, projection);
}
protected virtual IEntitiesViewModel<TLookUpProjection> GetLookUpProjectionsViewModel<TViewModel, TLookUpEntity, TLookUpProjection, TLookUpEntityKey>(Expression<Func<TViewModel, IEntitiesViewModel<TLookUpProjection>>> propertyExpression, Func<TUnitOfWork, IRepository<TLookUpEntity, TLookUpEntityKey>> getRepositoryFunc, Func<IRepositoryQuery<TLookUpEntity>, IQueryable<TLookUpProjection>> projection) where TLookUpEntity : class where TLookUpProjection : class {
return GetEntitiesViewModelCore<IEntitiesViewModel<TLookUpProjection>, TLookUpProjection>(propertyExpression, () => LookUpEntitiesViewModel<TLookUpEntity, TLookUpProjection, TLookUpEntityKey, TUnitOfWork>.Create(UnitOfWorkFactory, getRepositoryFunc, projection));
}
static Action<TDetailEntity> CreateForeignKeyPropertyInitializer<TDetailEntity, TForeignKey>(Action<TDetailEntity, TPrimaryKey> setMasterEntityKeyAction, TForeignKey masterEntityKey) where TDetailEntity : class {
return x => setMasterEntityKeyAction(x, (TPrimaryKey)(object)masterEntityKey);
}
TViewModel GetCollectionViewModelCore<TViewModel, TDetailEntity, TDetailProjection, TForeignKey>(
LambdaExpression propertyExpression,
Expression<Func<TDetailEntity, TForeignKey>> foreignKeyExpression,
Func<TViewModel> createViewModelCallback)
where TViewModel : ReadOnlyCollectionViewModel<TDetailEntity, TDetailProjection, TUnitOfWork>
where TDetailEntity : class
where TDetailProjection : class {
return GetEntitiesViewModelCore<TViewModel, TDetailProjection>(propertyExpression,
() => CreateAndInitializeCollectionViewModel<TViewModel, TDetailEntity, TDetailProjection, TForeignKey>(createViewModelCallback, foreignKeyExpression));
}
TViewModel CreateAndInitializeCollectionViewModel<TViewModel, TDetailEntity, TDetailProjection, TForeignKey>(Func<TViewModel> createViewModelCallback, Expression<Func<TDetailEntity, TForeignKey>> foreignKeyExpression)
where TViewModel : ReadOnlyCollectionViewModel<TDetailEntity, TDetailProjection, TUnitOfWork>
where TDetailEntity : class
where TDetailProjection : class {
TViewModel lookUpViewModel = createViewModelCallback().SetParentViewModel(this);
lookUpViewModel.FilterExpression = ExpressionHelper.GetValueEqualsExpression(foreignKeyExpression, (TForeignKey)(object)PrimaryKey);
return lookUpViewModel;
}
TViewModel GetEntitiesViewModelCore<TViewModel, TDetailEntity>(LambdaExpression propertyExpression, Func<TViewModel> createViewModelCallback)
where TViewModel : IEntitiesViewModel<TDetailEntity>
where TDetailEntity : class {
IDocumentContent result = null;
string propertyName = ExpressionHelper.GetPropertyName(propertyExpression);
if(!lookUpViewModels.TryGetValue(propertyName, out result)) {
result = createViewModelCallback();
lookUpViewModels[propertyName] = result;
}
return (TViewModel)result;
}
#endregion
#region ISupportParameter
object ISupportParameter.Parameter {
get { return null; }
set { OnParameterChanged(value); }
}
#endregion
#region IDocumentContent
object IDocumentContent.Title { get { return Title; } }
void IDocumentContent.OnClose(CancelEventArgs e) {
e.Cancel = !TryClose();
}
void IDocumentContent.OnDestroy() {
OnDestroy();
}
IDocumentOwner IDocumentContent.DocumentOwner {
get { return DocumentOwner; }
set { DocumentOwner = value; }
}
#endregion
#region ISingleObjectViewModel
TEntity ISingleObjectViewModel<TEntity, TPrimaryKey>.Entity { get { return Entity; } }
TPrimaryKey ISingleObjectViewModel<TEntity, TPrimaryKey>.PrimaryKey { get { return PrimaryKey; } }
#endregion
}
}

View File

@@ -0,0 +1,40 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Windows;
using DevExpress.Mvvm;
using DevExpress.Mvvm.DataAnnotations;
using DevExpress.Mvvm.POCO;
using DevExpress.Mvvm.DataModel;
namespace DevExpress.DevAV.Common.ViewModel {
partial class SingleObjectViewModel<TEntity, TPrimaryKey, TUnitOfWork>
where TEntity : class
where TUnitOfWork : IUnitOfWork {
protected virtual bool EnableSelectedItemSynchronization {
get { return false; }
}
protected override void OnInitializeInRuntime() {
base.OnInitializeInRuntime();
if(EnableSelectedItemSynchronization)
SubscribeSelectedItemSynchronizationMessage();
}
protected void SubscribeSelectedItemSynchronizationMessage() {
Messenger.Default.Register<SelectedItemSynchronizationMessage<TEntity>>(this, x => OnSelectedItemSynchronizationMessage(x));
}
protected virtual void OnSelectedItemSynchronizationMessage(SelectedItemSynchronizationMessage<TEntity> m) {
if(m.Entity == null) Entity = null;
else OnParameterChanged(Repository.GetPrimaryKey(m.Entity));
}
protected virtual bool EnableEntityChangedSynchronization {
get { return false; }
}
protected override void OnEntityMessage(EntityMessage<TEntity, TPrimaryKey> msg) {
if(EnableEntityChangedSynchronization && msg.MessageType == EntityMessageType.Changed) {
if(object.Equals(msg.PrimaryKey, PrimaryKey))
Reload();
}
base.OnEntityMessage(msg);
}
}
}

View File

@@ -0,0 +1,80 @@
namespace DevExpress.DevAV {
using System.Collections.Generic;
using System.Drawing;
using DevExpress.Mvvm.DataModel;
using DevExpress.DevAV.Common.ViewModel;
using DevExpress.XtraGrid.Views.Base;
class ColumnViewHelper<TEntity, TID, TUnitOfWork>
where TEntity : class
where TUnitOfWork : class, IUnitOfWork {
CollectionViewModelBase<TEntity, TEntity, TID, TUnitOfWork> viewModel;
ColumnView view;
public ColumnViewHelper(ColumnView view, CollectionViewModel<TEntity, TID, TUnitOfWork> viewModel) {
this.view = view;
this.viewModel = viewModel;
}
public IEnumerable<TEntity> GetSelection() {
int[] rowHandles = view.GetSelectedRows();
TEntity[] entities = new TEntity[rowHandles.Length];
for(int i = 0; i < entities.Length; i++)
entities[i] = view.GetRow(rowHandles[i]) as TEntity;
return entities;
}
public void PopulateEntityMenu(DevExpress.Utils.Menu.DXPopupMenu menu, int rowHandle) {
if(!view.IsDataRow(rowHandle)) return;
TEntity entity = view.GetRow(rowHandle) as TEntity;
if(entity != null)
CreateEntityMenu(menu, entity);
}
public bool ShowEntityMenu(Point pt, int rowHandle) {
TEntity entity = view.GetRow(rowHandle) as TEntity;
if(entity != null) {
var rowMenu = new Utils.Menu.DXPopupMenu();
CreateEntityMenu(rowMenu, entity);
DevExpress.Utils.Menu.MenuManagerHelper.ShowMenu(rowMenu, view.GridControl.LookAndFeel,
view.GridControl.MenuManager, view.GridControl, pt);
return true;
}
return false;
}
public bool EditEntity(int rowHandle) {
if(!view.IsDataRow(rowHandle)) return false;
TEntity entity = view.GetRow(rowHandle) as TEntity;
if(entity != null && viewModel.CanEdit(entity)) {
viewModel.Edit(entity);
return true;
}
return false;
}
public bool IsEntity(int rowHandle) {
if(!view.IsValidRowHandle(rowHandle)) return false;
return view.IsDataRow(rowHandle);
}
public bool SelectEntity(int rowHandle) {
if(!view.IsValidRowHandle(rowHandle)) return false;
if(view.IsDataRow(rowHandle))
viewModel.SelectedEntity = view.GetRow(rowHandle) as TEntity;
else
viewModel.SelectedEntity = null;
return true;
}
protected void CreateEntityMenu(DevExpress.Utils.Menu.DXPopupMenu rowMenu, TEntity entity) {
var newItem = new Utils.Menu.DXMenuItem();
newItem.Caption = "New";
newItem.BindCommand(() => viewModel.New(), viewModel);
var editItem = new Utils.Menu.DXMenuItem();
editItem.Caption = "Edit...";
editItem.BindCommand((ee) => viewModel.Edit(ee), viewModel, () => entity);
var deleteItem = new Utils.Menu.DXMenuItem();
deleteItem.Caption = "Delete";
deleteItem.BindCommand((ee) => viewModel.Delete(ee), viewModel, () => entity);
rowMenu.Items.Add(newItem);
rowMenu.Items.Add(editItem);
rowMenu.Items.Add(deleteItem);
}
}
}

View File

@@ -0,0 +1,80 @@
namespace DevExpress.DevAV.Modules {
using DevExpress.Mvvm.DataModel;
using DevExpress.DevAV.ViewModels;
using DevExpress.Utils.Menu;
using DevExpress.XtraTreeList;
using DevExpress.XtraTreeList.Nodes;
class FilterTreeListHelper<TEntity, TID, TUnitOfWork>
where TEntity : class
where TUnitOfWork : class, IUnitOfWork {
TreeList treeList;
public FilterTreeListHelper(XtraTreeList.TreeList treeList) {
this.treeList = treeList;
}
public void ModifyFilter(TreeListNode node, FilterTreeViewModel<TEntity, TID, TUnitOfWork> viewModel) {
if(node != null && node.ParentNode != null) {
if(MatchHierarchy(node, viewModel.CustomFilters))
viewModel.Modify(GetRow<FilterTreeViewModel<TEntity, TID, TUnitOfWork>.FilterItem>(node));
if(MatchHierarchy(node, viewModel.Groups))
viewModel.ModifyGroup(GetRow<FilterTreeViewModel<TEntity, TID, TUnitOfWork>.FilterItem>(node));
}
}
public bool PopulateFiltersMenu(DXPopupMenu nodeMenu, TreeListNode node, FilterTreeViewModel<TEntity, TID, TUnitOfWork> viewModel) {
if(MatchHierarchy(node, viewModel.CustomFilters)) {
var newItem = new DXMenuItem();
newItem.Caption = "New...";
newItem.BindCommand(() => viewModel.New(), viewModel);
nodeMenu.Items.Add(newItem);
if(node.ParentNode != null) {
var filterItem = GetRow<FilterTreeViewModel<TEntity, TID, TUnitOfWork>.FilterItem>(node);
var editItem = new DXMenuItem();
editItem.Caption = "Modify...";
editItem.BindCommand((f) => viewModel.Modify(f), viewModel, () => filterItem);
nodeMenu.Items.Add(editItem);
var deleteItem = new DXMenuItem();
deleteItem.Caption = "Delete";
deleteItem.BindCommand((f) => viewModel.Delete(f), viewModel, () => filterItem);
nodeMenu.Items.Add(deleteItem);
}
return true;
}
if(MatchHierarchy(node, viewModel.Groups)) {
var newItem = new DXMenuItem();
newItem.Caption = "New Group...";
newItem.BindCommand(() => viewModel.NewGroup(), viewModel);
nodeMenu.Items.Add(newItem);
if(node.ParentNode != null) {
var filterItem = GetRow<FilterTreeViewModel<TEntity, TID, TUnitOfWork>.FilterItem>(node);
var editItem = new DXMenuItem();
editItem.Caption = "Modify Group...";
editItem.BindCommand((f) => viewModel.ModifyGroup(f), viewModel, () => filterItem);
nodeMenu.Items.Add(editItem);
var deleteItem = new DXMenuItem();
deleteItem.Caption = "Delete Group";
deleteItem.BindCommand((f) => viewModel.DeleteGroup(f), viewModel, () => filterItem);
nodeMenu.Items.Add(deleteItem);
}
return true;
}
return false;
}
public TreeListNode FindNode(object dataItem) {
return treeList.FindNode((node) => Match(node, dataItem));
}
public bool Match(TreeListNode node, object dataItem) {
return treeList.GetDataRecordByNode(node) == dataItem;
}
public bool MatchHierarchy(TreeListNode node, object dataItem) {
while(node != null) {
if(Match(node, dataItem))
return true;
node = node.ParentNode;
}
return false;
}
public T GetRow<T>(TreeListNode node) where T : class {
return treeList.GetDataRecordByNode(node) as T;
}
}
}

View File

@@ -0,0 +1,748 @@
using System;
using System.Collections.Generic;
using System.Drawing;
using System.Linq.Expressions;
using System.Windows.Forms;
using DevExpress.Data.Filtering.Helpers;
using DevExpress.DevAV.Common.Utils;
using DevExpress.Skins;
using DevExpress.Utils;
using DevExpress.XtraBars;
using DevExpress.XtraEditors;
using DevExpress.XtraEditors.Controls;
using DevExpress.XtraEditors.Filtering;
using DevExpress.XtraEditors.Repository;
using DevExpress.XtraGrid;
using DevExpress.XtraGrid.Controls;
using DevExpress.XtraGrid.Views.Grid;
using DevExpress.XtraLayout;
using DevExpress.Utils.Svg;
namespace DevExpress.DevAV {
class TaskPreviewGridView : GridView {
float rowFontSize = AppearanceObject.DefaultFont.Size;
public TaskPreviewGridView() {
Appearance.Row.Font = FontResources.GetSegoeUIFont(4);
OptionsSelection.EnableAppearanceHideSelection = false;
OptionsView.AutoCalcPreviewLineCount = true;
OptionsView.EnableAppearanceEvenRow = true;
OptionsView.ShowGroupPanel = false;
OptionsView.ShowHorizontalLines = DevExpress.Utils.DefaultBoolean.False;
OptionsView.ShowIndicator = false;
OptionsView.ShowPreview = true;
OptionsView.ShowVerticalLines = DevExpress.Utils.DefaultBoolean.False;
PreviewIndent = 0;
this.RowCellStyle += (s, e) => {
e.Appearance.Font = FontResources.GetFont(e.Appearance.Font.FontFamily.Name, rowFontSize, e.Appearance.Font.Style);
if(e.RowHandle == FocusedRowHandle && GridControl.Focused)
e.Appearance.BackColor = PaintAppearance.FocusedRow.BackColor;
else SetEvenRowAppearance(e.Appearance, e.RowHandle);
};
this.CustomDrawRowPreview += (s, e) => {
if(e.RowHandle == FocusedRowHandle && GridControl.Focused) {
e.Appearance.BackColor = PaintAppearance.FocusedRow.BackColor;
e.Appearance.ForeColor = PaintAppearance.FocusedRow.ForeColor;
}
else SetEvenRowAppearance(e.Appearance, e.RowHandle);
};
}
void SetEvenRowAppearance(AppearanceObject appearance, int rowHandle) {
if(rowHandle % 2 == 0) {
appearance.BackColor = PaintAppearance.EvenRow.BackColor;
appearance.ForeColor = PaintAppearance.EvenRow.ForeColor;
}
else {
appearance.BackColor = PaintAppearance.Row.BackColor;
appearance.ForeColor = PaintAppearance.Row.ForeColor;
}
}
public void SetViewFontSize(float rowFontSize, float previewFontSize) {
if(previewFontSize > 0)
Appearance.Preview.Font = FontResources.GetSegoeUIFont(previewFontSize);
if(rowFontSize > 0) {
this.rowFontSize += rowFontSize;
Appearance.Row.Font = FontResources.GetSegoeUIFont(4);
}
}
protected override bool IsAllowPixelScrollingPreview {
get { return true; }
}
}
class ZoomLevelManager {
ZoomTrackBarControl zoomControlCore;
int zoomLevelCore = 0;
static int[] zoomValues = new int[] { 100, 110, 125, 150, 175, 200, 250, 300, 350, 400, 500 };
BarEditItem editItem;
BarButtonItem captionItem;
IZoomViewModel viewModel;
public ZoomLevelManager(BarEditItem beItem, BarButtonItem captionItem, IZoomViewModel viewModel) {
this.viewModel = viewModel;
if(viewModel != null)
viewModel.ZoomModuleChanged += viewModel_SelectedModuleChanged;
this.editItem = beItem;
this.captionItem = captionItem;
if(editItem != null) {
editItem.HiddenEditor += beiZoom_HiddenEditor;
editItem.ShownEditor += beiZoom_ShownEditor;
}
}
ISupportZoom zoomModule;
void viewModel_SelectedModuleChanged(object sender, EventArgs e) {
if(zoomModule != null)
zoomModule.ZoomChanged -= zoomModule_ZoomChanged;
UpdateZoomLevelFromModule();
zoomModule = viewModel.ZoomModule as ISupportZoom;
if(zoomModule != null)
zoomModule.ZoomChanged += zoomModule_ZoomChanged;
}
ZoomTrackBarControl ZoomControl {
get { return zoomControlCore; }
}
public int ZoomLevel {
get { return zoomLevelCore; }
set {
if(ZoomLevel == value) return;
zoomLevelCore = value;
OnZoomLevelChanged(value);
}
}
void OnZoomLevelChanged(int value) {
int index = Array.IndexOf(zoomValues, value);
if(index == -1)
value = (value / 10);
else value = 10 + index;
editItem.EditValue = value;
captionItem.Caption = string.Format(" {0}%", ZoomLevel);
UpdateModuleZoomLevel();
}
void UpdateModuleZoomLevel() {
ISupportZoom supportZoom = viewModel.ZoomModule as ISupportZoom;
if(supportZoom != null)
supportZoom.ZoomLevel = ZoomLevel;
}
void UpdateZoomLevelFromModule() {
ISupportZoom supportZoom = viewModel.ZoomModule as ISupportZoom;
if(supportZoom != null)
ZoomLevel = supportZoom.ZoomLevel;
editItem.Visibility = captionItem.Visibility = (supportZoom != null) ? BarItemVisibility.Always : BarItemVisibility.Never;
}
void zoomModule_ZoomChanged(object sender, EventArgs e) {
UpdateZoomLevelFromModule();
}
void beiZoom_ShownEditor(object sender, ItemClickEventArgs e) {
this.zoomControlCore = editItem.Manager.ActiveEditor as ZoomTrackBarControl;
if(ZoomControl != null) {
ZoomControl.ValueChanged += OnZoomValueChanged;
OnZoomValueChanged(ZoomControl, EventArgs.Empty);
}
}
void beiZoom_HiddenEditor(object sender, ItemClickEventArgs e) {
ZoomControl.ValueChanged -= OnZoomValueChanged;
this.zoomControlCore = null;
}
void OnZoomValueChanged(object sender, EventArgs e) {
int val = ZoomControl.Value * 10;
if(ZoomControl.Value > 10) val = zoomValues[ZoomControl.Value - 10];
ZoomLevel = val;
}
}
static class GalleryItemAppearances {
public static void Apply(RibbonGalleryBarItem galleryItem) {
galleryItem.Gallery.Appearance.ItemCaptionAppearance.Normal.Font = AppearanceObject.DefaultFont;
galleryItem.Gallery.Appearance.ItemCaptionAppearance.Normal.Options.UseFont = true;
galleryItem.Gallery.Appearance.ItemCaptionAppearance.Normal.TextOptions.HAlignment = HorzAlignment.Near;
galleryItem.Gallery.Appearance.ItemCaptionAppearance.Normal.Options.UseTextOptions = true;
galleryItem.Gallery.Appearance.ItemCaptionAppearance.Hovered.Font = AppearanceObject.DefaultFont;
galleryItem.Gallery.Appearance.ItemCaptionAppearance.Hovered.Options.UseFont = true;
galleryItem.Gallery.Appearance.ItemCaptionAppearance.Hovered.TextOptions.HAlignment = HorzAlignment.Near;
galleryItem.Gallery.Appearance.ItemCaptionAppearance.Hovered.Options.UseTextOptions = true;
galleryItem.Gallery.Appearance.ItemCaptionAppearance.Pressed.Font = AppearanceObject.DefaultFont;
galleryItem.Gallery.Appearance.ItemCaptionAppearance.Pressed.Options.UseFont = true;
galleryItem.Gallery.Appearance.ItemCaptionAppearance.Pressed.TextOptions.HAlignment = HorzAlignment.Near;
galleryItem.Gallery.Appearance.ItemCaptionAppearance.Pressed.Options.UseTextOptions = true;
galleryItem.Gallery.Appearance.ItemCaptionAppearance.Disabled.Font = AppearanceObject.DefaultFont;
galleryItem.Gallery.Appearance.ItemCaptionAppearance.Disabled.Options.UseFont = true;
galleryItem.Gallery.Appearance.ItemCaptionAppearance.Disabled.TextOptions.HAlignment = HorzAlignment.Near;
galleryItem.Gallery.Appearance.ItemCaptionAppearance.Disabled.Options.UseTextOptions = true;
}
}
static class FiltersTreeListAppearances {
public static void Apply(XtraTreeList.TreeList treeList) {
treeList.BackColor = System.Drawing.Color.Transparent;
treeList.Appearance.Empty.BackColor = System.Drawing.Color.Transparent;
treeList.Appearance.Empty.Options.UseBackColor = true;
treeList.Appearance.Row.BackColor = System.Drawing.Color.Transparent;
treeList.Appearance.Row.Options.UseBackColor = true;
treeList.LookAndFeel.StyleChanged += LookAndFeel_StyleChanged;
//
var font = FontResources.GetSegoeUIFont(System.Drawing.FontStyle.Bold);
treeList.Appearance.FocusedRow.Font = font;
treeList.Appearance.FocusedRow.Options.UseFont = true;
treeList.Appearance.HideSelectionRow.Font = font;
treeList.Appearance.HideSelectionRow.Options.UseFont = true;
treeList.Appearance.SelectedRow.Font = font;
treeList.Appearance.SelectedRow.Options.UseFont = true;
}
static void LookAndFeel_StyleChanged(object sender, EventArgs e) {
var lf = (LookAndFeel.UserLookAndFeel)sender;
if(lf != null) {
var treeList = lf.OwnerControl as XtraTreeList.TreeList;
if(treeList != null)
treeList.Appearance.Row.ForeColor = GridHelper.GetTransparentRowForeColor(lf);
}
}
}
static class GroupFiltersListViewAppearances {
public static void Apply(XtraGrid.Views.WinExplorer.WinExplorerView winExplorerView) {
winExplorerView.Appearance.ItemDescriptionNormal.ForeColor = ColorHelper.DisabledTextColor;
winExplorerView.Appearance.ItemDescriptionNormal.Options.UseForeColor = true;
winExplorerView.Appearance.ItemDescriptionHovered.ForeColor = ColorHelper.DisabledTextColor;
winExplorerView.Appearance.ItemDescriptionHovered.Options.UseForeColor = true;
winExplorerView.Appearance.ItemDescriptionPressed.ForeColor = ColorHelper.DisabledTextColor;
winExplorerView.Appearance.ItemDescriptionPressed.Options.UseForeColor = true;
}
}
//
static class AppHelper {
public static void ProcessStart(string name) {
ProcessStart(name, string.Empty);
}
public static void ProcessStart(string name, string arguments) {
try {
System.Diagnostics.Process process = new System.Diagnostics.Process();
process.StartInfo.FileName = "cmd";
process.StartInfo.Arguments = $"/c start {name}";
process.StartInfo.CreateNoWindow = true;
process.Start();
}
catch(System.ComponentModel.Win32Exception) { }
}
public static string ApplicationID {
get { return string.Format("Components_{0}_Demo_Center_{0}", AssemblyInfo.VersionShort.Replace(".", "_")); }
}
public static Icon AppIcon {
get { return DevExpress.Utils.ResourceImageHelper.CreateIconFromResourcesEx("DevExpress.DevAV.Resources.AppIcon.ico", typeof(MainForm).Assembly); }
}
static Image img;
public static Image AppImage {
get {
if(img == null)
img = AppIcon.ToBitmap();
return img;
}
}
static WeakReference wRef;
public static MainForm MainForm {
get { return (wRef != null) ? wRef.Target as MainForm : null; }
set { wRef = new WeakReference(value); }
}
public static float GetDefaultSize() {
return 8.25F;
}
}
static class GridHelper {
public static void SetFindControlImages(GridControl grid) { SetFindControlImages(grid, true); }
public static void SetFindControlImages(GridControl grid, bool forceAlignment) {
FindControl fControl = null;
foreach(Control ctrl in grid.Controls) {
fControl = ctrl as FindControl;
if(fControl != null) break;
}
if(fControl != null) {
EditorButton btn = fControl.FindEdit.Properties.Buttons[0];
btn.Kind = XtraEditors.Controls.ButtonPredefines.Search;
btn = new EditorButton(ButtonPredefines.Close);
btn.Visible = false;
fControl.FindEdit.Properties.Buttons.Add(btn);
fControl.FindEdit.ButtonClick += (s, e) => {
if(!e.Button.IsDefaultButton) {
ButtonEdit edit = s as ButtonEdit;
edit.Text = string.Empty;
}
};
fControl.FindEdit.EditValueChanged += (s, e) => {
MRUEdit edit = s as MRUEdit;
edit.Properties.BeginUpdate();
try {
edit.Properties.Buttons[0].Visible = string.IsNullOrEmpty(edit.Text);
edit.Properties.Buttons[1].Visible = !string.IsNullOrEmpty(edit.Text);
}
finally {
edit.Properties.EndUpdate();
}
};
if(forceAlignment) {
//LayoutControl lc = fControl.FindEdit.Parent as LayoutControl;
//lc.BeginUpdate();
////lc.Root.AddItem(new EmptySpaceItem() { SizeConstraintsType = SizeConstraintsType.Custom, MinSize = new Size(1, 1) }, lc.Root.Items[0], XtraLayout.Utils.InsertType.Left);
//try {
// for(int i = lc.Root.Items.Count - 1; i >= 0; i--) {
// LayoutControlItem item = lc.Root.Items[i] as LayoutControlItem;
// if(item == null) continue;
// if(item.Visibility == XtraLayout.Utils.LayoutVisibility.Never)
// lc.Root.Remove(item);
// else {
// item.ControlAlignment = System.Drawing.ContentAlignment.MiddleRight;
// }
// }
//}
//finally {
// lc.EndUpdate();
//}
}
}
}
internal static void HideCustomization(Control control) {
if(control == null) return;
foreach(Control child in control.Controls) {
GridControl grid = child as GridControl;
if(grid != null) {
GridView gridView = grid.MainView as GridView;
if(gridView != null)
gridView.HideCustomization();
continue;
}
else HideCustomization(child);
}
}
internal static Color GetTransparentRowForeColor(LookAndFeel.UserLookAndFeel lf) {
return
(DevExpress.Utils.Frames.FrameHelper.IsDarkSkin(lf) || lf.ActiveSkinName == "VS2010") ?
(lf.ActiveSkinName == "VS2010" ? ColorHelper.GetControlColor(lf) : ColorHelper.TextColor) : Color.Empty;
}
}
static class ChartHelper {
internal static Color GetBackColor(DevExpress.XtraCharts.ChartControl chartControl) {
return ((DevExpress.XtraCharts.Native.IChartContainer)chartControl).Chart.ActualBackColor;
}
}
class LabelTabController {
LabelControl[] labels;
public LabelTabController(object eValue, params LabelControl[] list) {
this.labels = list;
EditValue = eValue;
foreach(LabelControl lb in list)
lb.Click += (s, e) => EditValue = ((LabelControl)s).Tag;
}
object editValueCore;
public object EditValue {
get { return editValueCore; }
set {
if(object.Equals(editValueCore, value)) return;
editValueCore = value;
OnEditValueChanged();
}
}
void OnEditValueChanged() {
UpdateAppearance();
RaiseEditValueChanged();
}
void UpdateAppearance() {
foreach(LabelControl lc in labels) {
bool isSelected = EditValue.Equals(lc.Tag);
lc.Font = FontResources.GetFont(lc.Font.FontFamily.Name, 10.25f, isSelected ? FontStyle.Bold : FontStyle.Regular);
lc.Appearance.ForeColor = isSelected ? ColorHelper.QuestionColor : Color.Empty;
}
}
public event EventHandler EditValueChanged;
void RaiseEditValueChanged() {
EventHandler handler = EditValueChanged;
if(handler != null) handler(EditValue, EventArgs.Empty);
}
}
static class FontResources {
static IDictionary<string, Font> cache;
static FontResources() {
cache = new Dictionary<string, Font>();
}
public static Font GetSegoeUIFont(FontStyle fontStyle) {
float defaultSize = DevExpress.Utils.AppearanceObject.DefaultFont.Size;
return GetFont("Segoe UI", defaultSize, fontStyle);
}
public static Font GetSegoeUIFont(float sizeGrow = 0) {
float defaultSize = DevExpress.Utils.AppearanceObject.DefaultFont.Size;
return GetFont("Segoe UI", defaultSize + sizeGrow);
}
public static Font GetSegoeUILightFont(float sizeGrow = 0) {
float defaultSize = DevExpress.Utils.AppearanceObject.DefaultFont.Size;
return GetFont("Segoe UI Light", defaultSize + sizeGrow);
}
public static Font GetFont(string familyName, float size, FontStyle style = FontStyle.Regular) {
string key = familyName + "#" + size.ToString();
if(style != FontStyle.Regular)
key += ("#" + style.ToString());
Font result;
if(!cache.TryGetValue(key, out result)) {
try {
var family = FindFontFamily(familyName);
result = new Font(family ?? FontFamily.GenericSansSerif, size, style);
}
catch(ArgumentException) { result = DevExpress.Utils.AppearanceObject.DefaultFont; }
cache.Add(key, result);
}
return result;
}
static FontFamily FindFontFamily(string familyName) {
return Array.Find(FontFamily.Families, (f) => f.Name == familyName);
}
}
static class ColorHelper {
public static Color GetControlColor(DevExpress.LookAndFeel.UserLookAndFeel provider) {
return DevExpress.LookAndFeel.LookAndFeelHelper.GetSystemColor(provider, SystemColors.Control);
}
public static Color TextColor {
get { return CommonSkins.GetSkin(DevExpress.LookAndFeel.UserLookAndFeel.Default).Colors.GetColor(CommonColors.ControlText); }
}
public static Color WindowColor {
get { return CommonSkins.GetSkin(DevExpress.LookAndFeel.UserLookAndFeel.Default).Colors.GetColor(CommonColors.Window); }
}
public static Color WindowTextColor {
get { return CommonSkins.GetSkin(DevExpress.LookAndFeel.UserLookAndFeel.Default).Colors.GetColor(CommonColors.WindowText); }
}
public static Color DisabledTextColor {
get { return CommonSkins.GetSkin(DevExpress.LookAndFeel.UserLookAndFeel.Default).Colors.GetColor(CommonColors.DisabledText); }
}
public static Color CriticalColor {
get { return CommonColors.GetCriticalColor(DevExpress.LookAndFeel.UserLookAndFeel.Default); }
}
public static Color WarningColor {
get { return CommonColors.GetWarningColor(DevExpress.LookAndFeel.UserLookAndFeel.Default); }
}
public static Color QuestionColor {
get { return CommonColors.GetQuestionColor(DevExpress.LookAndFeel.UserLookAndFeel.Default); }
}
public static Color InformationColor {
get { return CommonColors.GetInformationColor(DevExpress.LookAndFeel.UserLookAndFeel.Default); }
}
}
static class EditorHelpers {
public static RepositoryItemImageComboBox CreatePaymentStatusImageComboBox(ISkinProvider provider, RepositoryItemImageComboBox edit = null, RepositoryItemCollection collection = null) {
RepositoryItemImageComboBox ret = CreateEnumImageComboBox<PaymentStatus>(edit, collection);
ret.SmallImages = CreatePaymentStatusImageCollection(provider);
if(edit == null)
ret.GlyphAlignment = HorzAlignment.Center;
return ret;
}
public static RepositoryItemImageComboBox CreateShipmentStatusImageComboBox(ISkinProvider provider, RepositoryItemImageComboBox edit = null, RepositoryItemCollection collection = null) {
RepositoryItemImageComboBox ret = CreateEnumImageComboBox<ShipmentStatus>(edit, collection);
ret.SmallImages = CreateShipmentStatusImageCollection(provider);
if(edit == null)
ret.GlyphAlignment = HorzAlignment.Center;
return ret;
}
public static RepositoryItemImageComboBox CreatePersonPrefixImageComboBox(RepositoryItemImageComboBox edit = null, RepositoryItemCollection collection = null) {
RepositoryItemImageComboBox ret = CreateEnumImageComboBox<PersonPrefix>(edit, collection);
ret.SmallImages = CreatePersonPrefixImageCollection();
if(edit == null)
ret.GlyphAlignment = HorzAlignment.Center;
return ret;
}
public static RepositoryItemImageComboBox CreateTaskPriorityImageComboBox(RepositoryItemImageComboBox edit = null, RepositoryItemCollection collection = null) {
RepositoryItemImageComboBox ret = CreateEnumImageComboBox<EmployeeTaskPriority>(edit, collection);
ret.SmallImages = CreateTaskPriorityImageCollection();
if(edit == null)
ret.GlyphAlignment = HorzAlignment.Center;
return ret;
}
static SvgImageCollection CreatePersonPrefixImageCollection() {
SvgImageCollection svgImageCollection = new SvgImageCollection();
svgImageCollection.ImageSize = new Size(16, 16);
svgImageCollection.Add(SvgImage.FromResources("DevExpress.DevAV.Resources.PersonPrefix." + "Doctor.svg", typeof(EditorHelpers).Assembly));
svgImageCollection.Add(SvgImage.FromResources("DevExpress.DevAV.Resources.PersonPrefix." + "Mr.svg", typeof(EditorHelpers).Assembly));
svgImageCollection.Add(SvgImage.FromResources("DevExpress.DevAV.Resources.PersonPrefix." + "Ms.svg", typeof(EditorHelpers).Assembly));
svgImageCollection.Add(SvgImage.FromResources("DevExpress.DevAV.Resources.PersonPrefix." + "Miss.svg", typeof(EditorHelpers).Assembly));
svgImageCollection.Add(SvgImage.FromResources("DevExpress.DevAV.Resources.PersonPrefix." + "Mrs.svg", typeof(EditorHelpers).Assembly));
return svgImageCollection;
}
static ImageCollection CreateTaskPriorityImageCollection() {
ImageCollection ret = new ImageCollection();
ret.ImageSize = new Size(16, 16);
ret.AddImage(Properties.Resources.LowPriority);
ret.AddImage(Properties.Resources.NormalPriority);
ret.AddImage(Properties.Resources.MediumPriority);
ret.AddImage(Properties.Resources.HighPriority);
return ret;
}
internal static object CreatePaymentStatusImageCollection(ISkinProvider provider) {
SvgImageCollection ret = new SvgImageCollection();
ret.Add(SvgImage.FromResources("DevExpress.DevAV.Resources.Orders.Payment" + "Unpaid.svg", typeof(EditorHelpers).Assembly));
ret.Add(SvgImage.FromResources("DevExpress.DevAV.Resources.Orders.Payment" + "Paid.svg", typeof(EditorHelpers).Assembly));
ret.Add(SvgImage.FromResources("DevExpress.DevAV.Resources.Orders.Payment" + "Refund.svg", typeof(EditorHelpers).Assembly));
ret.Add(SvgImage.FromResources("DevExpress.DevAV.Resources.Orders.Payment" + "Other.svg", typeof(EditorHelpers).Assembly));
return ret;
}
internal static object CreateShipmentStatusImageCollection(ISkinProvider provider) { // TODO
SvgImageCollection ret = new SvgImageCollection();
ret.Add(SvgImage.FromResources("DevExpress.DevAV.Resources.Orders.Shipment" + "Awaiting.svg", typeof(EditorHelpers).Assembly));
ret.Add(SvgImage.FromResources("DevExpress.DevAV.Resources.Orders.Shipment" + "Transit.svg", typeof(EditorHelpers).Assembly));
ret.Add(SvgImage.FromResources("DevExpress.DevAV.Resources.Orders.Shipment" + "Received.svg", typeof(EditorHelpers).Assembly));
return ret;
}
public static RepositoryItemImageComboBox CreateManeuverImageComboBox(RepositoryItemImageComboBox edit = null, RepositoryItemCollection collection = null) {
RepositoryItemImageComboBox ret = CreateEnumImageComboBox<DevExpress.XtraMap.BingManeuverType>(edit, collection);
foreach(ImageComboBoxItem item in ret.Items) {
switch((DevExpress.XtraMap.BingManeuverType)item.Value) {
case DevExpress.XtraMap.BingManeuverType.DepartStart:
item.ImageIndex = 0;
break;
case DevExpress.XtraMap.BingManeuverType.TurnLeft:
item.ImageIndex = 1;
break;
case DevExpress.XtraMap.BingManeuverType.TurnRight:
item.ImageIndex = 2;
break;
case DevExpress.XtraMap.BingManeuverType.ArriveFinish:
item.ImageIndex = 3;
break;
case DevExpress.XtraMap.BingManeuverType.UTurn:
item.ImageIndex = 4;
break;
case DevExpress.XtraMap.BingManeuverType.BearLeft:
item.ImageIndex = 5;
break;
case DevExpress.XtraMap.BingManeuverType.BearRight:
item.ImageIndex = 6;
break;
}
item.Description = string.Empty;
}
ret.SmallImages = CreateBingManeuverTypeImageCollection();
ret.GlyphAlignment = HorzAlignment.Center;
return ret;
}
static ImageCollection CreateBingManeuverTypeImageCollection() {
ImageCollection ret = new ImageCollection();
ret.ImageSize = new Size(32, 32);
ret.AddImage(Properties.Resources.icon_A_32);
ret.AddImage(Properties.Resources.icon_arrow_left_32);
ret.AddImage(Properties.Resources.icon_arrow_right_32);
ret.AddImage(Properties.Resources.icon_B_32);
ret.AddImage(Properties.Resources.icon_arrow_uturn_32);
ret.AddImage(Properties.Resources.icon_arrow_bear_left_32);
ret.AddImage(Properties.Resources.icon_arrow_bear_right_32);
ret.AddImage(Properties.Resources.icon_arrow_forward_32);
return ret;
}
public static RepositoryItemImageComboBox CreateEnumImageComboBox<TEnum>(DevExpress.XtraEditors.Container.EditorContainer container,
Converter<TEnum, string> displayTextConverter = null) {
return CreatEdit<RepositoryItemImageComboBox>(null, (container != null) ? container.RepositoryItems : null, (e) => e.Items.AddEnum<TEnum>(displayTextConverter));
}
public static RepositoryItemImageComboBox CreateEnumImageComboBox<TEnum>(RepositoryItemImageComboBox edit = null, RepositoryItemCollection collection = null,
Converter<TEnum, string> displayTextConverter = null) {
return CreatEdit<RepositoryItemImageComboBox>(edit, collection, (e) => e.Items.AddEnum<TEnum>(displayTextConverter));
}
public static RepositoryItemDateEdit CreatDateEdit(RepositoryItemDateEdit edit = null, RepositoryItemCollection collection = null) {
return CreatEdit<RepositoryItemDateEdit>(edit, collection);
}
public static TEdit CreatEdit<TEdit>(TEdit edit = null, RepositoryItemCollection collection = null, Action<TEdit> initialize = null)
where TEdit : RepositoryItem, new() {
edit = edit ?? new TEdit();
if(collection != null) collection.Add(edit);
if(initialize != null)
initialize(edit);
return edit;
}
public static void ApplyBindingSettings<TEntity>(BaseEdit edit, LayoutControl layoutControl) {
var memberInfo = edit.DataBindings["EditValue"].BindingMemberInfo;
if(DataAnnotationHelper.IsRequired<TEntity>(memberInfo.BindingMember)) {
if(layoutControl != null) {
var itemForEdit = layoutControl.GetItemByControl(edit);
itemForEdit.AllowHtmlStringInCaption = true;
itemForEdit.Text = itemForEdit.Text + " <color=red>*</color>";
}
}
if(edit is TextEdit) {
if(DataAnnotationHelper.IsPhone<TEntity>(memberInfo.BindingMember)) {
((TextEdit)edit).Properties.Mask.MaskType = XtraEditors.Mask.MaskType.Simple;
((TextEdit)edit).Properties.Mask.EditMask = "(999) 000-0000";
((TextEdit)edit).Properties.Mask.UseMaskAsDisplayFormat = true;
}
if(DataAnnotationHelper.IsZipcode<TEntity>(memberInfo.BindingMember)) {
((TextEdit)edit).Properties.Mask.MaskType = XtraEditors.Mask.MaskType.Simple;
((TextEdit)edit).Properties.Mask.EditMask = "00000";
((TextEdit)edit).Properties.Mask.UseMaskAsDisplayFormat = true;
}
}
}
}
class FilterColumnCollectionBuilder<TEntity> {
FilterColumnCollection filterColumns;
public FilterColumnCollectionBuilder() {
this.filterColumns = new FilterColumnCollection();
}
public FilterColumnCollectionBuilder(FilterColumnCollection filterColumns) {
this.filterColumns = filterColumns;
}
public FilterColumnCollection Build() {
return filterColumns;
}
public FilterColumnCollectionBuilder<TEntity> AddColumn<T>(Expression<Func<TEntity, T>> expression,
DevExpress.XtraEditors.Repository.RepositoryItem repositoryItem = null,
FilterColumnClauseClass clauseClass = FilterColumnClauseClass.String, string caption = null) {
if(repositoryItem == null) {
if(typeof(T) == typeof(bool) || (typeof(T) == typeof(bool?))) {
repositoryItem = EditorHelpers.CreatEdit<RepositoryItemCheckEdit>();
clauseClass = FilterColumnClauseClass.Generic;
}
if((typeof(T) == typeof(double)) || (typeof(T) == typeof(double?)) || (typeof(T) == typeof(decimal)) || (typeof(T) == typeof(decimal?))) {
repositoryItem = EditorHelpers.CreatEdit<RepositoryItemSpinEdit>();
clauseClass = FilterColumnClauseClass.Generic;
}
if(typeof(T) == typeof(int) || (typeof(T) == typeof(int?))) {
var spinEdit = EditorHelpers.CreatEdit<RepositoryItemSpinEdit>();
spinEdit.IsFloatValue = false;
repositoryItem = spinEdit;
clauseClass = FilterColumnClauseClass.Generic;
}
}
filterColumns.Add(CreateColumn(expression, caption, null, repositoryItem, clauseClass));
return this;
}
public FilterColumnCollectionBuilder<TEntity> AddLookupColumn<T>(Expression<Func<TEntity, T>> expression) {
return AddColumn(expression, EditorHelpers.CreateEnumImageComboBox<T>(), FilterColumnClauseClass.Lookup);
}
public FilterColumnCollectionBuilder<TEntity> AddDateTimeColumn<T>(Expression<Func<TEntity, T>> expression) {
return AddColumn(expression, EditorHelpers.CreatDateEdit(), FilterColumnClauseClass.DateTime);
}
UnboundFilterColumn CreateColumn<T>(Expression<Func<TEntity, T>> expression, string caption, string fieldName,
DevExpress.XtraEditors.Repository.RepositoryItem repositoryItem, FilterColumnClauseClass clauseClass) {
var member = (expression.Body as MemberExpression).Member;
if(string.IsNullOrEmpty(fieldName))
fieldName = GetFieldName<T>(expression);
if(string.IsNullOrEmpty(caption))
caption = GetDisplayName(member);
return CreateColumn<T>(caption, fieldName, repositoryItem, clauseClass);
}
UnboundFilterColumn CreateColumn<T>(string caption, string fieldName,
DevExpress.XtraEditors.Repository.RepositoryItem repositoryItem, FilterColumnClauseClass clauseClass) {
return new UnboundFilterColumn(caption, fieldName, typeof(T), repositoryItem, clauseClass);
}
string GetFieldName<T>(Expression<Func<TEntity, T>> expression) {
var sb = new System.Text.StringBuilder();
MemberExpression me = expression.Body as MemberExpression;
while(me != null) {
if(sb.Length > 0)
sb.Insert(0, ".");
sb.Insert(0, me.Member.Name);
me = me.Expression as MemberExpression;
}
return sb.ToString();
}
string GetDisplayName(System.Reflection.MemberInfo member) {
string displayName = member.Name;
if(CheckDisplayNameAttribute<System.ComponentModel.DataAnnotations.DisplayAttribute>(member, a => a.GetName(), ref displayName))
return displayName;
if(CheckDisplayNameAttribute<System.ComponentModel.DisplayNameAttribute>(member, a => a.DisplayName, ref displayName))
return displayName;
return displayName;
}
bool CheckDisplayNameAttribute<TAttribute>(System.Reflection.MemberInfo member, Func<TAttribute, string> accessor, ref string displayName)
where TAttribute : Attribute {
var displayAttributes = member.GetCustomAttributes(typeof(TAttribute), true);
if(displayAttributes.Length > 0) {
displayName = accessor((TAttribute)displayAttributes[0]);
return true;
}
return false;
}
}
static class FilterControlWithoutLike {
public static void Apply(FilterControl filterControl) {
filterControl.PopupMenuShowing += filterControl_PopupMenuShowing;
}
static void filterControl_PopupMenuShowing(object sender, XtraEditors.Filtering.PopupMenuShowingEventArgs e) {
for(int i = e.Menu.Items.Count - 1; i >= 0; i--) {
if(e.Menu.Items[i].Caption == Localizer.Active.GetLocalizedString(StringId.FilterClauseLike) ||
e.Menu.Items[i].Caption == Localizer.Active.GetLocalizedString(StringId.FilterClauseNotLike)) {
e.Menu.Items.RemoveAt(i);
}
}
}
}
//
class DemoStartUp : IObserver<string> {
void IObserver<string>.OnCompleted() {
XtraSplashScreen.SplashScreenManager.CloseForm(false, 1500, AppHelper.MainForm);
}
void IObserver<string>.OnNext(string status) {
if(DevExpress.XtraSplashScreen.SplashScreenManager.Default == null) {
XtraSplashScreen.SplashScreenManager.ShowDefaultSplashScreen(AppHelper.MainForm, true, true, "DevExpress WinForms Controls", status);
}
else {
XtraSplashScreen.SplashScreenManager.SetDefaultSplashScreenStatus(false, status);
}
}
void IObserver<string>.OnError(Exception error) { throw error; }
}
class DataGenerationProgress : IObserver<string> {
void IObserver<string>.OnNext(string status) {
XtraSplashScreen.SplashScreenManager.SetDefaultSplashScreenStatus(false, status);
}
void IObserver<string>.OnCompleted() { }
void IObserver<string>.OnError(Exception error) { throw error; }
}
//
public class EntityEventArgs<TID> : EventArgs {
TID entityKeyCore;
public EntityEventArgs(TID entityKey) {
this.entityKeyCore = entityKey;
}
public TID Key {
get { return entityKeyCore; }
}
}
public class EntitiesCountEventArgs : EventArgs {
public EntitiesCountEventArgs(int count) {
Count = count;
}
public int Count { get; private set; }
}
public class GroupEventArgs<TKey> : EventArgs {
IEnumerable<TKey> keysCore;
public GroupEventArgs(IEnumerable<TKey> keys) {
this.keysCore = keys;
}
public IEnumerable<TKey> Entities {
get { return keysCore; }
}
}
public static class SVGHelper {
public static Image CreateImageFromSvg(ISkinProvider skinProvider, string rootPath, string imageName) {
var assembly = typeof(MainForm).Assembly;
SvgBitmap svgBitmap;
var stream = assembly.GetManifestResourceStream(rootPath + imageName);
if(stream == null)
stream = assembly.GetManifestResourceStream(imageName);
if(stream == null) return null;
using(stream) {
svgBitmap = SvgBitmap.FromStream(stream);
}
if(svgBitmap == null) return null;
var pallete = SvgPaletteHelper.GetSvgPalette(skinProvider, DevExpress.Utils.Drawing.ObjectState.Normal);
return svgBitmap.Render(pallete, 1);
}
public static Image CreateImageFromSvg(ISkinProvider skinProvider, string rootPath, string imageName, Size imageSize) {
var assembly = typeof(MainForm).Assembly;
SvgBitmap svgBitmap;
var stream = assembly.GetManifestResourceStream(rootPath + imageName);
if(stream == null)
stream = assembly.GetManifestResourceStream(imageName);
if(stream == null) return null;
using(stream) {
svgBitmap = SvgBitmap.FromStream(stream);
}
if(svgBitmap == null) return null;
var pallete = SvgPaletteHelper.GetSvgPalette(skinProvider, DevExpress.Utils.Drawing.ObjectState.Normal);
return svgBitmap.Render(imageSize, pallete);
}
public static Dictionary<EmployeeTaskPriority, SvgImage> CreateTaskPriorityImages(ISkinProvider skinProvider, string rootPath) {
var result = new Dictionary<EmployeeTaskPriority, SvgImage>();
var asm = typeof(MainForm).Assembly;
result.Add(EmployeeTaskPriority.Low, SvgImage.FromResources(String.Concat(rootPath, "PriorityLow.svg"), asm));
result.Add(EmployeeTaskPriority.Normal, SvgImage.FromResources(String.Concat(rootPath, "PriorityNormal.svg"), asm));
result.Add(EmployeeTaskPriority.High, SvgImage.FromResources(String.Concat(rootPath, "PriorityHigh.svg"), asm));
result.Add(EmployeeTaskPriority.Urgent, SvgImage.FromResources(String.Concat(rootPath, "PriorityUrgent.svg"), asm));
return result;
}
}
}

View File

@@ -0,0 +1,200 @@
namespace DevExpress.DevAV.Modules {
partial class OverviewControl {
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing) {
if(disposing && (components != null)) {
components.Dispose();
}
base.Dispose(disposing);
}
#region Component Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent() {
this.buttonsPanel = new DevExpress.XtraBars.Docking2010.WindowsUIButtonPanel();
this.layoutControlGroup1 = new DevExpress.XtraLayout.LayoutControlGroup();
this.layoutControlItem1 = new DevExpress.XtraLayout.LayoutControlItem();
this.logo = new DevExpress.XtraEditors.PictureEdit();
this.layoutControl1 = new DevExpress.XtraLayout.LayoutControl();
this.descriptionLabel = new DevExpress.XtraEditors.LabelControl();
this.ItemForDescription = new DevExpress.XtraLayout.LayoutControlItem();
this.layoutControlItem3 = new DevExpress.XtraLayout.LayoutControlItem();
((System.ComponentModel.ISupportInitialize)(this.layoutControlGroup1)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.layoutControlItem1)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.logo.Properties)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.layoutControl1)).BeginInit();
this.layoutControl1.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.ItemForDescription)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.layoutControlItem3)).BeginInit();
this.SuspendLayout();
//
// buttonsPanel
//
this.buttonsPanel.AllowGlyphSkinning = false;
this.buttonsPanel.AppearanceButton.Hovered.Font = new System.Drawing.Font("Segoe UI", 11.25F);
this.buttonsPanel.AppearanceButton.Hovered.Options.UseFont = true;
this.buttonsPanel.AppearanceButton.Normal.Font = new System.Drawing.Font("Segoe UI", 11.25F);
this.buttonsPanel.AppearanceButton.Normal.Options.UseFont = true;
this.buttonsPanel.AppearanceButton.Pressed.Font = new System.Drawing.Font("Segoe UI", 11.25F);
this.buttonsPanel.AppearanceButton.Pressed.Options.UseFont = true;
this.buttonsPanel.ButtonInterval = 40;
this.buttonsPanel.Buttons.AddRange(new DevExpress.XtraEditors.ButtonPanel.IBaseButton[] {
new DevExpress.XtraBars.Docking2010.WindowsUIButton("Getting Started", global::DevExpress.DevAV.Properties.Resources.Overview_GettingStarted, -1, DevExpress.XtraBars.Docking2010.ButtonStyle.PushButton, -1),
new DevExpress.XtraBars.Docking2010.WindowsUIButton("Free Support", global::DevExpress.DevAV.Properties.Resources.Overview_FreeSupport, -1, DevExpress.XtraBars.Docking2010.ButtonStyle.PushButton, -1),
new DevExpress.XtraBars.Docking2010.WindowsUIButton("Buy Now", global::DevExpress.DevAV.Properties.Resources.Overview_Buy, -1, DevExpress.XtraBars.Docking2010.ButtonStyle.PushButton, -1)});
this.buttonsPanel.Location = new System.Drawing.Point(24, 477);
this.buttonsPanel.MaximumSize = new System.Drawing.Size(0, 128);
this.buttonsPanel.MinimumSize = new System.Drawing.Size(0, 128);
this.buttonsPanel.Name = "buttonsPanel";
this.buttonsPanel.Size = new System.Drawing.Size(1032, 128);
this.buttonsPanel.TabIndex = 3;
this.buttonsPanel.UseButtonBackgroundImages = false;
//
// layoutControlGroup1
//
this.layoutControlGroup1.CustomizationFormText = "Root";
this.layoutControlGroup1.EnableIndentsWithoutBorders = DevExpress.Utils.DefaultBoolean.True;
this.layoutControlGroup1.GroupBordersVisible = false;
this.layoutControlGroup1.Items.AddRange(new DevExpress.XtraLayout.BaseLayoutItem[] {
this.layoutControlItem1,
this.ItemForDescription,
this.layoutControlItem3});
this.layoutControlGroup1.Location = new System.Drawing.Point(0, 0);
this.layoutControlGroup1.Name = "Root";
this.layoutControlGroup1.Padding = new DevExpress.XtraLayout.Utils.Padding(24, 24, 24, 24);
this.layoutControlGroup1.Size = new System.Drawing.Size(1080, 710);
this.layoutControlGroup1.Text = "Root";
this.layoutControlGroup1.TextVisible = false;
//
// layoutControlItem1
//
this.layoutControlItem1.Control = this.logo;
this.layoutControlItem1.ControlAlignment = System.Drawing.ContentAlignment.BottomRight;
this.layoutControlItem1.CustomizationFormText = "layoutControlItem1";
this.layoutControlItem1.Location = new System.Drawing.Point(0, 581);
this.layoutControlItem1.Name = "layoutControlItem1";
this.layoutControlItem1.Padding = new DevExpress.XtraLayout.Utils.Padding(0, 0, 0, 0);
this.layoutControlItem1.Size = new System.Drawing.Size(1032, 81);
this.layoutControlItem1.SizeConstraintsType = DevExpress.XtraLayout.SizeConstraintsType.SupportHorzAlignment;
this.layoutControlItem1.Text = "layoutControlItem1";
this.layoutControlItem1.TextSize = new System.Drawing.Size(0, 0);
this.layoutControlItem1.TextToControlDistance = 0;
this.layoutControlItem1.TextVisible = false;
//
// logo
//
this.logo.EditValue = global::DevExpress.DevAV.Properties.Resources.Overview_Logo;
this.logo.Location = new System.Drawing.Point(24, 605);
this.logo.Name = "logo";
this.logo.Properties.AllowFocused = false;
this.logo.Properties.Appearance.BackColor = System.Drawing.Color.Transparent;
this.logo.Properties.Appearance.Options.UseBackColor = true;
this.logo.Properties.BorderStyle = DevExpress.XtraEditors.Controls.BorderStyles.NoBorder;
this.logo.Properties.PictureAlignment = System.Drawing.ContentAlignment.BottomRight;
this.logo.Properties.ShowMenu = false;
this.logo.Size = new System.Drawing.Size(1032, 81);
this.logo.StyleController = this.layoutControl1;
this.logo.TabIndex = 16;
//
// layoutControl1
//
this.layoutControl1.AllowCustomization = false;
this.layoutControl1.Controls.Add(this.buttonsPanel);
this.layoutControl1.Controls.Add(this.descriptionLabel);
this.layoutControl1.Controls.Add(this.logo);
this.layoutControl1.Dock = System.Windows.Forms.DockStyle.Fill;
this.layoutControl1.Location = new System.Drawing.Point(0, 0);
this.layoutControl1.Name = "layoutControl1";
this.layoutControl1.Root = this.layoutControlGroup1;
this.layoutControl1.Size = new System.Drawing.Size(1080, 710);
this.layoutControl1.TabIndex = 2;
this.layoutControl1.Text = "layoutControl1";
//
// descriptionLabel
//
this.descriptionLabel.AllowHtmlString = true;
this.descriptionLabel.Appearance.Font = new System.Drawing.Font("Segoe UI Light", 18F);
this.descriptionLabel.Appearance.Image = global::DevExpress.DevAV.Properties.Resources.Jolt_Logo;
this.descriptionLabel.Appearance.ImageAlign = System.Drawing.ContentAlignment.TopRight;
this.descriptionLabel.Appearance.TextOptions.HAlignment = DevExpress.Utils.HorzAlignment.Center;
this.descriptionLabel.Appearance.TextOptions.VAlignment = DevExpress.Utils.VertAlignment.Center;
this.descriptionLabel.Appearance.TextOptions.WordWrap = DevExpress.Utils.WordWrap.Wrap;
this.descriptionLabel.AutoSizeMode = DevExpress.XtraEditors.LabelAutoSizeMode.None;
this.descriptionLabel.Location = new System.Drawing.Point(24, 24);
this.descriptionLabel.Name = "descriptionLabel";
this.descriptionLabel.Size = new System.Drawing.Size(1032, 453);
this.descriptionLabel.StyleController = this.layoutControl1;
this.descriptionLabel.TabIndex = 16;
this.descriptionLabel.Text = "UI SuperHero";
//
// ItemForDescription
//
this.ItemForDescription.Control = this.descriptionLabel;
this.ItemForDescription.ControlAlignment = System.Drawing.ContentAlignment.MiddleCenter;
this.ItemForDescription.CustomizationFormText = "layoutControlItem2";
this.ItemForDescription.Location = new System.Drawing.Point(0, 0);
this.ItemForDescription.MinSize = new System.Drawing.Size(1, 1);
this.ItemForDescription.Name = "layoutControlItem2";
this.ItemForDescription.Padding = new DevExpress.XtraLayout.Utils.Padding(0, 0, 0, 0);
this.ItemForDescription.Size = new System.Drawing.Size(1032, 453);
this.ItemForDescription.SizeConstraintsType = DevExpress.XtraLayout.SizeConstraintsType.Custom;
this.ItemForDescription.Text = "layoutControlItem2";
this.ItemForDescription.TextSize = new System.Drawing.Size(0, 0);
this.ItemForDescription.TextToControlDistance = 0;
this.ItemForDescription.TextVisible = false;
//
// layoutControlItem3
//
this.layoutControlItem3.Control = this.buttonsPanel;
this.layoutControlItem3.CustomizationFormText = "layoutControlItem3";
this.layoutControlItem3.Location = new System.Drawing.Point(0, 453);
this.layoutControlItem3.Name = "layoutControlItem3";
this.layoutControlItem3.Padding = new DevExpress.XtraLayout.Utils.Padding(0, 0, 0, 0);
this.layoutControlItem3.Size = new System.Drawing.Size(1032, 128);
this.layoutControlItem3.Text = "layoutControlItem3";
this.layoutControlItem3.TextSize = new System.Drawing.Size(0, 0);
this.layoutControlItem3.TextToControlDistance = 0;
this.layoutControlItem3.TextVisible = false;
//
// OverviewControl
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.Controls.Add(this.layoutControl1);
this.Name = "OverviewControl";
this.Size = new System.Drawing.Size(1080, 710);
((System.ComponentModel.ISupportInitialize)(this.layoutControlGroup1)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.layoutControlItem1)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.logo.Properties)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.layoutControl1)).EndInit();
this.layoutControl1.ResumeLayout(false);
((System.ComponentModel.ISupportInitialize)(this.ItemForDescription)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.layoutControlItem3)).EndInit();
this.ResumeLayout(false);
}
#endregion
private XtraLayout.LayoutControlGroup layoutControlGroup1;
private XtraLayout.LayoutControl layoutControl1;
private XtraLayout.LayoutControlItem layoutControlItem1;
private XtraEditors.PictureEdit logo;
private XtraEditors.LabelControl descriptionLabel;
private XtraLayout.LayoutControlItem ItemForDescription;
private DevExpress.XtraBars.Docking2010.WindowsUIButtonPanel buttonsPanel;
private XtraLayout.LayoutControlItem layoutControlItem3;
}
}

View File

@@ -0,0 +1,43 @@
using DevExpress.DevAV.ViewModels;
using DevExpress.XtraBars.Docking2010;
using DevExpress.XtraEditors;
namespace DevExpress.DevAV.Modules {
public partial class OverviewControl : XtraUserControl {
public OverviewControl() {
InitializeComponent();
descriptionLabel.AutoSizeInLayoutControl = false;
descriptionLabel.Text = "<image=#UISuperHero><br>"
+ string.Format("<color=#{0:x6}><size=+24>Become a UI Superhero<br>", ColorHelper.TextColor.ToArgb())
+ string.Format("<color=#{0:x6}><size=-18>And deliver compelling user-experiences on the WinForms platform<br>", ColorHelper.DisabledTextColor.ToArgb())
+ "with award-winning DevExpress Controls and Libraries.";
descriptionLabel.HyperlinkClick += descriptionLabel_HyperlinkClick;
}
void descriptionLabel_HyperlinkClick(object sender, Utils.HyperlinkClickEventArgs e) {
viewModel.SelectedModuleType = ModuleType.Employees;
var form = FindForm();
if(form != null)
form.Close();
}
MainViewModel viewModel;
protected override void OnLoad(System.EventArgs e) {
base.OnLoad(e);
if(viewModel == null && AppHelper.MainForm != null) {
viewModel = (AppHelper.MainForm as ISupportViewModel).ViewModel as MainViewModel;
if(viewModel != null)
BindCommands();
}
}
void BindCommands() {
((WindowsUIButton)buttonsPanel.Buttons[0]).BindCommand(() => viewModel.GetStarted(), viewModel);
((WindowsUIButton)buttonsPanel.Buttons[1]).BindCommand(() => viewModel.GetSupport(), viewModel);
((WindowsUIButton)buttonsPanel.Buttons[2]).BindCommand(() => viewModel.BuyNow(), viewModel);
}
internal void SetDescription(string description) {
descriptionLabel.Appearance.Image = null;
descriptionLabel.Text = "<image=#UISuperHero><br>"
+ string.Format("<color=#{0:x6}><size=+24>Become a UI Superhero<br>", ColorHelper.TextColor.ToArgb())
+ string.Format("<color=#{0:x6}><size=-18>{1}", ColorHelper.DisabledTextColor.ToArgb(), description);
}
}
}

View File

@@ -0,0 +1,120 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
</root>

View File

@@ -0,0 +1,188 @@
namespace DevExpress.DevAV {
partial class ReportExportControl {
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing) {
if(disposing && (components != null)) {
components.Dispose();
}
base.Dispose(disposing);
}
#region Component Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent() {
this.moduleLayout = new DevExpress.XtraLayout.LayoutControl();
this.btnExport = new DevExpress.XtraEditors.DropDownButton();
this.settingsPanel = new DevExpress.DevAV.SettingPanel();
this.layoutControlGroup1 = new DevExpress.XtraLayout.LayoutControlGroup();
this.captionLabelItem = new DevExpress.XtraLayout.SimpleLabelItem();
this.ItemForSettings = new DevExpress.XtraLayout.LayoutControlItem();
this.separator = new DevExpress.XtraLayout.SimpleSeparator();
this.ItemForButtonExport = new DevExpress.XtraLayout.LayoutControlItem();
this.buttonLabelItem = new DevExpress.XtraLayout.SimpleLabelItem();
((System.ComponentModel.ISupportInitialize)(this.moduleLayout)).BeginInit();
this.moduleLayout.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.layoutControlGroup1)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.captionLabelItem)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.ItemForSettings)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.separator)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.ItemForButtonExport)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.buttonLabelItem)).BeginInit();
this.SuspendLayout();
//
// moduleLayout
//
this.moduleLayout.AllowCustomization = false;
this.moduleLayout.Controls.Add(this.btnExport);
this.moduleLayout.Controls.Add(this.settingsPanel);
this.moduleLayout.Dock = System.Windows.Forms.DockStyle.Fill;
this.moduleLayout.Location = new System.Drawing.Point(0, 0);
this.moduleLayout.Name = "moduleLayout";
this.moduleLayout.Root = this.layoutControlGroup1;
this.moduleLayout.Size = new System.Drawing.Size(310, 600);
this.moduleLayout.TabIndex = 4;
//
// btnExport
//
this.btnExport.ImageLocation = DevExpress.XtraEditors.ImageLocation.TopCenter;
this.btnExport.ImageUri.ResourceType = typeof(DevExpress.DevAV.MainForm);
this.btnExport.ImageUri.Uri = "resource://DevExpress.DevAV.Resources.Export.svg";
this.btnExport.Location = new System.Drawing.Point(40, 89);
this.btnExport.MaximumSize = new System.Drawing.Size(75, 75);
this.btnExport.MinimumSize = new System.Drawing.Size(75, 75);
this.btnExport.Name = "btnExport";
this.btnExport.Size = new System.Drawing.Size(75, 75);
this.btnExport.StyleController = this.moduleLayout;
this.btnExport.TabIndex = 1;
this.btnExport.Text = "Export";
this.btnExport.Click += new System.EventHandler(this.btnExport_Click);
//
// settingsPanel
//
this.settingsPanel.Location = new System.Drawing.Point(40, 215);
this.settingsPanel.Name = "settingsPanel";
this.settingsPanel.Size = new System.Drawing.Size(228, 345);
this.settingsPanel.TabIndex = 4;
//
// layoutControlGroup1
//
this.layoutControlGroup1.CustomizationFormText = "Root";
this.layoutControlGroup1.EnableIndentsWithoutBorders = DevExpress.Utils.DefaultBoolean.True;
this.layoutControlGroup1.GroupBordersVisible = false;
this.layoutControlGroup1.Items.AddRange(new DevExpress.XtraLayout.BaseLayoutItem[] {
this.captionLabelItem,
this.ItemForSettings,
this.separator,
this.ItemForButtonExport,
this.buttonLabelItem});
this.layoutControlGroup1.Location = new System.Drawing.Point(0, 0);
this.layoutControlGroup1.Name = "Root";
this.layoutControlGroup1.Padding = new DevExpress.XtraLayout.Utils.Padding(40, 0, 0, 40);
this.layoutControlGroup1.Size = new System.Drawing.Size(310, 600);
//
// captionLabelItem
//
this.captionLabelItem.AllowHotTrack = false;
this.captionLabelItem.AppearanceItemCaption.Font = new System.Drawing.Font("Segoe UI", 36F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.captionLabelItem.AppearanceItemCaption.Options.UseFont = true;
this.captionLabelItem.CustomizationFormText = "Export";
this.captionLabelItem.Location = new System.Drawing.Point(0, 0);
this.captionLabelItem.Name = "captionLabelItem";
this.captionLabelItem.Padding = new DevExpress.XtraLayout.Utils.Padding(0, 0, 0, 24);
this.captionLabelItem.Size = new System.Drawing.Size(228, 89);
this.captionLabelItem.Text = "Export";
this.captionLabelItem.TextSize = new System.Drawing.Size(138, 65);
//
// ItemForSettings
//
this.ItemForSettings.AppearanceItemCaption.Font = new System.Drawing.Font("Segoe UI", 18F);
this.ItemForSettings.AppearanceItemCaption.Options.UseFont = true;
this.ItemForSettings.Control = this.settingsPanel;
this.ItemForSettings.CustomizationFormText = "Settings";
this.ItemForSettings.Location = new System.Drawing.Point(0, 164);
this.ItemForSettings.Name = "ItemForSettings";
this.ItemForSettings.Padding = new DevExpress.XtraLayout.Utils.Padding(0, 0, 16, 0);
this.ItemForSettings.Size = new System.Drawing.Size(228, 396);
this.ItemForSettings.Text = "Settings";
this.ItemForSettings.TextLocation = DevExpress.Utils.Locations.Top;
this.ItemForSettings.TextSize = new System.Drawing.Size(138, 32);
//
// separator
//
this.separator.AllowHotTrack = false;
this.separator.CustomizationFormText = "separator";
this.separator.Location = new System.Drawing.Point(228, 0);
this.separator.Name = "separator";
this.separator.Padding = new DevExpress.XtraLayout.Utils.Padding(0, 0, 0, 0);
this.separator.Size = new System.Drawing.Size(42, 560);
this.separator.Spacing = new DevExpress.XtraLayout.Utils.Padding(40, 0, 0, 0);
//
// ItemForButtonExport
//
this.ItemForButtonExport.Control = this.btnExport;
this.ItemForButtonExport.CustomizationFormText = "ItemForButtonExport";
this.ItemForButtonExport.Location = new System.Drawing.Point(0, 89);
this.ItemForButtonExport.Name = "ItemForButtonExport";
this.ItemForButtonExport.Padding = new DevExpress.XtraLayout.Utils.Padding(0, 0, 0, 0);
this.ItemForButtonExport.Size = new System.Drawing.Size(75, 75);
this.ItemForButtonExport.TextSize = new System.Drawing.Size(0, 0);
this.ItemForButtonExport.TextVisible = false;
//
// buttonLabelItem
//
this.buttonLabelItem.AllowHotTrack = false;
this.buttonLabelItem.AllowHtmlStringInCaption = true;
this.buttonLabelItem.AppearanceItemCaption.Options.UseTextOptions = true;
this.buttonLabelItem.AppearanceItemCaption.TextOptions.WordWrap = DevExpress.Utils.WordWrap.Wrap;
this.buttonLabelItem.CustomizationFormText = "Specify how you want<br>the report to be printed";
this.buttonLabelItem.Location = new System.Drawing.Point(75, 89);
this.buttonLabelItem.Name = "buttonLabelItem";
this.buttonLabelItem.Padding = new DevExpress.XtraLayout.Utils.Padding(12, 0, 0, 0);
this.buttonLabelItem.Size = new System.Drawing.Size(153, 75);
this.buttonLabelItem.Text = "The DevExpress Reporting<br>platform allows you to<br>export any report to<br>PDF" +
", XLS, RTF and countless<br>image file formats.";
this.buttonLabelItem.TextSize = new System.Drawing.Size(138, 65);
//
// ReportExportControl
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.Controls.Add(this.moduleLayout);
this.Name = "ReportExportControl";
this.Size = new System.Drawing.Size(310, 600);
((System.ComponentModel.ISupportInitialize)(this.moduleLayout)).EndInit();
this.moduleLayout.ResumeLayout(false);
((System.ComponentModel.ISupportInitialize)(this.layoutControlGroup1)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.captionLabelItem)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.ItemForSettings)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.separator)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.ItemForButtonExport)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.buttonLabelItem)).EndInit();
this.ResumeLayout(false);
}
#endregion
private XtraLayout.LayoutControl moduleLayout;
private SettingPanel settingsPanel;
private XtraEditors.DropDownButton btnExport;
private XtraLayout.LayoutControlGroup layoutControlGroup1;
private XtraLayout.SimpleLabelItem captionLabelItem;
private XtraLayout.SimpleLabelItem buttonLabelItem;
private XtraLayout.LayoutControlItem ItemForSettings;
private XtraLayout.SimpleSeparator separator;
private XtraLayout.LayoutControlItem ItemForButtonExport;
}
}

View File

@@ -0,0 +1,76 @@
using System;
using System.Windows.Forms;
using DevExpress.Utils.Menu;
using DevExpress.XtraEditors;
using DevExpress.XtraLayout.Utils;
using DevExpress.XtraPrinting;
namespace DevExpress.DevAV {
public partial class ReportExportControl : XtraUserControl {
DXPopupMenu menuExport;
public ReportExportControl() {
InitializeComponent();
SelectedExport = ExportTarget.Pdf;
menuExport = new DXPopupMenu();
AddExportTarget(ExportTarget.Pdf);
AddExportTarget(ExportTarget.Html);
AddExportTarget(ExportTarget.Mht);
AddExportTarget(ExportTarget.Rtf);
AddExportTarget(ExportTarget.Xls);
AddExportTarget(ExportTarget.Xlsx);
AddExportTarget(ExportTarget.Csv);
AddExportTarget(ExportTarget.Text);
AddExportTarget(ExportTarget.Image);
btnExport.DropDownControl = menuExport;
menuExport.BeforePopup += menuExport_BeforePopup;
moduleLayout.BackColor = ColorHelper.GetControlColor(LookAndFeel);
LookAndFeel.StyleChanged += LookAndFeel_StyleChanged;
}
void LookAndFeel_StyleChanged(object sender, EventArgs e) {
moduleLayout.BackColor = ColorHelper.GetControlColor(LookAndFeel);
}
protected override void OnLoad(EventArgs e) {
base.OnLoad(e);
btnExport.MenuManager = MenuManagerHelper.FindMenuManager(AppHelper.MainForm);
}
void menuExport_BeforePopup(object sender, EventArgs e) {
foreach(DXMenuCheckItem item in menuExport.Items)
item.Checked = object.Equals(item.Tag, SelectedExport);
}
void AddExportTarget(ExportTarget target) {
var exportItem = new DXMenuCheckItem()
{
Caption = target.ToString(),
Tag = target
};
menuExport.Items.Add(exportItem);
exportItem.Click += exportItem_Click;
}
void exportItem_Click(object sender, EventArgs e) {
SelectedExport = (ExportTarget)((DXMenuItem)sender).Tag;
}
public void SetSettings(Control control) {
for(int i = settingsPanel.Controls.Count - 1; i >= 0; i--)
settingsPanel.Controls[i].Dispose();
if(control != null) {
control.Dock = DockStyle.Fill;
control.Parent = settingsPanel;
}
}
public bool ExportEnabled {
set { btnExport.Enabled = value; }
}
public ExportTarget SelectedExport {
get;
set;
}
public event EventHandler ExportClick;
void RaiseExportClick() {
if(ExportClick != null)
ExportClick(this, EventArgs.Empty);
}
void btnExport_Click(object sender, EventArgs e) {
RaiseExportClick();
}
}
}

View File

@@ -0,0 +1,120 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
</root>

View File

@@ -0,0 +1,318 @@
namespace DevExpress.DevAV {
partial class ReportPreviewControl {
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing) {
if(disposing && (components != null)) {
components.Dispose();
}
base.Dispose(disposing);
}
#region Component Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent() {
this.components = new System.ComponentModel.Container();
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(ReportPreviewControl));
this.documentViewerCore = new DevExpress.XtraPrinting.Preview.DocumentViewer();
this.documentViewerBarManager1 = new DevExpress.XtraPrinting.Preview.DocumentViewerBarManager(this.components);
this.previewBar1 = new DevExpress.XtraPrinting.Preview.PreviewBar();
this.printPreviewBarItem18 = new DevExpress.XtraPrinting.Preview.PrintPreviewBarItem();
this.printPreviewStaticItem1 = new DevExpress.XtraPrinting.Preview.PrintPreviewStaticItem();
this.printPreviewBarItem19 = new DevExpress.XtraPrinting.Preview.PrintPreviewBarItem();
this.progressBarEditItem1 = new DevExpress.XtraPrinting.Preview.ProgressBarEditItem();
this.repositoryItemProgressBar1 = new DevExpress.XtraEditors.Repository.RepositoryItemProgressBar();
this.printPreviewBarItem1 = new DevExpress.XtraPrinting.Preview.PrintPreviewBarItem();
this.printPreviewStaticItem2 = new DevExpress.XtraPrinting.Preview.PrintPreviewStaticItem();
this.zoomTrackBarEditItem1 = new DevExpress.XtraPrinting.Preview.ZoomTrackBarEditItem();
this.repositoryItemZoomTrackBar1 = new DevExpress.XtraEditors.Repository.RepositoryItemZoomTrackBar();
this.printPreviewBarItemWholePage = new DevExpress.XtraPrinting.Preview.PrintPreviewBarItem();
this.printPreviewBarItemMultiplePages = new DevExpress.XtraPrinting.Preview.PrintPreviewBarItem();
this.printPreviewBarItemScale = new DevExpress.XtraPrinting.Preview.PrintPreviewBarItem();
this.barDockControlTop = new DevExpress.XtraBars.BarDockControl();
this.barDockControlBottom = new DevExpress.XtraBars.BarDockControl();
this.barDockControlLeft = new DevExpress.XtraBars.BarDockControl();
this.barDockControlRight = new DevExpress.XtraBars.BarDockControl();
this.printPreviewRepositoryItemComboBox1 = new DevExpress.XtraPrinting.Preview.PrintPreviewRepositoryItemComboBox();
((System.ComponentModel.ISupportInitialize)(this.documentViewerBarManager1)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.repositoryItemProgressBar1)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.repositoryItemZoomTrackBar1)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.printPreviewRepositoryItemComboBox1)).BeginInit();
this.SuspendLayout();
//
// documentViewer
//
this.documentViewerCore.Dock = System.Windows.Forms.DockStyle.Fill;
this.documentViewerCore.IsMetric = false;
this.documentViewerCore.Location = new System.Drawing.Point(0, 0);
this.documentViewerCore.Name = "documentViewer";
this.documentViewerCore.Size = new System.Drawing.Size(1045, 553);
this.documentViewerCore.TabIndex = 0;
//
// documentViewerBarManager1
//
this.documentViewerBarManager1.Bars.AddRange(new DevExpress.XtraBars.Bar[] {
this.previewBar1});
this.documentViewerBarManager1.DockControls.Add(this.barDockControlTop);
this.documentViewerBarManager1.DockControls.Add(this.barDockControlBottom);
this.documentViewerBarManager1.DockControls.Add(this.barDockControlLeft);
this.documentViewerBarManager1.DockControls.Add(this.barDockControlRight);
this.documentViewerBarManager1.DocumentViewer = this.documentViewerCore;
this.documentViewerBarManager1.Form = this;
//this.documentViewerBarManager1.ImageStream = ((DevExpress.Utils.ImageCollectionStreamer)(resources.GetObject("documentViewerBarManager1.ImageStream")));
this.documentViewerBarManager1.Items.AddRange(new DevExpress.XtraBars.BarItem[] {
this.printPreviewStaticItem1,
this.progressBarEditItem1,
this.printPreviewBarItem1,
this.printPreviewStaticItem2,
this.zoomTrackBarEditItem1,
this.printPreviewBarItemScale,
this.printPreviewBarItem18,
this.printPreviewBarItem19,
this.printPreviewBarItemMultiplePages,
this.printPreviewBarItemWholePage});
this.documentViewerBarManager1.MaxItemId = 57;
this.documentViewerBarManager1.PreviewBar = this.previewBar1;
this.documentViewerBarManager1.RepositoryItems.AddRange(new DevExpress.XtraEditors.Repository.RepositoryItem[] {
this.repositoryItemProgressBar1,
this.repositoryItemZoomTrackBar1,
this.printPreviewRepositoryItemComboBox1});
this.documentViewerBarManager1.TransparentEditors = true;
//
// previewBar1
//
this.previewBar1.BarName = "Toolbar";
this.previewBar1.CanDockStyle = DevExpress.XtraBars.BarCanDockStyle.Bottom;
this.previewBar1.DockCol = 0;
this.previewBar1.DockRow = 0;
this.previewBar1.DockStyle = DevExpress.XtraBars.BarDockStyle.Bottom;
this.previewBar1.LinksPersistInfo.AddRange(new DevExpress.XtraBars.LinkPersistInfo[] {
new DevExpress.XtraBars.LinkPersistInfo(this.printPreviewBarItem18),
new DevExpress.XtraBars.LinkPersistInfo(this.printPreviewStaticItem1),
new DevExpress.XtraBars.LinkPersistInfo(this.printPreviewBarItem19),
new DevExpress.XtraBars.LinkPersistInfo(this.progressBarEditItem1),
new DevExpress.XtraBars.LinkPersistInfo(this.printPreviewBarItem1),
new DevExpress.XtraBars.LinkPersistInfo(this.printPreviewStaticItem2, true),
new DevExpress.XtraBars.LinkPersistInfo(this.zoomTrackBarEditItem1),
new DevExpress.XtraBars.LinkPersistInfo(this.printPreviewBarItemWholePage, true),
new DevExpress.XtraBars.LinkPersistInfo(this.printPreviewBarItemMultiplePages),
new DevExpress.XtraBars.LinkPersistInfo(this.printPreviewBarItemScale)});
this.previewBar1.OptionsBar.AllowQuickCustomization = false;
this.previewBar1.OptionsBar.DrawBorder = false;
this.previewBar1.OptionsBar.DrawDragBorder = false;
this.previewBar1.OptionsBar.UseWholeRow = true;
this.previewBar1.Text = "Toolbar";
//
// printPreviewBarItem18
//
this.printPreviewBarItem18.Caption = "Previous Page";
this.printPreviewBarItem18.Command = DevExpress.XtraPrinting.PrintingSystemCommand.ShowPrevPage;
this.printPreviewBarItem18.Enabled = false;
this.printPreviewBarItem18.Glyph = global::DevExpress.DevAV.Properties.Resources.icon_page_prev_16;
this.printPreviewBarItem18.Hint = "Previous Page";
this.printPreviewBarItem18.Id = 24;
this.printPreviewBarItem18.Name = "printPreviewBarItem18";
//
// printPreviewStaticItem1
//
this.printPreviewStaticItem1.Border = DevExpress.XtraEditors.Controls.BorderStyles.NoBorder;
this.printPreviewStaticItem1.Caption = "Nothing";
this.printPreviewStaticItem1.Id = 0;
this.printPreviewStaticItem1.LeftIndent = 1;
this.printPreviewStaticItem1.Name = "printPreviewStaticItem1";
this.printPreviewStaticItem1.RightIndent = 1;
this.printPreviewStaticItem1.TextAlignment = System.Drawing.StringAlignment.Near;
this.printPreviewStaticItem1.Type = "PageOfPages";
//
// printPreviewBarItem19
//
this.printPreviewBarItem19.Caption = "Next Page";
this.printPreviewBarItem19.Command = DevExpress.XtraPrinting.PrintingSystemCommand.ShowNextPage;
this.printPreviewBarItem19.Enabled = false;
this.printPreviewBarItem19.Glyph = global::DevExpress.DevAV.Properties.Resources.icon_page_next_16;
this.printPreviewBarItem19.Hint = "Next Page";
this.printPreviewBarItem19.Id = 25;
this.printPreviewBarItem19.Name = "printPreviewBarItem19";
//
// progressBarEditItem1
//
this.progressBarEditItem1.Edit = this.repositoryItemProgressBar1;
this.progressBarEditItem1.EditHeight = 12;
this.progressBarEditItem1.Id = 2;
this.progressBarEditItem1.Name = "progressBarEditItem1";
this.progressBarEditItem1.Visibility = DevExpress.XtraBars.BarItemVisibility.Never;
this.progressBarEditItem1.Width = 150;
//
// repositoryItemProgressBar1
//
this.repositoryItemProgressBar1.Name = "repositoryItemProgressBar1";
//
// printPreviewBarItem1
//
this.printPreviewBarItem1.Caption = "Stop";
this.printPreviewBarItem1.Command = DevExpress.XtraPrinting.PrintingSystemCommand.StopPageBuilding;
this.printPreviewBarItem1.Enabled = false;
this.printPreviewBarItem1.Hint = "Stop";
this.printPreviewBarItem1.Id = 3;
this.printPreviewBarItem1.Name = "printPreviewBarItem1";
this.printPreviewBarItem1.Visibility = DevExpress.XtraBars.BarItemVisibility.Never;
//
// printPreviewStaticItem2
//
this.printPreviewStaticItem2.Alignment = DevExpress.XtraBars.BarItemLinkAlignment.Right;
this.printPreviewStaticItem2.Border = DevExpress.XtraEditors.Controls.BorderStyles.NoBorder;
this.printPreviewStaticItem2.Caption = "100%";
this.printPreviewStaticItem2.Id = 5;
this.printPreviewStaticItem2.Name = "printPreviewStaticItem2";
this.printPreviewStaticItem2.TextAlignment = System.Drawing.StringAlignment.Far;
this.printPreviewStaticItem2.Type = "ZoomFactor";
//
// zoomTrackBarEditItem1
//
this.zoomTrackBarEditItem1.Alignment = DevExpress.XtraBars.BarItemLinkAlignment.Right;
this.zoomTrackBarEditItem1.Edit = this.repositoryItemZoomTrackBar1;
this.zoomTrackBarEditItem1.EditValue = 90;
this.zoomTrackBarEditItem1.Enabled = false;
this.zoomTrackBarEditItem1.Id = 6;
this.zoomTrackBarEditItem1.Name = "zoomTrackBarEditItem1";
this.zoomTrackBarEditItem1.Range = new int[] {
10,
500};
this.zoomTrackBarEditItem1.Width = 140;
//
// repositoryItemZoomTrackBar1
//
this.repositoryItemZoomTrackBar1.Alignment = DevExpress.Utils.VertAlignment.Center;
this.repositoryItemZoomTrackBar1.AllowFocused = false;
this.repositoryItemZoomTrackBar1.BorderStyle = DevExpress.XtraEditors.Controls.BorderStyles.NoBorder;
this.repositoryItemZoomTrackBar1.Maximum = 180;
this.repositoryItemZoomTrackBar1.Middle = 5;
this.repositoryItemZoomTrackBar1.Name = "repositoryItemZoomTrackBar1";
this.repositoryItemZoomTrackBar1.ScrollThumbStyle = DevExpress.XtraEditors.Repository.ScrollThumbStyle.ArrowDownRight;
//
// printPreviewBarItemWholePage
//
this.printPreviewBarItemWholePage.Alignment = DevExpress.XtraBars.BarItemLinkAlignment.Right;
this.printPreviewBarItemWholePage.Caption = "Fit To Page";
this.printPreviewBarItemWholePage.Command = DevExpress.XtraPrinting.PrintingSystemCommand.ZoomToWholePage;
this.printPreviewBarItemWholePage.Enabled = false;
this.printPreviewBarItemWholePage.Glyph = global::DevExpress.DevAV.Properties.Resources.icon_fittopage_16;
this.printPreviewBarItemWholePage.Hint = "Fit to Page";
this.printPreviewBarItemWholePage.Id = 27;
this.printPreviewBarItemWholePage.Name = "printPreviewBarItemWholePage";
//
// printPreviewBarItemMultiplePages
//
this.printPreviewBarItemMultiplePages.Alignment = DevExpress.XtraBars.BarItemLinkAlignment.Right;
this.printPreviewBarItemMultiplePages.ButtonStyle = DevExpress.XtraBars.BarButtonStyle.DropDown;
this.printPreviewBarItemMultiplePages.Caption = "Multiple Pages";
this.printPreviewBarItemMultiplePages.Command = DevExpress.XtraPrinting.PrintingSystemCommand.MultiplePages;
this.printPreviewBarItemMultiplePages.Enabled = false;
this.printPreviewBarItemMultiplePages.Glyph = global::DevExpress.DevAV.Properties.Resources.icon_pages_16;
this.printPreviewBarItemMultiplePages.Hint = "Multiple Pages";
this.printPreviewBarItemMultiplePages.Id = 27;
this.printPreviewBarItemMultiplePages.Name = "printPreviewBarItemMultiplePages";
//
// printPreviewBarItemScale
//
this.printPreviewBarItemScale.ActAsDropDown = true;
this.printPreviewBarItemScale.Alignment = DevExpress.XtraBars.BarItemLinkAlignment.Right;
this.printPreviewBarItemScale.ButtonStyle = DevExpress.XtraBars.BarButtonStyle.DropDown;
this.printPreviewBarItemScale.Caption = "Scale";
this.printPreviewBarItemScale.Command = DevExpress.XtraPrinting.PrintingSystemCommand.Scale;
this.printPreviewBarItemScale.Enabled = false;
this.printPreviewBarItemScale.Hint = "Scale";
this.printPreviewBarItemScale.Id = 17;
this.printPreviewBarItemScale.ImageIndex = 25;
this.printPreviewBarItemScale.Name = "printPreviewBarItemScale";
//
// barDockControlTop
//
this.barDockControlTop.CausesValidation = false;
this.barDockControlTop.Dock = System.Windows.Forms.DockStyle.Top;
this.barDockControlTop.Location = new System.Drawing.Point(0, 0);
this.barDockControlTop.Size = new System.Drawing.Size(1045, 0);
//
// barDockControlBottom
//
this.barDockControlBottom.CausesValidation = false;
this.barDockControlBottom.Dock = System.Windows.Forms.DockStyle.Bottom;
this.barDockControlBottom.Location = new System.Drawing.Point(0, 553);
this.barDockControlBottom.Size = new System.Drawing.Size(1045, 31);
//
// barDockControlLeft
//
this.barDockControlLeft.CausesValidation = false;
this.barDockControlLeft.Dock = System.Windows.Forms.DockStyle.Left;
this.barDockControlLeft.Location = new System.Drawing.Point(0, 0);
this.barDockControlLeft.Size = new System.Drawing.Size(0, 553);
//
// barDockControlRight
//
this.barDockControlRight.CausesValidation = false;
this.barDockControlRight.Dock = System.Windows.Forms.DockStyle.Right;
this.barDockControlRight.Location = new System.Drawing.Point(1045, 0);
this.barDockControlRight.Size = new System.Drawing.Size(0, 553);
//
// printPreviewRepositoryItemComboBox1
//
this.printPreviewRepositoryItemComboBox1.AutoComplete = false;
this.printPreviewRepositoryItemComboBox1.Buttons.AddRange(new DevExpress.XtraEditors.Controls.EditorButton[] {
new DevExpress.XtraEditors.Controls.EditorButton(DevExpress.XtraEditors.Controls.ButtonPredefines.Combo)});
this.printPreviewRepositoryItemComboBox1.DropDownRows = 11;
this.printPreviewRepositoryItemComboBox1.Name = "printPreviewRepositoryItemComboBox1";
//
// ReportPreviewControl
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.Controls.Add(this.documentViewerCore);
this.Controls.Add(this.barDockControlLeft);
this.Controls.Add(this.barDockControlRight);
this.Controls.Add(this.barDockControlBottom);
this.Controls.Add(this.barDockControlTop);
this.Name = "ReportPreviewControl";
this.Size = new System.Drawing.Size(1045, 584);
((System.ComponentModel.ISupportInitialize)(this.documentViewerBarManager1)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.repositoryItemProgressBar1)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.repositoryItemZoomTrackBar1)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.printPreviewRepositoryItemComboBox1)).EndInit();
this.ResumeLayout(false);
}
#endregion
private XtraPrinting.Preview.DocumentViewer documentViewerCore;
private XtraPrinting.Preview.DocumentViewerBarManager documentViewerBarManager1;
private XtraPrinting.Preview.PreviewBar previewBar1;
private XtraPrinting.Preview.PrintPreviewBarItem printPreviewBarItem18;
private XtraPrinting.Preview.PrintPreviewStaticItem printPreviewStaticItem1;
private XtraPrinting.Preview.PrintPreviewBarItem printPreviewBarItem19;
private XtraPrinting.Preview.ProgressBarEditItem progressBarEditItem1;
private XtraEditors.Repository.RepositoryItemProgressBar repositoryItemProgressBar1;
private XtraPrinting.Preview.PrintPreviewBarItem printPreviewBarItem1;
private XtraPrinting.Preview.PrintPreviewStaticItem printPreviewStaticItem2;
private XtraPrinting.Preview.ZoomTrackBarEditItem zoomTrackBarEditItem1;
private XtraEditors.Repository.RepositoryItemZoomTrackBar repositoryItemZoomTrackBar1;
private XtraPrinting.Preview.PrintPreviewBarItem printPreviewBarItemWholePage;
private XtraPrinting.Preview.PrintPreviewBarItem printPreviewBarItemScale;
private XtraPrinting.Preview.PrintPreviewBarItem printPreviewBarItemMultiplePages;
private XtraBars.BarDockControl barDockControlTop;
private XtraBars.BarDockControl barDockControlBottom;
private XtraBars.BarDockControl barDockControlLeft;
private XtraBars.BarDockControl barDockControlRight;
private XtraPrinting.Preview.PrintPreviewRepositoryItemComboBox printPreviewRepositoryItemComboBox1;
}
}

View File

@@ -0,0 +1,32 @@
using System;
using System.ComponentModel;
using DevExpress.XtraEditors;
using DevExpress.XtraPrinting.Preview;
namespace DevExpress.DevAV {
public partial class ReportPreviewControl : XtraUserControl {
public ReportPreviewControl() {
InitializeComponent();
}
public DocumentViewer DocumentViewer {
get { return documentViewerCore; }
}
protected override void OnLoad(System.EventArgs e) {
base.OnLoad(e);
DocumentViewer.BackColor = ColorHelper.GetControlColor(LookAndFeel);
LookAndFeel.StyleChanged += LookAndFeel_StyleChanged;
}
void LookAndFeel_StyleChanged(object sender, EventArgs e) {
DocumentViewer.BackColor = ColorHelper.GetControlColor(LookAndFeel);
}
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden), Browsable(false)]
public object DocumentSource {
get { return documentViewerCore.DocumentSource; }
set {
if(!ReferenceEquals(documentViewerCore.DocumentSource, value)) {
documentViewerCore.DocumentSource = value;
}
}
}
}
}

View File

@@ -0,0 +1,123 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<metadata name="documentViewerBarManager1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>17, 17</value>
</metadata>
</root>

View File

@@ -0,0 +1,280 @@
namespace DevExpress.DevAV {
partial class ReportPrintControl {
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing) {
if(disposing && (components != null)) {
components.Dispose();
if(imagesContainer != null) {
imagesContainer.Dispose();
imagesContainer = null;
}
}
base.Dispose(disposing);
}
#region Component Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent() {
this.moduleLayout = new DevExpress.XtraLayout.LayoutControl();
this.settingsPanel = new DevExpress.DevAV.SettingPanel();
this.btnPrint = new DevExpress.XtraEditors.SimpleButton();
this.btnOptions = new DevExpress.XtraEditors.SimpleButton();
this.cbPrinters = new DevExpress.XtraEditors.ImageComboBoxEdit();
this.layoutControlGroup1 = new DevExpress.XtraLayout.LayoutControlGroup();
this.ItemForButtonPrint = new DevExpress.XtraLayout.LayoutControlItem();
this.ItemForPrinters = new DevExpress.XtraLayout.LayoutControlItem();
this.ItemForOptions = new DevExpress.XtraLayout.LayoutControlItem();
this.emptySpaceItem1 = new DevExpress.XtraLayout.EmptySpaceItem();
this.captionLabelItem = new DevExpress.XtraLayout.SimpleLabelItem();
this.buttonLabelItem = new DevExpress.XtraLayout.SimpleLabelItem();
this.separator = new DevExpress.XtraLayout.SimpleSeparator();
this.ItemForSettings = new DevExpress.XtraLayout.LayoutControlItem();
((System.ComponentModel.ISupportInitialize)(this.moduleLayout)).BeginInit();
this.moduleLayout.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.cbPrinters.Properties)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.layoutControlGroup1)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.ItemForButtonPrint)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.ItemForPrinters)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.ItemForOptions)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.emptySpaceItem1)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.captionLabelItem)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.buttonLabelItem)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.separator)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.ItemForSettings)).BeginInit();
this.SuspendLayout();
//
// moduleLayout
//
this.moduleLayout.AllowCustomization = false;
this.moduleLayout.Controls.Add(this.settingsPanel);
this.moduleLayout.Controls.Add(this.btnPrint);
this.moduleLayout.Controls.Add(this.btnOptions);
this.moduleLayout.Controls.Add(this.cbPrinters);
this.moduleLayout.Dock = System.Windows.Forms.DockStyle.Fill;
this.moduleLayout.Location = new System.Drawing.Point(0, 0);
this.moduleLayout.Name = "moduleLayout";
this.moduleLayout.Root = this.layoutControlGroup1;
this.moduleLayout.Size = new System.Drawing.Size(310, 600);
this.moduleLayout.TabIndex = 0;
//
// settingsPanel
//
this.settingsPanel.Location = new System.Drawing.Point(40, 318);
this.settingsPanel.Name = "settingsPanel";
this.settingsPanel.Size = new System.Drawing.Size(228, 242);
this.settingsPanel.TabIndex = 4;
//
// btnPrint
//
this.btnPrint.Enabled = false;
this.btnPrint.Image = global::DevExpress.DevAV.Properties.Resources.icon_print_42x40;
this.btnPrint.ImageLocation = DevExpress.XtraEditors.ImageLocation.TopCenter;
this.btnPrint.Location = new System.Drawing.Point(40, 89);
this.btnPrint.MaximumSize = new System.Drawing.Size(75, 75);
this.btnPrint.MinimumSize = new System.Drawing.Size(75, 75);
this.btnPrint.Name = "btnPrint";
this.btnPrint.Size = new System.Drawing.Size(75, 75);
this.btnPrint.StyleController = this.moduleLayout;
this.btnPrint.TabIndex = 1;
this.btnPrint.Text = "Print";
this.btnPrint.Click += new System.EventHandler(this.btnPrint_Click);
//
// btnOptions
//
this.btnOptions.Enabled = false;
this.btnOptions.Location = new System.Drawing.Point(40, 245);
this.btnOptions.Name = "btnOptions";
this.btnOptions.Size = new System.Drawing.Size(112, 22);
this.btnOptions.StyleController = this.moduleLayout;
this.btnOptions.TabIndex = 3;
this.btnOptions.Text = "Print Options";
this.btnOptions.Click += new System.EventHandler(this.btnOptions_Click);
//
// cbPrinters
//
this.cbPrinters.Location = new System.Drawing.Point(40, 217);
this.cbPrinters.Name = "cbPrinters";
this.cbPrinters.Properties.Buttons.AddRange(new DevExpress.XtraEditors.Controls.EditorButton[] {
new DevExpress.XtraEditors.Controls.EditorButton(DevExpress.XtraEditors.Controls.ButtonPredefines.Combo)});
this.cbPrinters.Size = new System.Drawing.Size(228, 20);
this.cbPrinters.StyleController = this.moduleLayout;
this.cbPrinters.TabIndex = 2;
//
// layoutControlGroup1
//
this.layoutControlGroup1.CustomizationFormText = "Root";
this.layoutControlGroup1.EnableIndentsWithoutBorders = DevExpress.Utils.DefaultBoolean.True;
this.layoutControlGroup1.GroupBordersVisible = false;
this.layoutControlGroup1.Items.AddRange(new DevExpress.XtraLayout.BaseLayoutItem[] {
this.ItemForButtonPrint,
this.ItemForPrinters,
this.ItemForOptions,
this.emptySpaceItem1,
this.captionLabelItem,
this.buttonLabelItem,
this.separator,
this.ItemForSettings});
this.layoutControlGroup1.Location = new System.Drawing.Point(0, 0);
this.layoutControlGroup1.Name = "Root";
this.layoutControlGroup1.Padding = new DevExpress.XtraLayout.Utils.Padding(40, 0, 0, 40);
this.layoutControlGroup1.Size = new System.Drawing.Size(310, 600);
this.layoutControlGroup1.Text = "Root";
//
// ItemForButtonPrint
//
this.ItemForButtonPrint.Control = this.btnPrint;
this.ItemForButtonPrint.CustomizationFormText = "Print";
this.ItemForButtonPrint.Location = new System.Drawing.Point(0, 89);
this.ItemForButtonPrint.Name = "layoutControlItem1";
this.ItemForButtonPrint.Padding = new DevExpress.XtraLayout.Utils.Padding(0, 0, 0, 0);
this.ItemForButtonPrint.Size = new System.Drawing.Size(75, 75);
this.ItemForButtonPrint.Text = "Print";
this.ItemForButtonPrint.TextSize = new System.Drawing.Size(0, 0);
this.ItemForButtonPrint.TextToControlDistance = 0;
this.ItemForButtonPrint.TextVisible = false;
//
// ItemForPrinters
//
this.ItemForPrinters.AppearanceItemCaption.Font = new System.Drawing.Font("Segoe UI", 18F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.ItemForPrinters.AppearanceItemCaption.Options.UseFont = true;
this.ItemForPrinters.Control = this.cbPrinters;
this.ItemForPrinters.CustomizationFormText = "Printer";
this.ItemForPrinters.Location = new System.Drawing.Point(0, 164);
this.ItemForPrinters.Name = "Printer";
this.ItemForPrinters.Padding = new DevExpress.XtraLayout.Utils.Padding(0, 0, 16, 8);
this.ItemForPrinters.Size = new System.Drawing.Size(228, 81);
this.ItemForPrinters.Text = "Printer";
this.ItemForPrinters.TextAlignMode = DevExpress.XtraLayout.TextAlignModeItem.AutoSize;
this.ItemForPrinters.TextLocation = DevExpress.Utils.Locations.Top;
this.ItemForPrinters.TextSize = new System.Drawing.Size(70, 32);
this.ItemForPrinters.TextToControlDistance = 5;
//
// ItemForOptions
//
this.ItemForOptions.Control = this.btnOptions;
this.ItemForOptions.CustomizationFormText = "layoutControlItem3";
this.ItemForOptions.Location = new System.Drawing.Point(0, 245);
this.ItemForOptions.Name = "layoutControlItem3";
this.ItemForOptions.Padding = new DevExpress.XtraLayout.Utils.Padding(0, 0, 0, 0);
this.ItemForOptions.Size = new System.Drawing.Size(112, 22);
this.ItemForOptions.Text = "layoutControlItem3";
this.ItemForOptions.TextSize = new System.Drawing.Size(0, 0);
this.ItemForOptions.TextToControlDistance = 0;
this.ItemForOptions.TextVisible = false;
//
// emptySpaceItem1
//
this.emptySpaceItem1.AllowHotTrack = false;
this.emptySpaceItem1.CustomizationFormText = "emptySpaceItem1";
this.emptySpaceItem1.Location = new System.Drawing.Point(112, 245);
this.emptySpaceItem1.Name = "emptySpaceItem1";
this.emptySpaceItem1.Size = new System.Drawing.Size(116, 22);
this.emptySpaceItem1.Text = "emptySpaceItem1";
this.emptySpaceItem1.TextSize = new System.Drawing.Size(0, 0);
//
// captionLabelItem
//
this.captionLabelItem.AllowHotTrack = false;
this.captionLabelItem.AppearanceItemCaption.Font = new System.Drawing.Font("Segoe UI", 36F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.captionLabelItem.AppearanceItemCaption.Options.UseFont = true;
this.captionLabelItem.CustomizationFormText = "Print";
this.captionLabelItem.Location = new System.Drawing.Point(0, 0);
this.captionLabelItem.Name = "simpleLabelItem1";
this.captionLabelItem.Padding = new DevExpress.XtraLayout.Utils.Padding(0, 0, 0, 24);
this.captionLabelItem.Size = new System.Drawing.Size(228, 89);
this.captionLabelItem.Text = "Print";
this.captionLabelItem.TextSize = new System.Drawing.Size(114, 65);
//
// buttonLabelItem
//
this.buttonLabelItem.AllowHotTrack = false;
this.buttonLabelItem.AllowHtmlStringInCaption = true;
this.buttonLabelItem.AppearanceItemCaption.Options.UseTextOptions = true;
this.buttonLabelItem.AppearanceItemCaption.TextOptions.WordWrap = DevExpress.Utils.WordWrap.Wrap;
this.buttonLabelItem.CustomizationFormText = "Specify how you want<br>the report to be printed";
this.buttonLabelItem.Location = new System.Drawing.Point(75, 89);
this.buttonLabelItem.Name = "simpleLabelItem2";
this.buttonLabelItem.Padding = new DevExpress.XtraLayout.Utils.Padding(12, 0, 0, 0);
this.buttonLabelItem.Size = new System.Drawing.Size(153, 75);
this.buttonLabelItem.Text = "Specify how you want<br>the report to be printed";
this.buttonLabelItem.TextSize = new System.Drawing.Size(114, 26);
//
// separator
//
this.separator.AllowHotTrack = false;
this.separator.CustomizationFormText = "simpleSeparator1";
this.separator.Location = new System.Drawing.Point(228, 0);
this.separator.Name = "simpleSeparator1";
this.separator.Padding = new DevExpress.XtraLayout.Utils.Padding(0, 0, 0, 0);
this.separator.Size = new System.Drawing.Size(42, 560);
this.separator.Spacing = new DevExpress.XtraLayout.Utils.Padding(40, 0, 0, 0);
this.separator.Text = "simpleSeparator1";
//
// ItemForSettings
//
this.ItemForSettings.AppearanceItemCaption.Font = new System.Drawing.Font("Segoe UI", 18F);
this.ItemForSettings.AppearanceItemCaption.Options.UseFont = true;
this.ItemForSettings.Control = this.settingsPanel;
this.ItemForSettings.CustomizationFormText = "Settings";
this.ItemForSettings.Location = new System.Drawing.Point(0, 267);
this.ItemForSettings.Name = "ItemForSettings";
this.ItemForSettings.Padding = new DevExpress.XtraLayout.Utils.Padding(0, 0, 16, 0);
this.ItemForSettings.Size = new System.Drawing.Size(228, 293);
this.ItemForSettings.Text = "Settings";
this.ItemForSettings.TextLocation = DevExpress.Utils.Locations.Top;
this.ItemForSettings.TextSize = new System.Drawing.Size(114, 32);
//
// ReportPrintControl
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.Controls.Add(this.moduleLayout);
this.Name = "ReportPrintControl";
this.Size = new System.Drawing.Size(310, 600);
((System.ComponentModel.ISupportInitialize)(this.moduleLayout)).EndInit();
this.moduleLayout.ResumeLayout(false);
((System.ComponentModel.ISupportInitialize)(this.cbPrinters.Properties)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.layoutControlGroup1)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.ItemForButtonPrint)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.ItemForPrinters)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.ItemForOptions)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.emptySpaceItem1)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.captionLabelItem)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.buttonLabelItem)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.separator)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.ItemForSettings)).EndInit();
this.ResumeLayout(false);
}
#endregion
private DevExpress.XtraEditors.SimpleButton btnPrint;
private XtraEditors.ImageComboBoxEdit cbPrinters;
private DevExpress.XtraEditors.SimpleButton btnOptions;
private DevExpress.XtraLayout.LayoutControl moduleLayout;
private XtraLayout.LayoutControlGroup layoutControlGroup1;
private XtraLayout.LayoutControlItem ItemForButtonPrint;
private XtraLayout.LayoutControlItem ItemForOptions;
private XtraLayout.EmptySpaceItem emptySpaceItem1;
private XtraLayout.SimpleLabelItem captionLabelItem;
private XtraLayout.LayoutControlItem ItemForPrinters;
private XtraLayout.SimpleLabelItem buttonLabelItem;
private XtraLayout.SimpleSeparator separator;
private SettingPanel settingsPanel;
private XtraLayout.LayoutControlItem ItemForSettings;
}
}

View File

@@ -0,0 +1,93 @@
using System;
using System.ComponentModel;
using DevExpress.XtraEditors;
using DevExpress.XtraEditors.Controls;
using DevExpress.XtraEditors.Preview;
using DevExpress.XtraLayout.Utils;
using System.Windows.Forms;
using DevExpress.Printing;
namespace DevExpress.DevAV {
public partial class ReportPrintControl : XtraUserControl {
PrinterImagesContainer imagesContainer;
PrinterItemContainer printerItemContainer;
public ReportPrintControl() {
InitializeComponent();
imagesContainer = new PrinterImagesContainer();
CreatePrinterItemContainer();
moduleLayout.BackColor = ColorHelper.GetControlColor(LookAndFeel);
LookAndFeel.StyleChanged += LookAndFeel_StyleChanged;
}
void CreatePrinterItemContainer() {
try {
printerItemContainer = new PrinterItemContainer();
} catch { }
}
void LookAndFeel_StyleChanged(object sender, EventArgs e) {
moduleLayout.BackColor = ColorHelper.GetControlColor(LookAndFeel);
}
protected override void OnLoad(EventArgs e) {
base.OnLoad(e);
cbPrinters.Properties.LargeImages = imagesContainer.LargeImages;
cbPrinters.Properties.SmallImages = imagesContainer.SmallImages;
if(printerItemContainer != null) {
foreach(PrinterItem item in printerItemContainer.Items)
cbPrinters.Properties.Items.Add(new ImageComboBoxItem(item.DisplayName, item, imagesContainer.GetImageIndex(item)));
}
}
public bool PrintEnabled {
set { btnOptions.Enabled = btnPrint.Enabled = value; }
}
public bool SettingsVisible {
set {
ItemForSettings.Visibility = value ?
LayoutVisibility.Always : LayoutVisibility.Never;
}
}
public void SetSettings(Control control) {
for(int i = settingsPanel.Controls.Count - 1; i >= 0; i--)
settingsPanel.Controls[i].Dispose();
if(control != null) {
control.Dock = DockStyle.Fill;
control.Parent = settingsPanel;
}
}
public string SelectedPrinterName {
get {
PrinterItem item = cbPrinters.EditValue as PrinterItem;
if(item != null)
return item.FullName;
return string.Empty;
}
set { cbPrinters.EditValue = FindPrinterItem(value); }
}
PrinterItem FindPrinterItem(string value) {
if(printerItemContainer != null) {
for(int i = 0; i < printerItemContainer.Items.Count; i++) {
if(printerItemContainer.Items[i].FullName != value) continue;
return printerItemContainer.Items[i];
}
}
return null;
}
public event EventHandler PrintClick;
public event EventHandler PrintOptionsClick;
void RaisePrintOptionsClick() {
if(PrintOptionsClick != null)
PrintOptionsClick(this, EventArgs.Empty);
}
void RaisePrintClick() {
if(PrintClick != null)
PrintClick(this, EventArgs.Empty);
}
void btnPrint_Click(object sender, EventArgs e) {
RaisePrintClick();
}
void btnOptions_Click(object sender, EventArgs e) {
RaisePrintOptionsClick();
}
}
[ToolboxItem(false), Designer("System.Windows.Forms.Design.ParentControlDesigner, System.Design", typeof(System.ComponentModel.Design.IDesigner))]
public class SettingPanel : XtraUserControl { }
}

View File

@@ -0,0 +1,120 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
</root>

View File

@@ -0,0 +1,145 @@
namespace DevExpress.DevAV {
partial class ContactsControl {
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing) {
if(disposing && (components != null)) {
components.Dispose();
}
base.Dispose(disposing);
}
#region Component Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent() {
this.settingsLayout = new DevExpress.XtraLayout.LayoutControl();
this.btnIncludeContacts = new DevExpress.XtraEditors.CheckButton();
this.btnExcludeContacts = new DevExpress.XtraEditors.CheckButton();
this.Root = new DevExpress.XtraLayout.LayoutControlGroup();
this.layoutControlItem1 = new DevExpress.XtraLayout.LayoutControlItem();
this.layoutControlItem2 = new DevExpress.XtraLayout.LayoutControlItem();
((System.ComponentModel.ISupportInitialize)(this.settingsLayout)).BeginInit();
this.settingsLayout.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.Root)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.layoutControlItem1)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.layoutControlItem2)).BeginInit();
this.SuspendLayout();
//
// settingsLayout
//
this.settingsLayout.AllowCustomization = false;
this.settingsLayout.Controls.Add(this.btnIncludeContacts);
this.settingsLayout.Controls.Add(this.btnExcludeContacts);
this.settingsLayout.Dock = System.Windows.Forms.DockStyle.Fill;
this.settingsLayout.Location = new System.Drawing.Point(0, 0);
this.settingsLayout.Name = "settingsLayout";
this.settingsLayout.Root = this.Root;
this.settingsLayout.Size = new System.Drawing.Size(238, 232);
this.settingsLayout.TabIndex = 3;
//
// btnIncludeContacts
//
this.btnIncludeContacts.Checked = true;
this.btnIncludeContacts.GroupIndex = 1;
this.btnIncludeContacts.ImageUri.ResourceType = typeof(DevExpress.DevAV.MainForm);
this.btnIncludeContacts.ImageUri.Uri = "resource://DevExpress.DevAV.Resources.PrintIncludeEvaluations.svg";
this.btnIncludeContacts.Location = new System.Drawing.Point(0, 0);
this.btnIncludeContacts.MaximumSize = new System.Drawing.Size(0, 40);
this.btnIncludeContacts.MinimumSize = new System.Drawing.Size(0, 40);
this.btnIncludeContacts.Name = "btnIncludeContacts";
this.btnIncludeContacts.ShowFocusRectangle = DevExpress.Utils.DefaultBoolean.False;
this.btnIncludeContacts.Size = new System.Drawing.Size(238, 40);
this.btnIncludeContacts.StyleController = this.settingsLayout;
this.btnIncludeContacts.TabIndex = 2;
this.btnIncludeContacts.Text = "Include Contacts";
this.btnIncludeContacts.CheckedChanged += new System.EventHandler(this.btnIncludeContacts_CheckedChanged);
//
// btnExcludeContacts
//
this.btnExcludeContacts.GroupIndex = 1;
this.btnExcludeContacts.ImageUri.ResourceType = typeof(DevExpress.DevAV.MainForm);
this.btnExcludeContacts.ImageUri.Uri = "resource://DevExpress.DevAV.Resources.PrintExcludeEvaluations.svg";
this.btnExcludeContacts.Location = new System.Drawing.Point(0, 40);
this.btnExcludeContacts.MaximumSize = new System.Drawing.Size(0, 40);
this.btnExcludeContacts.MinimumSize = new System.Drawing.Size(0, 40);
this.btnExcludeContacts.Name = "btnExcludeContacts";
this.btnExcludeContacts.ShowFocusRectangle = DevExpress.Utils.DefaultBoolean.False;
this.btnExcludeContacts.Size = new System.Drawing.Size(238, 40);
this.btnExcludeContacts.StyleController = this.settingsLayout;
this.btnExcludeContacts.TabIndex = 2;
this.btnExcludeContacts.TabStop = false;
this.btnExcludeContacts.Text = "Exclude Contacts";
this.btnExcludeContacts.CheckedChanged += new System.EventHandler(this.btnExcludeContacts_CheckedChanged);
//
// Root
//
this.Root.CustomizationFormText = "Root";
this.Root.EnableIndentsWithoutBorders = DevExpress.Utils.DefaultBoolean.False;
this.Root.GroupBordersVisible = false;
this.Root.Items.AddRange(new DevExpress.XtraLayout.BaseLayoutItem[] {
this.layoutControlItem1,
this.layoutControlItem2});
this.Root.Location = new System.Drawing.Point(0, 0);
this.Root.Name = "Root";
this.Root.Padding = new DevExpress.XtraLayout.Utils.Padding(0, 0, 0, 0);
this.Root.Size = new System.Drawing.Size(238, 232);
//
// layoutControlItem1
//
this.layoutControlItem1.Control = this.btnIncludeContacts;
this.layoutControlItem1.CustomizationFormText = "layoutControlItem1";
this.layoutControlItem1.Location = new System.Drawing.Point(0, 0);
this.layoutControlItem1.Name = "layoutControlItem1";
this.layoutControlItem1.Padding = new DevExpress.XtraLayout.Utils.Padding(0, 0, 0, 0);
this.layoutControlItem1.Size = new System.Drawing.Size(238, 40);
this.layoutControlItem1.TextSize = new System.Drawing.Size(0, 0);
this.layoutControlItem1.TextVisible = false;
//
// layoutControlItem2
//
this.layoutControlItem2.Control = this.btnExcludeContacts;
this.layoutControlItem2.CustomizationFormText = "layoutControlItem2";
this.layoutControlItem2.Location = new System.Drawing.Point(0, 40);
this.layoutControlItem2.Name = "layoutControlItem2";
this.layoutControlItem2.Padding = new DevExpress.XtraLayout.Utils.Padding(0, 0, 0, 0);
this.layoutControlItem2.Size = new System.Drawing.Size(238, 192);
this.layoutControlItem2.TextSize = new System.Drawing.Size(0, 0);
this.layoutControlItem2.TextVisible = false;
//
// ContactsControl
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.Controls.Add(this.settingsLayout);
this.Name = "ContactsControl";
this.Size = new System.Drawing.Size(238, 232);
((System.ComponentModel.ISupportInitialize)(this.settingsLayout)).EndInit();
this.settingsLayout.ResumeLayout(false);
((System.ComponentModel.ISupportInitialize)(this.Root)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.layoutControlItem1)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.layoutControlItem2)).EndInit();
this.ResumeLayout(false);
}
#endregion
private XtraLayout.LayoutControl settingsLayout;
private XtraEditors.CheckButton btnIncludeContacts;
private XtraEditors.CheckButton btnExcludeContacts;
private XtraLayout.LayoutControlGroup Root;
private XtraLayout.LayoutControlItem layoutControlItem1;
private XtraLayout.LayoutControlItem layoutControlItem2;
}
}

View File

@@ -0,0 +1,28 @@
using System;
using System.Windows.Forms;
namespace DevExpress.DevAV {
public partial class ContactsControl : UserControl {
Action<bool> callback;
bool defaultValue;
public ContactsControl() {
InitializeComponent();
}
public ContactsControl(Action<bool> callback, bool defaultValue)
: this() {
this.callback = callback;
this.defaultValue = defaultValue;
}
protected override void OnLoad(EventArgs e) {
base.OnLoad(e);
if(defaultValue) btnIncludeContacts.Checked = true;
else btnExcludeContacts.Checked = true;
}
void btnIncludeContacts_CheckedChanged(object sender, EventArgs e) {
if(callback != null) callback(true);
}
void btnExcludeContacts_CheckedChanged(object sender, EventArgs e) {
if(callback != null) callback(false);
}
}
}

View File

@@ -0,0 +1,120 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
</root>

View File

@@ -0,0 +1,145 @@
namespace DevExpress.DevAV {
partial class EvaluationsControl {
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing) {
if(disposing && (components != null)) {
components.Dispose();
}
base.Dispose(disposing);
}
#region Component Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent() {
this.settingsLayout = new DevExpress.XtraLayout.LayoutControl();
this.btnIncludeEvaluations = new DevExpress.XtraEditors.CheckButton();
this.btnExcludeEvaluations = new DevExpress.XtraEditors.CheckButton();
this.Root = new DevExpress.XtraLayout.LayoutControlGroup();
this.layoutControlItem1 = new DevExpress.XtraLayout.LayoutControlItem();
this.layoutControlItem2 = new DevExpress.XtraLayout.LayoutControlItem();
((System.ComponentModel.ISupportInitialize)(this.settingsLayout)).BeginInit();
this.settingsLayout.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.Root)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.layoutControlItem1)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.layoutControlItem2)).BeginInit();
this.SuspendLayout();
//
// settingsLayout
//
this.settingsLayout.AllowCustomization = false;
this.settingsLayout.Controls.Add(this.btnIncludeEvaluations);
this.settingsLayout.Controls.Add(this.btnExcludeEvaluations);
this.settingsLayout.Dock = System.Windows.Forms.DockStyle.Fill;
this.settingsLayout.Location = new System.Drawing.Point(0, 0);
this.settingsLayout.Name = "settingsLayout";
this.settingsLayout.Root = this.Root;
this.settingsLayout.Size = new System.Drawing.Size(238, 232);
this.settingsLayout.TabIndex = 3;
//
// btnIncludeEvaluations
//
this.btnIncludeEvaluations.Checked = true;
this.btnIncludeEvaluations.GroupIndex = 1;
this.btnIncludeEvaluations.ImageUri.ResourceType = typeof(DevExpress.DevAV.MainForm);
this.btnIncludeEvaluations.ImageUri.Uri = "resource://DevExpress.DevAV.Resources.PrintIncludeEvaluations.svg";
this.btnIncludeEvaluations.Location = new System.Drawing.Point(0, 0);
this.btnIncludeEvaluations.MaximumSize = new System.Drawing.Size(0, 40);
this.btnIncludeEvaluations.MinimumSize = new System.Drawing.Size(0, 40);
this.btnIncludeEvaluations.Name = "btnIncludeEvaluations";
this.btnIncludeEvaluations.ShowFocusRectangle = DevExpress.Utils.DefaultBoolean.False;
this.btnIncludeEvaluations.Size = new System.Drawing.Size(238, 40);
this.btnIncludeEvaluations.StyleController = this.settingsLayout;
this.btnIncludeEvaluations.TabIndex = 2;
this.btnIncludeEvaluations.Text = "Include Evaluations";
this.btnIncludeEvaluations.CheckedChanged += new System.EventHandler(this.btnAscendingOrder_CheckedChanged);
//
// btnExcludeEvaluations
//
this.btnExcludeEvaluations.GroupIndex = 1;
this.btnExcludeEvaluations.ImageUri.ResourceType = typeof(DevExpress.DevAV.MainForm);
this.btnExcludeEvaluations.ImageUri.Uri = "resource://DevExpress.DevAV.Resources.PrintExcludeEvaluations.svg";
this.btnExcludeEvaluations.Location = new System.Drawing.Point(0, 40);
this.btnExcludeEvaluations.MaximumSize = new System.Drawing.Size(0, 40);
this.btnExcludeEvaluations.MinimumSize = new System.Drawing.Size(0, 40);
this.btnExcludeEvaluations.Name = "btnExcludeEvaluations";
this.btnExcludeEvaluations.ShowFocusRectangle = DevExpress.Utils.DefaultBoolean.False;
this.btnExcludeEvaluations.Size = new System.Drawing.Size(238, 40);
this.btnExcludeEvaluations.StyleController = this.settingsLayout;
this.btnExcludeEvaluations.TabIndex = 2;
this.btnExcludeEvaluations.TabStop = false;
this.btnExcludeEvaluations.Text = "Exclude Evaluations";
this.btnExcludeEvaluations.CheckedChanged += new System.EventHandler(this.btnDescendingOrder_CheckedChanged);
//
// Root
//
this.Root.CustomizationFormText = "Root";
this.Root.EnableIndentsWithoutBorders = DevExpress.Utils.DefaultBoolean.False;
this.Root.GroupBordersVisible = false;
this.Root.Items.AddRange(new DevExpress.XtraLayout.BaseLayoutItem[] {
this.layoutControlItem1,
this.layoutControlItem2});
this.Root.Location = new System.Drawing.Point(0, 0);
this.Root.Name = "Root";
this.Root.Padding = new DevExpress.XtraLayout.Utils.Padding(0, 0, 0, 0);
this.Root.Size = new System.Drawing.Size(238, 232);
//
// layoutControlItem1
//
this.layoutControlItem1.Control = this.btnIncludeEvaluations;
this.layoutControlItem1.CustomizationFormText = "layoutControlItem1";
this.layoutControlItem1.Location = new System.Drawing.Point(0, 0);
this.layoutControlItem1.Name = "layoutControlItem1";
this.layoutControlItem1.Padding = new DevExpress.XtraLayout.Utils.Padding(0, 0, 0, 0);
this.layoutControlItem1.Size = new System.Drawing.Size(238, 40);
this.layoutControlItem1.TextSize = new System.Drawing.Size(0, 0);
this.layoutControlItem1.TextVisible = false;
//
// layoutControlItem2
//
this.layoutControlItem2.Control = this.btnExcludeEvaluations;
this.layoutControlItem2.CustomizationFormText = "layoutControlItem2";
this.layoutControlItem2.Location = new System.Drawing.Point(0, 40);
this.layoutControlItem2.Name = "layoutControlItem2";
this.layoutControlItem2.Padding = new DevExpress.XtraLayout.Utils.Padding(0, 0, 0, 0);
this.layoutControlItem2.Size = new System.Drawing.Size(238, 192);
this.layoutControlItem2.TextSize = new System.Drawing.Size(0, 0);
this.layoutControlItem2.TextVisible = false;
//
// EvaluationsControl
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.Controls.Add(this.settingsLayout);
this.Name = "EvaluationsControl";
this.Size = new System.Drawing.Size(238, 232);
((System.ComponentModel.ISupportInitialize)(this.settingsLayout)).EndInit();
this.settingsLayout.ResumeLayout(false);
((System.ComponentModel.ISupportInitialize)(this.Root)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.layoutControlItem1)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.layoutControlItem2)).EndInit();
this.ResumeLayout(false);
}
#endregion
private XtraLayout.LayoutControl settingsLayout;
private XtraEditors.CheckButton btnIncludeEvaluations;
private XtraEditors.CheckButton btnExcludeEvaluations;
private XtraLayout.LayoutControlGroup Root;
private XtraLayout.LayoutControlItem layoutControlItem1;
private XtraLayout.LayoutControlItem layoutControlItem2;
}
}

View File

@@ -0,0 +1,28 @@
using System;
using System.Windows.Forms;
namespace DevExpress.DevAV {
public partial class EvaluationsControl : UserControl {
Action<bool> callback;
bool defaultValue;
public EvaluationsControl() {
InitializeComponent();
}
public EvaluationsControl(Action<bool> callback, bool defaultValue)
: this() {
this.callback = callback;
this.defaultValue = defaultValue;
}
protected override void OnLoad(EventArgs e) {
base.OnLoad(e);
if(defaultValue) btnIncludeEvaluations.Checked = true;
else btnExcludeEvaluations.Checked = true;
}
void btnAscendingOrder_CheckedChanged(object sender, EventArgs e) {
if(callback != null) callback(true);
}
void btnDescendingOrder_CheckedChanged(object sender, EventArgs e) {
if(callback != null) callback(false);
}
}
}

View File

@@ -0,0 +1,120 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
</root>

View File

@@ -0,0 +1,145 @@
namespace DevExpress.DevAV {
partial class ImagesControl {
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing) {
if(disposing && (components != null)) {
components.Dispose();
}
base.Dispose(disposing);
}
#region Component Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent() {
this.settingsLayout = new DevExpress.XtraLayout.LayoutControl();
this.btnDisplayImages = new DevExpress.XtraEditors.CheckButton();
this.btnHideImages = new DevExpress.XtraEditors.CheckButton();
this.Root = new DevExpress.XtraLayout.LayoutControlGroup();
this.layoutControlItem1 = new DevExpress.XtraLayout.LayoutControlItem();
this.layoutControlItem2 = new DevExpress.XtraLayout.LayoutControlItem();
((System.ComponentModel.ISupportInitialize)(this.settingsLayout)).BeginInit();
this.settingsLayout.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.Root)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.layoutControlItem1)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.layoutControlItem2)).BeginInit();
this.SuspendLayout();
//
// settingsLayout
//
this.settingsLayout.AllowCustomization = false;
this.settingsLayout.Controls.Add(this.btnDisplayImages);
this.settingsLayout.Controls.Add(this.btnHideImages);
this.settingsLayout.Dock = System.Windows.Forms.DockStyle.Fill;
this.settingsLayout.Location = new System.Drawing.Point(0, 0);
this.settingsLayout.Name = "settingsLayout";
this.settingsLayout.Root = this.Root;
this.settingsLayout.Size = new System.Drawing.Size(238, 232);
this.settingsLayout.TabIndex = 3;
//
// btnDisplayImages
//
this.btnDisplayImages.Checked = true;
this.btnDisplayImages.GroupIndex = 1;
this.btnDisplayImages.ImageUri.ResourceType = typeof(DevExpress.DevAV.MainForm);
this.btnDisplayImages.ImageUri.Uri = "resource://DevExpress.DevAV.Resources.ShowProduct.svg";
this.btnDisplayImages.Location = new System.Drawing.Point(0, 0);
this.btnDisplayImages.MaximumSize = new System.Drawing.Size(0, 40);
this.btnDisplayImages.MinimumSize = new System.Drawing.Size(0, 40);
this.btnDisplayImages.Name = "btnDisplayImages";
this.btnDisplayImages.ShowFocusRectangle = DevExpress.Utils.DefaultBoolean.False;
this.btnDisplayImages.Size = new System.Drawing.Size(238, 40);
this.btnDisplayImages.StyleController = this.settingsLayout;
this.btnDisplayImages.TabIndex = 2;
this.btnDisplayImages.Text = "Display Product Images";
this.btnDisplayImages.CheckedChanged += new System.EventHandler(this.btnDisplayImages_CheckedChanged);
//
// btnHideImages
//
this.btnHideImages.GroupIndex = 1;
this.btnHideImages.ImageUri.ResourceType = typeof(DevExpress.DevAV.MainForm);
this.btnHideImages.ImageUri.Uri = "resource://DevExpress.DevAV.Resources.HideProduct.svg";
this.btnHideImages.Location = new System.Drawing.Point(0, 40);
this.btnHideImages.MaximumSize = new System.Drawing.Size(0, 40);
this.btnHideImages.MinimumSize = new System.Drawing.Size(0, 40);
this.btnHideImages.Name = "btnHideImages";
this.btnHideImages.ShowFocusRectangle = DevExpress.Utils.DefaultBoolean.False;
this.btnHideImages.Size = new System.Drawing.Size(238, 40);
this.btnHideImages.StyleController = this.settingsLayout;
this.btnHideImages.TabIndex = 2;
this.btnHideImages.TabStop = false;
this.btnHideImages.Text = "Hide Product Images";
this.btnHideImages.CheckedChanged += new System.EventHandler(this.btnHideImages_CheckedChanged);
//
// Root
//
this.Root.CustomizationFormText = "Root";
this.Root.EnableIndentsWithoutBorders = DevExpress.Utils.DefaultBoolean.False;
this.Root.GroupBordersVisible = false;
this.Root.Items.AddRange(new DevExpress.XtraLayout.BaseLayoutItem[] {
this.layoutControlItem1,
this.layoutControlItem2});
this.Root.Location = new System.Drawing.Point(0, 0);
this.Root.Name = "Root";
this.Root.Padding = new DevExpress.XtraLayout.Utils.Padding(0, 0, 0, 0);
this.Root.Size = new System.Drawing.Size(238, 232);
//
// layoutControlItem1
//
this.layoutControlItem1.Control = this.btnDisplayImages;
this.layoutControlItem1.CustomizationFormText = "layoutControlItem1";
this.layoutControlItem1.Location = new System.Drawing.Point(0, 0);
this.layoutControlItem1.Name = "layoutControlItem1";
this.layoutControlItem1.Padding = new DevExpress.XtraLayout.Utils.Padding(0, 0, 0, 0);
this.layoutControlItem1.Size = new System.Drawing.Size(238, 40);
this.layoutControlItem1.TextSize = new System.Drawing.Size(0, 0);
this.layoutControlItem1.TextVisible = false;
//
// layoutControlItem2
//
this.layoutControlItem2.Control = this.btnHideImages;
this.layoutControlItem2.CustomizationFormText = "layoutControlItem2";
this.layoutControlItem2.Location = new System.Drawing.Point(0, 40);
this.layoutControlItem2.Name = "layoutControlItem2";
this.layoutControlItem2.Padding = new DevExpress.XtraLayout.Utils.Padding(0, 0, 0, 0);
this.layoutControlItem2.Size = new System.Drawing.Size(238, 192);
this.layoutControlItem2.TextSize = new System.Drawing.Size(0, 0);
this.layoutControlItem2.TextVisible = false;
//
// ImagesControl
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.Controls.Add(this.settingsLayout);
this.Name = "ImagesControl";
this.Size = new System.Drawing.Size(238, 232);
((System.ComponentModel.ISupportInitialize)(this.settingsLayout)).EndInit();
this.settingsLayout.ResumeLayout(false);
((System.ComponentModel.ISupportInitialize)(this.Root)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.layoutControlItem1)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.layoutControlItem2)).EndInit();
this.ResumeLayout(false);
}
#endregion
private XtraLayout.LayoutControl settingsLayout;
private XtraEditors.CheckButton btnDisplayImages;
private XtraEditors.CheckButton btnHideImages;
private XtraLayout.LayoutControlGroup Root;
private XtraLayout.LayoutControlItem layoutControlItem1;
private XtraLayout.LayoutControlItem layoutControlItem2;
}
}

View File

@@ -0,0 +1,28 @@
using System;
using System.Windows.Forms;
namespace DevExpress.DevAV {
public partial class ImagesControl : UserControl {
Action<bool> callback;
bool defaultValue;
public ImagesControl() {
InitializeComponent();
}
public ImagesControl(Action<bool> callback, bool defaultValue)
: this() {
this.callback = callback;
this.defaultValue = defaultValue;
}
protected override void OnLoad(EventArgs e) {
base.OnLoad(e);
if(defaultValue) btnDisplayImages.Checked = true;
else btnHideImages.Checked = true;
}
void btnDisplayImages_CheckedChanged(object sender, EventArgs e) {
if(callback != null) callback(true);
}
void btnHideImages_CheckedChanged(object sender, EventArgs e) {
if(callback != null) callback(false);
}
}
}

View File

@@ -0,0 +1,120 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
</root>

View File

@@ -0,0 +1,61 @@
namespace DevExpress.DevAV {
partial class InvoiceSettingsControl {
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing) {
if(disposing && (components != null)) {
components.Dispose();
}
base.Dispose(disposing);
}
#region Component Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent() {
this.checkedListBoxControl1 = new DevExpress.XtraEditors.CheckedListBoxControl();
((System.ComponentModel.ISupportInitialize)(this.checkedListBoxControl1)).BeginInit();
this.SuspendLayout();
//
// checkedListBoxControl1
//
this.checkedListBoxControl1.Cursor = System.Windows.Forms.Cursors.Default;
this.checkedListBoxControl1.Dock = System.Windows.Forms.DockStyle.Fill;
this.checkedListBoxControl1.Items.AddRange(new DevExpress.XtraEditors.Controls.CheckedListBoxItem[] {
new DevExpress.XtraEditors.Controls.CheckedListBoxItem("Show Header"),
new DevExpress.XtraEditors.Controls.CheckedListBoxItem("Show Footer"),
new DevExpress.XtraEditors.Controls.CheckedListBoxItem("Show Status"),
new DevExpress.XtraEditors.Controls.CheckedListBoxItem("Show Comments")});
this.checkedListBoxControl1.Location = new System.Drawing.Point(0, 0);
this.checkedListBoxControl1.Name = "checkedListBoxControl1";
this.checkedListBoxControl1.Size = new System.Drawing.Size(204, 167);
this.checkedListBoxControl1.TabIndex = 0;
this.checkedListBoxControl1.ItemCheck += new DevExpress.XtraEditors.Controls.ItemCheckEventHandler(this.checkedListBoxControl1_ItemCheck);
//
// InvoiceSettingsControl
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.Controls.Add(this.checkedListBoxControl1);
this.Name = "InvoiceSettingsControl";
this.Size = new System.Drawing.Size(204, 167);
((System.ComponentModel.ISupportInitialize)(this.checkedListBoxControl1)).EndInit();
this.ResumeLayout(false);
}
#endregion
private XtraEditors.CheckedListBoxControl checkedListBoxControl1;
}
}

View File

@@ -0,0 +1,27 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Linq;
using System.Text;
using System.Windows.Forms;
namespace DevExpress.DevAV {
public partial class InvoiceSettingsControl : UserControl {
readonly List<Tuple<string, bool, Action<bool>>> settingList;
InvoiceSettingsControl() {
InitializeComponent();
}
public InvoiceSettingsControl(List<Tuple<string, bool, Action<bool>>> settingList):this() {
this.settingList = settingList;
checkedListBoxControl1.Items.Clear();
foreach(Tuple<string, bool, Action<bool>> setting in settingList) {
checkedListBoxControl1.Items.Add(setting.Item1, setting.Item2);
}
}
void checkedListBoxControl1_ItemCheck(object sender, XtraEditors.Controls.ItemCheckEventArgs e) {
settingList[e.Index].Item3.Invoke(e.State == CheckState.Checked);
}
}
}

View File

@@ -0,0 +1,120 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
</root>

View File

@@ -0,0 +1,237 @@
namespace DevExpress.DevAV {
partial class SortFilterControl {
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing) {
if(disposing && (components != null)) {
components.Dispose();
}
base.Dispose(disposing);
}
#region Component Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent() {
this.settingsLayout = new DevExpress.XtraLayout.LayoutControl();
this.dateEdit2 = new DevExpress.XtraEditors.DateEdit();
this.dateEdit1 = new DevExpress.XtraEditors.DateEdit();
this.btnOrderDate = new DevExpress.XtraEditors.CheckButton();
this.btnInvoice = new DevExpress.XtraEditors.CheckButton();
this.Root = new DevExpress.XtraLayout.LayoutControlGroup();
this.layoutControlItem1 = new DevExpress.XtraLayout.LayoutControlItem();
this.layoutControlItem2 = new DevExpress.XtraLayout.LayoutControlItem();
this.simpleLabelItem1 = new DevExpress.XtraLayout.SimpleLabelItem();
this.layoutControlItem3 = new DevExpress.XtraLayout.LayoutControlItem();
this.layoutControlItem4 = new DevExpress.XtraLayout.LayoutControlItem();
((System.ComponentModel.ISupportInitialize)(this.settingsLayout)).BeginInit();
this.settingsLayout.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.dateEdit2.Properties.CalendarTimeProperties)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.dateEdit2.Properties)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.dateEdit1.Properties.CalendarTimeProperties)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.dateEdit1.Properties)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.Root)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.layoutControlItem1)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.layoutControlItem2)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.simpleLabelItem1)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.layoutControlItem3)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.layoutControlItem4)).BeginInit();
this.SuspendLayout();
//
// settingsLayout
//
this.settingsLayout.AllowCustomization = false;
this.settingsLayout.Controls.Add(this.dateEdit2);
this.settingsLayout.Controls.Add(this.dateEdit1);
this.settingsLayout.Controls.Add(this.btnOrderDate);
this.settingsLayout.Controls.Add(this.btnInvoice);
this.settingsLayout.Dock = System.Windows.Forms.DockStyle.Fill;
this.settingsLayout.Location = new System.Drawing.Point(0, 0);
this.settingsLayout.Name = "settingsLayout";
this.settingsLayout.Root = this.Root;
this.settingsLayout.Size = new System.Drawing.Size(238, 232);
this.settingsLayout.TabIndex = 3;
//
// dateEdit2
//
this.dateEdit2.EditValue = new System.DateTime(2014, 1, 1, 0, 0, 0, 0);
this.dateEdit2.Location = new System.Drawing.Point(0, 160);
this.dateEdit2.Name = "dateEdit2";
this.dateEdit2.Properties.Buttons.AddRange(new DevExpress.XtraEditors.Controls.EditorButton[] {
new DevExpress.XtraEditors.Controls.EditorButton(DevExpress.XtraEditors.Controls.ButtonPredefines.Combo)});
this.dateEdit2.Properties.CalendarTimeProperties.Buttons.AddRange(new DevExpress.XtraEditors.Controls.EditorButton[] {
new DevExpress.XtraEditors.Controls.EditorButton(DevExpress.XtraEditors.Controls.ButtonPredefines.Combo)});
this.dateEdit2.Size = new System.Drawing.Size(238, 20);
this.dateEdit2.StyleController = this.settingsLayout;
this.dateEdit2.TabIndex = 5;
this.dateEdit2.DateTimeChanged += new System.EventHandler(this.dateEdit2_DateTimeChanged);
//
// dateEdit1
//
this.dateEdit1.EditValue = new System.DateTime(2012, 1, 1, 0, 0, 0, 0);
this.dateEdit1.Location = new System.Drawing.Point(0, 132);
this.dateEdit1.Name = "dateEdit1";
this.dateEdit1.Properties.Buttons.AddRange(new DevExpress.XtraEditors.Controls.EditorButton[] {
new DevExpress.XtraEditors.Controls.EditorButton(DevExpress.XtraEditors.Controls.ButtonPredefines.Combo)});
this.dateEdit1.Properties.CalendarTimeProperties.Buttons.AddRange(new DevExpress.XtraEditors.Controls.EditorButton[] {
new DevExpress.XtraEditors.Controls.EditorButton(DevExpress.XtraEditors.Controls.ButtonPredefines.Combo)});
this.dateEdit1.Size = new System.Drawing.Size(238, 20);
this.dateEdit1.StyleController = this.settingsLayout;
this.dateEdit1.TabIndex = 4;
this.dateEdit1.DateTimeChanged += new System.EventHandler(this.dateEdit1_DateTimeChanged);
//
// btnOrderDate
//
this.btnOrderDate.Checked = true;
this.btnOrderDate.GroupIndex = 1;
this.btnOrderDate.ImageUri.ResourceType = typeof(DevExpress.DevAV.MainForm);
this.btnOrderDate.ImageUri.Uri = "resource://DevExpress.DevAV.Resources.SortByOrderDate.svg";
this.btnOrderDate.Location = new System.Drawing.Point(0, 0);
this.btnOrderDate.MaximumSize = new System.Drawing.Size(0, 40);
this.btnOrderDate.MinimumSize = new System.Drawing.Size(0, 40);
this.btnOrderDate.Name = "btnOrderDate";
this.btnOrderDate.ShowFocusRectangle = DevExpress.Utils.DefaultBoolean.False;
this.btnOrderDate.Size = new System.Drawing.Size(238, 40);
this.btnOrderDate.StyleController = this.settingsLayout;
this.btnOrderDate.TabIndex = 2;
this.btnOrderDate.Text = "Sort by Order Date";
this.btnOrderDate.CheckedChanged += new System.EventHandler(this.btnOrderDate_CheckedChanged);
//
// btnInvoice
//
this.btnInvoice.GroupIndex = 1;
this.btnInvoice.ImageUri.ResourceType = typeof(DevExpress.DevAV.MainForm);
this.btnInvoice.ImageUri.Uri = "resource://DevExpress.DevAV.Resources.SortByInvoice.svg";
this.btnInvoice.Location = new System.Drawing.Point(0, 40);
this.btnInvoice.MaximumSize = new System.Drawing.Size(0, 40);
this.btnInvoice.MinimumSize = new System.Drawing.Size(0, 40);
this.btnInvoice.Name = "btnInvoice";
this.btnInvoice.ShowFocusRectangle = DevExpress.Utils.DefaultBoolean.False;
this.btnInvoice.Size = new System.Drawing.Size(238, 40);
this.btnInvoice.StyleController = this.settingsLayout;
this.btnInvoice.TabIndex = 2;
this.btnInvoice.TabStop = false;
this.btnInvoice.Text = "Sort by Invoice #";
this.btnInvoice.CheckedChanged += new System.EventHandler(this.btnInvoice_CheckedChanged);
//
// Root
//
this.Root.CustomizationFormText = "Root";
this.Root.EnableIndentsWithoutBorders = DevExpress.Utils.DefaultBoolean.False;
this.Root.GroupBordersVisible = false;
this.Root.Items.AddRange(new DevExpress.XtraLayout.BaseLayoutItem[] {
this.layoutControlItem1,
this.layoutControlItem2,
this.simpleLabelItem1,
this.layoutControlItem3,
this.layoutControlItem4});
this.Root.Location = new System.Drawing.Point(0, 0);
this.Root.Name = "Root";
this.Root.Padding = new DevExpress.XtraLayout.Utils.Padding(0, 0, 0, 0);
this.Root.Size = new System.Drawing.Size(238, 232);
//
// layoutControlItem1
//
this.layoutControlItem1.Control = this.btnOrderDate;
this.layoutControlItem1.CustomizationFormText = "layoutControlItem1";
this.layoutControlItem1.Location = new System.Drawing.Point(0, 0);
this.layoutControlItem1.Name = "layoutControlItem1";
this.layoutControlItem1.Padding = new DevExpress.XtraLayout.Utils.Padding(0, 0, 0, 0);
this.layoutControlItem1.Size = new System.Drawing.Size(238, 40);
this.layoutControlItem1.TextSize = new System.Drawing.Size(0, 0);
this.layoutControlItem1.TextVisible = false;
//
// layoutControlItem2
//
this.layoutControlItem2.Control = this.btnInvoice;
this.layoutControlItem2.CustomizationFormText = "layoutControlItem2";
this.layoutControlItem2.Location = new System.Drawing.Point(0, 40);
this.layoutControlItem2.Name = "layoutControlItem2";
this.layoutControlItem2.Padding = new DevExpress.XtraLayout.Utils.Padding(0, 0, 0, 0);
this.layoutControlItem2.Size = new System.Drawing.Size(238, 40);
this.layoutControlItem2.TextSize = new System.Drawing.Size(0, 0);
this.layoutControlItem2.TextVisible = false;
//
// simpleLabelItem1
//
this.simpleLabelItem1.AllowHotTrack = false;
this.simpleLabelItem1.AppearanceItemCaption.Font = new System.Drawing.Font("Segoe UI", 18F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.simpleLabelItem1.AppearanceItemCaption.Options.UseFont = true;
this.simpleLabelItem1.CustomizationFormText = "Range";
this.simpleLabelItem1.Location = new System.Drawing.Point(0, 80);
this.simpleLabelItem1.Name = "simpleLabelItem1";
this.simpleLabelItem1.Padding = new DevExpress.XtraLayout.Utils.Padding(0, 0, 16, 0);
this.simpleLabelItem1.Size = new System.Drawing.Size(238, 48);
this.simpleLabelItem1.Text = "Range";
this.simpleLabelItem1.TextSize = new System.Drawing.Size(67, 32);
//
// layoutControlItem3
//
this.layoutControlItem3.Control = this.dateEdit1;
this.layoutControlItem3.CustomizationFormText = "layoutControlItem3";
this.layoutControlItem3.Location = new System.Drawing.Point(0, 128);
this.layoutControlItem3.Name = "layoutControlItem3";
this.layoutControlItem3.Padding = new DevExpress.XtraLayout.Utils.Padding(0, 0, 4, 4);
this.layoutControlItem3.Size = new System.Drawing.Size(238, 28);
this.layoutControlItem3.TextSize = new System.Drawing.Size(0, 0);
this.layoutControlItem3.TextVisible = false;
//
// layoutControlItem4
//
this.layoutControlItem4.Control = this.dateEdit2;
this.layoutControlItem4.CustomizationFormText = "layoutControlItem4";
this.layoutControlItem4.Location = new System.Drawing.Point(0, 156);
this.layoutControlItem4.Name = "layoutControlItem4";
this.layoutControlItem4.Padding = new DevExpress.XtraLayout.Utils.Padding(0, 0, 4, 0);
this.layoutControlItem4.Size = new System.Drawing.Size(238, 76);
this.layoutControlItem4.TextSize = new System.Drawing.Size(0, 0);
this.layoutControlItem4.TextVisible = false;
//
// SortFilterControl
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.Controls.Add(this.settingsLayout);
this.Name = "SortFilterControl";
this.Size = new System.Drawing.Size(238, 232);
((System.ComponentModel.ISupportInitialize)(this.settingsLayout)).EndInit();
this.settingsLayout.ResumeLayout(false);
((System.ComponentModel.ISupportInitialize)(this.dateEdit2.Properties.CalendarTimeProperties)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.dateEdit2.Properties)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.dateEdit1.Properties.CalendarTimeProperties)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.dateEdit1.Properties)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.Root)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.layoutControlItem1)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.layoutControlItem2)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.simpleLabelItem1)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.layoutControlItem3)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.layoutControlItem4)).EndInit();
this.ResumeLayout(false);
}
#endregion
private XtraLayout.LayoutControl settingsLayout;
private XtraEditors.CheckButton btnOrderDate;
private XtraEditors.CheckButton btnInvoice;
private XtraLayout.LayoutControlGroup Root;
private XtraLayout.LayoutControlItem layoutControlItem1;
private XtraLayout.LayoutControlItem layoutControlItem2;
private XtraLayout.SimpleLabelItem simpleLabelItem1;
private XtraEditors.DateEdit dateEdit2;
private XtraEditors.DateEdit dateEdit1;
private XtraLayout.LayoutControlItem layoutControlItem3;
private XtraLayout.LayoutControlItem layoutControlItem4;
}
}

View File

@@ -0,0 +1,45 @@
using System;
using System.Windows.Forms;
using DevExpress.XtraEditors;
namespace DevExpress.DevAV {
public partial class SortFilterControl : UserControl {
Action<bool> callback;
Action<DateTime> toDate, fromDate;
DateTime defaultFromDate, defaultToDate;
bool defaultValue;
public SortFilterControl() {
InitializeComponent();
}
public SortFilterControl(Action<bool> callback, bool defaultValue, Action<DateTime> fromDate, DateTime defaultFromDate, Action<DateTime> toDate, DateTime defaultToDate)
: this() {
this.callback = callback;
this.toDate = toDate;
this.fromDate = fromDate;
this.defaultValue = defaultValue;
this.defaultFromDate = defaultFromDate;
this.defaultToDate = defaultToDate;
}
protected override void OnLoad(EventArgs e) {
base.OnLoad(e);
if(defaultValue) btnOrderDate.Checked = true;
else btnInvoice.Checked = true;
dateEdit1.DateTime = defaultFromDate;
dateEdit2.DateTime = defaultToDate;
}
void btnOrderDate_CheckedChanged(object sender, EventArgs e) {
if(callback != null) callback(true);
}
void btnInvoice_CheckedChanged(object sender, EventArgs e) {
if(callback != null) callback(false);
}
void dateEdit1_DateTimeChanged(object sender, EventArgs e) {
if(fromDate != null) fromDate((sender as DateEdit).DateTime);
}
void dateEdit2_DateTimeChanged(object sender, EventArgs e) {
if(toDate != null) toDate((sender as DateEdit).DateTime);
}
}
}

View File

@@ -0,0 +1,120 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
</root>

View File

@@ -0,0 +1,145 @@
namespace DevExpress.DevAV {
partial class SortOrderControl {
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing) {
if(disposing && (components != null)) {
components.Dispose();
}
base.Dispose(disposing);
}
#region Component Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent() {
this.settingsLayout = new DevExpress.XtraLayout.LayoutControl();
this.btnAscendingOrder = new DevExpress.XtraEditors.CheckButton();
this.btnDescendingOrder = new DevExpress.XtraEditors.CheckButton();
this.Root = new DevExpress.XtraLayout.LayoutControlGroup();
this.layoutControlItem1 = new DevExpress.XtraLayout.LayoutControlItem();
this.layoutControlItem2 = new DevExpress.XtraLayout.LayoutControlItem();
((System.ComponentModel.ISupportInitialize)(this.settingsLayout)).BeginInit();
this.settingsLayout.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.Root)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.layoutControlItem1)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.layoutControlItem2)).BeginInit();
this.SuspendLayout();
//
// settingsLayout
//
this.settingsLayout.AllowCustomization = false;
this.settingsLayout.Controls.Add(this.btnAscendingOrder);
this.settingsLayout.Controls.Add(this.btnDescendingOrder);
this.settingsLayout.Dock = System.Windows.Forms.DockStyle.Fill;
this.settingsLayout.Location = new System.Drawing.Point(0, 0);
this.settingsLayout.Name = "settingsLayout";
this.settingsLayout.Root = this.Root;
this.settingsLayout.Size = new System.Drawing.Size(238, 232);
this.settingsLayout.TabIndex = 3;
//
// btnAscendingOrder
//
this.btnAscendingOrder.Checked = true;
this.btnAscendingOrder.GroupIndex = 1;
this.btnAscendingOrder.ImageUri.ResourceType = typeof(DevExpress.DevAV.MainForm);
this.btnAscendingOrder.ImageUri.Uri = "resource://DevExpress.DevAV.Resources.SortDesc.svg";
this.btnAscendingOrder.Location = new System.Drawing.Point(0, 0);
this.btnAscendingOrder.MaximumSize = new System.Drawing.Size(0, 40);
this.btnAscendingOrder.MinimumSize = new System.Drawing.Size(0, 40);
this.btnAscendingOrder.Name = "btnAscendingOrder";
this.btnAscendingOrder.ShowFocusRectangle = DevExpress.Utils.DefaultBoolean.False;
this.btnAscendingOrder.Size = new System.Drawing.Size(238, 40);
this.btnAscendingOrder.StyleController = this.settingsLayout;
this.btnAscendingOrder.TabIndex = 2;
this.btnAscendingOrder.Text = "Ascending Order";
this.btnAscendingOrder.CheckedChanged += new System.EventHandler(this.btnAscendingOrder_CheckedChanged);
//
// btnDescendingOrder
//
this.btnDescendingOrder.GroupIndex = 1;
this.btnDescendingOrder.ImageUri.ResourceType = typeof(DevExpress.DevAV.MainForm);
this.btnDescendingOrder.ImageUri.Uri = "resource://DevExpress.DevAV.Resources.SortAsc.svg";
this.btnDescendingOrder.Location = new System.Drawing.Point(0, 40);
this.btnDescendingOrder.MaximumSize = new System.Drawing.Size(0, 40);
this.btnDescendingOrder.MinimumSize = new System.Drawing.Size(0, 40);
this.btnDescendingOrder.Name = "btnDescendingOrder";
this.btnDescendingOrder.ShowFocusRectangle = DevExpress.Utils.DefaultBoolean.False;
this.btnDescendingOrder.Size = new System.Drawing.Size(238, 40);
this.btnDescendingOrder.StyleController = this.settingsLayout;
this.btnDescendingOrder.TabIndex = 2;
this.btnDescendingOrder.TabStop = false;
this.btnDescendingOrder.Text = "Descending Order";
this.btnDescendingOrder.CheckedChanged += new System.EventHandler(this.btnDescendingOrder_CheckedChanged);
//
// Root
//
this.Root.CustomizationFormText = "Root";
this.Root.EnableIndentsWithoutBorders = DevExpress.Utils.DefaultBoolean.False;
this.Root.GroupBordersVisible = false;
this.Root.Items.AddRange(new DevExpress.XtraLayout.BaseLayoutItem[] {
this.layoutControlItem1,
this.layoutControlItem2});
this.Root.Location = new System.Drawing.Point(0, 0);
this.Root.Name = "Root";
this.Root.Padding = new DevExpress.XtraLayout.Utils.Padding(0, 0, 0, 0);
this.Root.Size = new System.Drawing.Size(238, 232);
//
// layoutControlItem1
//
this.layoutControlItem1.Control = this.btnAscendingOrder;
this.layoutControlItem1.CustomizationFormText = "layoutControlItem1";
this.layoutControlItem1.Location = new System.Drawing.Point(0, 0);
this.layoutControlItem1.Name = "layoutControlItem1";
this.layoutControlItem1.Padding = new DevExpress.XtraLayout.Utils.Padding(0, 0, 0, 0);
this.layoutControlItem1.Size = new System.Drawing.Size(238, 40);
this.layoutControlItem1.TextSize = new System.Drawing.Size(0, 0);
this.layoutControlItem1.TextVisible = false;
//
// layoutControlItem2
//
this.layoutControlItem2.Control = this.btnDescendingOrder;
this.layoutControlItem2.CustomizationFormText = "layoutControlItem2";
this.layoutControlItem2.Location = new System.Drawing.Point(0, 40);
this.layoutControlItem2.Name = "layoutControlItem2";
this.layoutControlItem2.Padding = new DevExpress.XtraLayout.Utils.Padding(0, 0, 0, 0);
this.layoutControlItem2.Size = new System.Drawing.Size(238, 192);
this.layoutControlItem2.TextSize = new System.Drawing.Size(0, 0);
this.layoutControlItem2.TextVisible = false;
//
// SortOrderControl
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.Controls.Add(this.settingsLayout);
this.Name = "SortOrderControl";
this.Size = new System.Drawing.Size(238, 232);
((System.ComponentModel.ISupportInitialize)(this.settingsLayout)).EndInit();
this.settingsLayout.ResumeLayout(false);
((System.ComponentModel.ISupportInitialize)(this.Root)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.layoutControlItem1)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.layoutControlItem2)).EndInit();
this.ResumeLayout(false);
}
#endregion
private XtraLayout.LayoutControl settingsLayout;
private XtraEditors.CheckButton btnAscendingOrder;
private XtraEditors.CheckButton btnDescendingOrder;
private XtraLayout.LayoutControlGroup Root;
private XtraLayout.LayoutControlItem layoutControlItem1;
private XtraLayout.LayoutControlItem layoutControlItem2;
}
}

View File

@@ -0,0 +1,28 @@
using System;
using System.Windows.Forms;
namespace DevExpress.DevAV {
public partial class SortOrderControl : UserControl {
Action<bool> callback;
bool defaultValue;
public SortOrderControl() {
InitializeComponent();
}
public SortOrderControl(Action<bool> callback, bool defaultValue)
: this() {
this.callback = callback;
this.defaultValue = defaultValue;
}
protected override void OnLoad(EventArgs e) {
base.OnLoad(e);
if(defaultValue) btnAscendingOrder.Checked = true;
else btnDescendingOrder.Checked = true;
}
void btnAscendingOrder_CheckedChanged(object sender, EventArgs e) {
if(callback!=null) callback(true);
}
void btnDescendingOrder_CheckedChanged(object sender, EventArgs e) {
if(callback != null) callback(false);
}
}
}

View File

@@ -0,0 +1,120 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
</root>

View File

@@ -0,0 +1,145 @@
namespace DevExpress.DevAV {
partial class TasksSortControl {
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing) {
if(disposing && (components != null)) {
components.Dispose();
}
base.Dispose(disposing);
}
#region Component Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent() {
this.settingsLayout = new DevExpress.XtraLayout.LayoutControl();
this.btnDueDate = new DevExpress.XtraEditors.CheckButton();
this.btnStartDate = new DevExpress.XtraEditors.CheckButton();
this.Root = new DevExpress.XtraLayout.LayoutControlGroup();
this.layoutControlItem1 = new DevExpress.XtraLayout.LayoutControlItem();
this.layoutControlItem2 = new DevExpress.XtraLayout.LayoutControlItem();
((System.ComponentModel.ISupportInitialize)(this.settingsLayout)).BeginInit();
this.settingsLayout.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.Root)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.layoutControlItem1)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.layoutControlItem2)).BeginInit();
this.SuspendLayout();
//
// settingsLayout
//
this.settingsLayout.AllowCustomization = false;
this.settingsLayout.Controls.Add(this.btnDueDate);
this.settingsLayout.Controls.Add(this.btnStartDate);
this.settingsLayout.Dock = System.Windows.Forms.DockStyle.Fill;
this.settingsLayout.Location = new System.Drawing.Point(0, 0);
this.settingsLayout.Name = "settingsLayout";
this.settingsLayout.Root = this.Root;
this.settingsLayout.Size = new System.Drawing.Size(238, 232);
this.settingsLayout.TabIndex = 3;
//
// btnDueDate
//
this.btnDueDate.Checked = true;
this.btnDueDate.GroupIndex = 1;
this.btnDueDate.ImageUri.ResourceType = typeof(DevExpress.DevAV.MainForm);
this.btnDueDate.ImageUri.Uri = "resource://DevExpress.DevAV.Resources.ShowDueDate.svg";
this.btnDueDate.Location = new System.Drawing.Point(0, 0);
this.btnDueDate.MaximumSize = new System.Drawing.Size(0, 40);
this.btnDueDate.MinimumSize = new System.Drawing.Size(0, 40);
this.btnDueDate.Name = "btnDueDate";
this.btnDueDate.ShowFocusRectangle = DevExpress.Utils.DefaultBoolean.False;
this.btnDueDate.Size = new System.Drawing.Size(238, 40);
this.btnDueDate.StyleController = this.settingsLayout;
this.btnDueDate.TabIndex = 2;
this.btnDueDate.Text = "Sort by Due Date";
this.btnDueDate.CheckedChanged += new System.EventHandler(this.btnDueDate_CheckedChanged);
//
// btnStartDate
//
this.btnStartDate.GroupIndex = 1;
this.btnStartDate.ImageUri.ResourceType = typeof(DevExpress.DevAV.MainForm);
this.btnStartDate.ImageUri.Uri = "resource://DevExpress.DevAV.Resources.ShowStartDate.svg";
this.btnStartDate.Location = new System.Drawing.Point(0, 40);
this.btnStartDate.MaximumSize = new System.Drawing.Size(0, 40);
this.btnStartDate.MinimumSize = new System.Drawing.Size(0, 40);
this.btnStartDate.Name = "btnStartDate";
this.btnStartDate.ShowFocusRectangle = DevExpress.Utils.DefaultBoolean.False;
this.btnStartDate.Size = new System.Drawing.Size(238, 40);
this.btnStartDate.StyleController = this.settingsLayout;
this.btnStartDate.TabIndex = 2;
this.btnStartDate.TabStop = false;
this.btnStartDate.Text = "Sort by Start Date";
this.btnStartDate.CheckedChanged += new System.EventHandler(this.btnStartDate_CheckedChanged);
//
// Root
//
this.Root.CustomizationFormText = "Root";
this.Root.EnableIndentsWithoutBorders = DevExpress.Utils.DefaultBoolean.False;
this.Root.GroupBordersVisible = false;
this.Root.Items.AddRange(new DevExpress.XtraLayout.BaseLayoutItem[] {
this.layoutControlItem1,
this.layoutControlItem2});
this.Root.Location = new System.Drawing.Point(0, 0);
this.Root.Name = "Root";
this.Root.Padding = new DevExpress.XtraLayout.Utils.Padding(0, 0, 0, 0);
this.Root.Size = new System.Drawing.Size(238, 232);
//
// layoutControlItem1
//
this.layoutControlItem1.Control = this.btnDueDate;
this.layoutControlItem1.CustomizationFormText = "layoutControlItem1";
this.layoutControlItem1.Location = new System.Drawing.Point(0, 0);
this.layoutControlItem1.Name = "layoutControlItem1";
this.layoutControlItem1.Padding = new DevExpress.XtraLayout.Utils.Padding(0, 0, 0, 0);
this.layoutControlItem1.Size = new System.Drawing.Size(238, 40);
this.layoutControlItem1.TextSize = new System.Drawing.Size(0, 0);
this.layoutControlItem1.TextVisible = false;
//
// layoutControlItem2
//
this.layoutControlItem2.Control = this.btnStartDate;
this.layoutControlItem2.CustomizationFormText = "layoutControlItem2";
this.layoutControlItem2.Location = new System.Drawing.Point(0, 40);
this.layoutControlItem2.Name = "layoutControlItem2";
this.layoutControlItem2.Padding = new DevExpress.XtraLayout.Utils.Padding(0, 0, 0, 0);
this.layoutControlItem2.Size = new System.Drawing.Size(238, 192);
this.layoutControlItem2.TextSize = new System.Drawing.Size(0, 0);
this.layoutControlItem2.TextVisible = false;
//
// TasksSortControl
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.Controls.Add(this.settingsLayout);
this.Name = "TasksSortControl";
this.Size = new System.Drawing.Size(238, 232);
((System.ComponentModel.ISupportInitialize)(this.settingsLayout)).EndInit();
this.settingsLayout.ResumeLayout(false);
((System.ComponentModel.ISupportInitialize)(this.Root)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.layoutControlItem1)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.layoutControlItem2)).EndInit();
this.ResumeLayout(false);
}
#endregion
private XtraLayout.LayoutControl settingsLayout;
private XtraEditors.CheckButton btnDueDate;
private XtraEditors.CheckButton btnStartDate;
private XtraLayout.LayoutControlGroup Root;
private XtraLayout.LayoutControlItem layoutControlItem1;
private XtraLayout.LayoutControlItem layoutControlItem2;
}
}

View File

@@ -0,0 +1,28 @@
using System;
using System.Windows.Forms;
namespace DevExpress.DevAV {
public partial class TasksSortControl : UserControl {
Action<bool> callback;
bool defaultValue;
public TasksSortControl() {
InitializeComponent();
}
public TasksSortControl(Action<bool> callback, bool defaultValue)
: this() {
this.callback = callback;
this.defaultValue = defaultValue;
}
protected override void OnLoad(EventArgs e) {
base.OnLoad(e);
if(defaultValue) btnDueDate.Checked = true;
else btnStartDate.Checked = true;
}
void btnDueDate_CheckedChanged(object sender, EventArgs e) {
if(callback != null) callback(true);
}
void btnStartDate_CheckedChanged(object sender, EventArgs e) {
if(callback != null) callback(false);
}
}
}

View File

@@ -0,0 +1,120 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
</root>

View File

@@ -0,0 +1,108 @@
namespace DevExpress.DevAV {
partial class YearsControl {
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing) {
if(disposing && (components != null)) {
components.Dispose();
}
base.Dispose(disposing);
}
#region Component Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent() {
this.settingsLayout = new DevExpress.XtraLayout.LayoutControl();
this.checkedComboBoxEdit1 = new DevExpress.XtraEditors.CheckedComboBoxEdit();
this.Root = new DevExpress.XtraLayout.LayoutControlGroup();
this.layoutControlItem1 = new DevExpress.XtraLayout.LayoutControlItem();
((System.ComponentModel.ISupportInitialize)(this.settingsLayout)).BeginInit();
this.settingsLayout.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.checkedComboBoxEdit1.Properties)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.Root)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.layoutControlItem1)).BeginInit();
this.SuspendLayout();
//
// settingsLayout
//
this.settingsLayout.AllowCustomization = false;
this.settingsLayout.Controls.Add(this.checkedComboBoxEdit1);
this.settingsLayout.Dock = System.Windows.Forms.DockStyle.Fill;
this.settingsLayout.Location = new System.Drawing.Point(0, 0);
this.settingsLayout.Name = "settingsLayout";
this.settingsLayout.Root = this.Root;
this.settingsLayout.Size = new System.Drawing.Size(238, 232);
this.settingsLayout.TabIndex = 3;
//
// checkedComboBoxEdit1
//
this.checkedComboBoxEdit1.EditValue = "";
this.checkedComboBoxEdit1.Location = new System.Drawing.Point(0, 0);
this.checkedComboBoxEdit1.Name = "checkedComboBoxEdit1";
this.checkedComboBoxEdit1.Properties.Buttons.AddRange(new DevExpress.XtraEditors.Controls.EditorButton[] {
new DevExpress.XtraEditors.Controls.EditorButton(DevExpress.XtraEditors.Controls.ButtonPredefines.Combo)});
this.checkedComboBoxEdit1.Size = new System.Drawing.Size(238, 20);
this.checkedComboBoxEdit1.StyleController = this.settingsLayout;
this.checkedComboBoxEdit1.TabIndex = 4;
//
// Root
//
this.Root.CustomizationFormText = "Root";
this.Root.EnableIndentsWithoutBorders = DevExpress.Utils.DefaultBoolean.False;
this.Root.GroupBordersVisible = false;
this.Root.Items.AddRange(new DevExpress.XtraLayout.BaseLayoutItem[] {
this.layoutControlItem1});
this.Root.Location = new System.Drawing.Point(0, 0);
this.Root.Name = "Root";
this.Root.Padding = new DevExpress.XtraLayout.Utils.Padding(0, 0, 0, 0);
this.Root.Size = new System.Drawing.Size(238, 232);
this.Root.Text = "Root";
//
// layoutControlItem1
//
this.layoutControlItem1.Control = this.checkedComboBoxEdit1;
this.layoutControlItem1.CustomizationFormText = "layoutControlItem1";
this.layoutControlItem1.Location = new System.Drawing.Point(0, 0);
this.layoutControlItem1.Name = "layoutControlItem1";
this.layoutControlItem1.Padding = new DevExpress.XtraLayout.Utils.Padding(0, 0, 0, 0);
this.layoutControlItem1.Size = new System.Drawing.Size(238, 232);
this.layoutControlItem1.Text = "layoutControlItem1";
this.layoutControlItem1.TextSize = new System.Drawing.Size(0, 0);
this.layoutControlItem1.TextToControlDistance = 0;
this.layoutControlItem1.TextVisible = false;
//
// YearsControl
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.Controls.Add(this.settingsLayout);
this.Name = "YearsControl";
this.Size = new System.Drawing.Size(238, 232);
((System.ComponentModel.ISupportInitialize)(this.settingsLayout)).EndInit();
this.settingsLayout.ResumeLayout(false);
((System.ComponentModel.ISupportInitialize)(this.checkedComboBoxEdit1.Properties)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.Root)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.layoutControlItem1)).EndInit();
this.ResumeLayout(false);
}
#endregion
private XtraLayout.LayoutControl settingsLayout;
private XtraLayout.LayoutControlGroup Root;
private XtraEditors.CheckedComboBoxEdit checkedComboBoxEdit1;
private XtraLayout.LayoutControlItem layoutControlItem1;
}
}

View File

@@ -0,0 +1,35 @@
using System;
using System.Windows.Forms;
namespace DevExpress.DevAV {
public partial class YearsControl : UserControl {
Action<string> callback;
string defaultValue;
public YearsControl() {
InitializeComponent();
AddYearItems();
}
public YearsControl(Action<string> callback, string defaultValue)
: this() {
this.defaultValue = defaultValue;
this.callback = callback;
}
void AddYearItems() {
var yearItems = new DevExpress.XtraEditors.Controls.CheckedListBoxItem[5];
int startYear = (DateTime.Now.Year - yearItems.Length) + 1;
for(int i = 0; i < yearItems.Length; i++) {
string year = (startYear + i).ToString();
yearItems[i] = new DevExpress.XtraEditors.Controls.CheckedListBoxItem(year, year);
}
this.checkedComboBoxEdit1.Properties.Items.AddRange(yearItems);
this.checkedComboBoxEdit1.EditValueChanged += checkedComboBoxEdit1_EditValueChanged;
}
protected override void OnLoad(EventArgs e) {
base.OnLoad(e);
checkedComboBoxEdit1.EditValue = defaultValue;
}
void checkedComboBoxEdit1_EditValueChanged(object sender, EventArgs e) {
if(callback != null) callback((string)checkedComboBoxEdit1.EditValue);
}
}
}

View File

@@ -0,0 +1,120 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
</root>

View File

@@ -0,0 +1,242 @@
namespace DevExpress.DevAV.Modules {
partial class ViewSettingsControl {
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing) {
if(disposing && (components != null)) {
components.Dispose();
}
base.Dispose(disposing);
}
#region Component Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent() {
this.okBtn = new DevExpress.XtraEditors.SimpleButton();
this.moduleLayout = new DevExpress.XtraLayout.LayoutControl();
this.resetViewBtn = new DevExpress.XtraEditors.SimpleButton();
this.resetFiltersBtn = new DevExpress.XtraEditors.SimpleButton();
this.cancelBtn = new DevExpress.XtraEditors.SimpleButton();
this.layoutControlGroup = new DevExpress.XtraLayout.LayoutControlGroup();
this.itemForOkBtn = new DevExpress.XtraLayout.LayoutControlItem();
this.itemForCancelBtn = new DevExpress.XtraLayout.LayoutControlItem();
this.emptySpaceItem = new DevExpress.XtraLayout.EmptySpaceItem();
this.layoutControlItem1 = new DevExpress.XtraLayout.LayoutControlItem();
this.layoutControlItem2 = new DevExpress.XtraLayout.LayoutControlItem();
this.separator = new DevExpress.XtraLayout.SimpleSeparator();
this.emptySpaceItem1 = new DevExpress.XtraLayout.EmptySpaceItem();
((System.ComponentModel.ISupportInitialize)(this.moduleLayout)).BeginInit();
this.moduleLayout.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.layoutControlGroup)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.itemForOkBtn)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.itemForCancelBtn)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.emptySpaceItem)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.layoutControlItem1)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.layoutControlItem2)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.separator)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.emptySpaceItem1)).BeginInit();
this.SuspendLayout();
//
// okBtn
//
this.okBtn.Location = new System.Drawing.Point(280, 254);
this.okBtn.Name = "okBtn";
this.okBtn.Size = new System.Drawing.Size(78, 22);
this.okBtn.StyleController = this.moduleLayout;
this.okBtn.TabIndex = 0;
this.okBtn.Text = "OK";
//
// moduleLayout
//
this.moduleLayout.AllowCustomization = false;
this.moduleLayout.Controls.Add(this.resetViewBtn);
this.moduleLayout.Controls.Add(this.resetFiltersBtn);
this.moduleLayout.Controls.Add(this.cancelBtn);
this.moduleLayout.Controls.Add(this.okBtn);
this.moduleLayout.Dock = System.Windows.Forms.DockStyle.Fill;
this.moduleLayout.Location = new System.Drawing.Point(0, 0);
this.moduleLayout.Name = "moduleLayout";
this.moduleLayout.Root = this.layoutControlGroup;
this.moduleLayout.Size = new System.Drawing.Size(452, 288);
this.moduleLayout.TabIndex = 0;
//
// resetViewBtn
//
this.resetViewBtn.Location = new System.Drawing.Point(12, 46);
this.resetViewBtn.Name = "resetViewBtn";
this.resetViewBtn.Size = new System.Drawing.Size(165, 22);
this.resetViewBtn.StyleController = this.moduleLayout;
this.resetViewBtn.TabIndex = 7;
this.resetViewBtn.Text = "Reset View";
//
// resetFiltersBtn
//
this.resetFiltersBtn.Location = new System.Drawing.Point(12, 16);
this.resetFiltersBtn.Name = "resetFiltersBtn";
this.resetFiltersBtn.Size = new System.Drawing.Size(165, 22);
this.resetFiltersBtn.StyleController = this.moduleLayout;
this.resetFiltersBtn.TabIndex = 6;
this.resetFiltersBtn.Text = "Reset Custom Filters";
//
// cancelBtn
//
this.cancelBtn.Location = new System.Drawing.Point(362, 254);
this.cancelBtn.Name = "cancelBtn";
this.cancelBtn.Size = new System.Drawing.Size(78, 22);
this.cancelBtn.StyleController = this.moduleLayout;
this.cancelBtn.TabIndex = 1;
this.cancelBtn.Text = "Cancel";
//
// layoutControlGroup
//
this.layoutControlGroup.CustomizationFormText = "Root";
this.layoutControlGroup.EnableIndentsWithoutBorders = DevExpress.Utils.DefaultBoolean.False;
this.layoutControlGroup.GroupBordersVisible = false;
this.layoutControlGroup.Items.AddRange(new DevExpress.XtraLayout.BaseLayoutItem[] {
this.itemForOkBtn,
this.itemForCancelBtn,
this.emptySpaceItem,
this.layoutControlItem1,
this.layoutControlItem2,
this.separator,
this.emptySpaceItem1});
this.layoutControlGroup.Location = new System.Drawing.Point(0, 0);
this.layoutControlGroup.Name = "Root";
this.layoutControlGroup.OptionsItemText.TextToControlDistance = 6;
this.layoutControlGroup.Size = new System.Drawing.Size(452, 288);
this.layoutControlGroup.Text = "Root";
//
// itemForOkBtn
//
this.itemForOkBtn.Control = this.okBtn;
this.itemForOkBtn.CustomizationFormText = "itemForOkBtn";
this.itemForOkBtn.Location = new System.Drawing.Point(268, 242);
this.itemForOkBtn.MaxSize = new System.Drawing.Size(92, 46);
this.itemForOkBtn.MinSize = new System.Drawing.Size(92, 46);
this.itemForOkBtn.Name = "itemForOkBtn";
this.itemForOkBtn.Padding = new DevExpress.XtraLayout.Utils.Padding(12, 2, 12, 12);
this.itemForOkBtn.Size = new System.Drawing.Size(92, 46);
this.itemForOkBtn.SizeConstraintsType = DevExpress.XtraLayout.SizeConstraintsType.Custom;
this.itemForOkBtn.Text = "itemForOkBtn";
this.itemForOkBtn.TextSize = new System.Drawing.Size(0, 0);
this.itemForOkBtn.TextToControlDistance = 0;
this.itemForOkBtn.TextVisible = false;
//
// itemForCancelBtn
//
this.itemForCancelBtn.Control = this.cancelBtn;
this.itemForCancelBtn.CustomizationFormText = "itemForCancelBtn";
this.itemForCancelBtn.Location = new System.Drawing.Point(360, 242);
this.itemForCancelBtn.MaxSize = new System.Drawing.Size(92, 46);
this.itemForCancelBtn.MinSize = new System.Drawing.Size(92, 46);
this.itemForCancelBtn.Name = "itemForCancelBtn";
this.itemForCancelBtn.Padding = new DevExpress.XtraLayout.Utils.Padding(2, 12, 12, 12);
this.itemForCancelBtn.Size = new System.Drawing.Size(92, 46);
this.itemForCancelBtn.SizeConstraintsType = DevExpress.XtraLayout.SizeConstraintsType.Custom;
this.itemForCancelBtn.Text = "itemForCancelBtn";
this.itemForCancelBtn.TextSize = new System.Drawing.Size(0, 0);
this.itemForCancelBtn.TextToControlDistance = 0;
this.itemForCancelBtn.TextVisible = false;
//
// emptySpaceItem
//
this.emptySpaceItem.AllowHotTrack = false;
this.emptySpaceItem.CustomizationFormText = "emptySpaceItem1";
this.emptySpaceItem.Location = new System.Drawing.Point(0, 242);
this.emptySpaceItem.Name = "emptySpaceItem1";
this.emptySpaceItem.Size = new System.Drawing.Size(268, 46);
this.emptySpaceItem.Text = "emptySpaceItem1";
this.emptySpaceItem.TextSize = new System.Drawing.Size(0, 0);
//
// layoutControlItem1
//
this.layoutControlItem1.Control = this.resetFiltersBtn;
this.layoutControlItem1.CustomizationFormText = "Reset Custom Filters";
this.layoutControlItem1.Location = new System.Drawing.Point(0, 0);
this.layoutControlItem1.Name = "layoutControlItem1";
this.layoutControlItem1.Padding = new DevExpress.XtraLayout.Utils.Padding(12, 12, 16, 4);
this.layoutControlItem1.Size = new System.Drawing.Size(452, 42);
this.layoutControlItem1.Text = "Replace all the filters created by user with predefined";
this.layoutControlItem1.TextLocation = DevExpress.Utils.Locations.Right;
this.layoutControlItem1.TextSize = new System.Drawing.Size(257, 13);
//
// layoutControlItem2
//
this.layoutControlItem2.Control = this.resetViewBtn;
this.layoutControlItem2.CustomizationFormText = "Reset View";
this.layoutControlItem2.Location = new System.Drawing.Point(0, 42);
this.layoutControlItem2.Name = "layoutControlItem2";
this.layoutControlItem2.Padding = new DevExpress.XtraLayout.Utils.Padding(12, 12, 4, 4);
this.layoutControlItem2.Size = new System.Drawing.Size(452, 30);
this.layoutControlItem2.Text = "Change View type to default (List, Card etc.)";
this.layoutControlItem2.TextLocation = DevExpress.Utils.Locations.Right;
this.layoutControlItem2.TextSize = new System.Drawing.Size(257, 13);
//
// separator
//
this.separator.AllowHotTrack = false;
this.separator.CustomizationFormText = "simpleSeparator1";
this.separator.Location = new System.Drawing.Point(0, 240);
this.separator.Name = "simpleSeparator1";
this.separator.Size = new System.Drawing.Size(452, 2);
this.separator.Text = "simpleSeparator1";
//
// emptySpaceItem1
//
this.emptySpaceItem1.AllowHotTrack = false;
this.emptySpaceItem1.CustomizationFormText = "emptySpaceItem1";
this.emptySpaceItem1.Location = new System.Drawing.Point(0, 72);
this.emptySpaceItem1.Name = "emptySpaceItem1";
this.emptySpaceItem1.Size = new System.Drawing.Size(452, 168);
this.emptySpaceItem1.Text = "emptySpaceItem1";
this.emptySpaceItem1.TextSize = new System.Drawing.Size(0, 0);
//
// ViewSettingsControl
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.Controls.Add(this.moduleLayout);
this.Name = "ViewSettingsControl";
this.Size = new System.Drawing.Size(452, 288);
((System.ComponentModel.ISupportInitialize)(this.moduleLayout)).EndInit();
this.moduleLayout.ResumeLayout(false);
((System.ComponentModel.ISupportInitialize)(this.layoutControlGroup)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.itemForOkBtn)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.itemForCancelBtn)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.emptySpaceItem)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.layoutControlItem1)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.layoutControlItem2)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.separator)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.emptySpaceItem1)).EndInit();
this.ResumeLayout(false);
}
#endregion
private DevExpress.XtraEditors.SimpleButton okBtn;
private DevExpress.XtraEditors.SimpleButton cancelBtn;
private DevExpress.XtraLayout.LayoutControl moduleLayout;
private XtraLayout.LayoutControlGroup layoutControlGroup;
private XtraLayout.LayoutControlItem itemForOkBtn;
private XtraLayout.LayoutControlItem itemForCancelBtn;
private XtraLayout.EmptySpaceItem emptySpaceItem;
private XtraLayout.SimpleSeparator separator;
private XtraEditors.SimpleButton resetViewBtn;
private XtraEditors.SimpleButton resetFiltersBtn;
private XtraLayout.LayoutControlItem layoutControlItem1;
private XtraLayout.LayoutControlItem layoutControlItem2;
private XtraLayout.EmptySpaceItem emptySpaceItem1;
}
}

View File

@@ -0,0 +1,59 @@
namespace DevExpress.DevAV.Modules {
using DevExpress.DevAV.ViewModels;
public partial class ViewSettingsControl : BaseModuleControl {
public ViewSettingsControl(CollectionUIViewModel collectionViewModel)
: base(typeof(ViewSettingsViewModel), new object[] { collectionViewModel }) {
InitializeComponent();
BindCommands();
}
public ViewSettingsViewModel ViewModel {
get { return GetViewModel<ViewSettingsViewModel>(); }
}
void BindCommands() {
this.resetFiltersBtn.BindCommand(() => ViewModel.ResetCustomFilters(), ViewModel);
this.resetViewBtn.BindCommand(() => ViewModel.ResetView(), ViewModel);
//
this.okBtn.BindCommand(() => ViewModel.OK(), ViewModel);
this.cancelBtn.BindCommand(() => ViewModel.Cancel(), ViewModel);
}
}
}
namespace DevExpress.DevAV.ViewModels {
using DevExpress.Mvvm;
using DevExpress.Mvvm.DataAnnotations;
using DevExpress.Mvvm.POCO;
public class ViewSettingsViewModel {
CollectionUIViewModel collectionUIViewModelCore;
public static ViewSettingsViewModel Create(CollectionUIViewModel collectionUIViewModel) {
return ViewModelSource.Create(() => new ViewSettingsViewModel(collectionUIViewModel));
}
protected ViewSettingsViewModel(CollectionUIViewModel collectionUIViewModel) {
this.collectionUIViewModelCore = collectionUIViewModel;
}
[Command]
public void ResetCustomFilters() {
var vm = ViewModelHelper.GetParentViewModel<ISupportCustomFilters>(this);
if(vm != null)
vm.ResetCustomFilters();
}
public CollectionUIViewModel CollectionUIViewModel {
get { return collectionUIViewModelCore; }
}
[Command]
public void ResetView() {
CollectionUIViewModel.ResetView();
}
public IDocument Document { get; set; }
[Command]
public void OK() {
Document.Close();
}
[Command]
public void Cancel() {
Document.Close();
}
}
}

View File

@@ -0,0 +1,120 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
</root>

View File

@@ -0,0 +1,102 @@
using DevExpress.DevAV;
using DevExpress.Mvvm.DataModel;
using DevExpress.Mvvm.DataModel.EFCore;
using System;
using System.Collections.Generic;
using System.Linq;
namespace DevExpress.DevAV.DevAVDbDataModel
{
/// <summary>
/// A DevAVDbUnitOfWork instance that represents the run-time implementation of the IDevAVDbUnitOfWork interface.
/// </summary>
public class DevAVDbUnitOfWork : DbUnitOfWork<DevAVDb>, IDevAVDbUnitOfWork
{
public DevAVDbUnitOfWork(Func<DevAVDb> contextFactory)
: base(contextFactory)
{
}
IRepository<TaskAttachedFile, long> IDevAVDbUnitOfWork.AttachedFiles {
get { return GetRepository(x => x.Set<TaskAttachedFile>(), (TaskAttachedFile x) => x.Id); }
}
IRepository<EmployeeTask, long> IDevAVDbUnitOfWork.Tasks {
get { return GetRepository(x => x.Set<EmployeeTask>(), (EmployeeTask x) => x.Id); }
}
IRepository<Employee, long> IDevAVDbUnitOfWork.Employees {
get { return GetRepository(x => x.Set<Employee>(), (Employee x) => x.Id); }
}
IRepository<CustomerCommunication, long> IDevAVDbUnitOfWork.Communications {
get { return GetRepository(x => x.Set<CustomerCommunication>(), (CustomerCommunication x) => x.Id); }
}
IRepository<CustomerEmployee, long> IDevAVDbUnitOfWork.CustomerEmployees {
get { return GetRepository(x => x.Set<CustomerEmployee>(), (CustomerEmployee x) => x.Id); }
}
IRepository<Customer, long> IDevAVDbUnitOfWork.Customers {
get { return GetRepository(x => x.Set<Customer>(), (Customer x) => x.Id); }
}
IRepository<CustomerStore, long> IDevAVDbUnitOfWork.CustomerStores {
get { return GetRepository(x => x.Set<CustomerStore>(), (CustomerStore x) => x.Id); }
}
IRepository<Crest, long> IDevAVDbUnitOfWork.Crests {
get { return GetRepository(x => x.Set<Crest>(), (Crest x) => x.Id); }
}
IRepository<Order, long> IDevAVDbUnitOfWork.Orders {
get { return GetRepository(x => x.Set<Order>(), (Order x) => x.Id); }
}
IRepository<OrderItem, long> IDevAVDbUnitOfWork.OrderItems {
get { return GetRepository(x => x.Set<OrderItem>(), (OrderItem x) => x.Id); }
}
IRepository<Product, long> IDevAVDbUnitOfWork.Products {
get { return GetRepository(x => x.Set<Product>(), (Product x) => x.Id); }
}
IRepository<ProductCatalog, long> IDevAVDbUnitOfWork.ProductCatalogs {
get { return GetRepository(x => x.Set<ProductCatalog>(), (ProductCatalog x) => x.Id); }
}
IRepository<ProductImage, long> IDevAVDbUnitOfWork.ProductImages {
get { return GetRepository(x => x.Set<ProductImage>(), (ProductImage x) => x.Id); }
}
IRepository<Picture, long> IDevAVDbUnitOfWork.Pictures {
get { return GetRepository(x => x.Set<Picture>(), (Picture x) => x.Id); }
}
IRepository<QuoteItem, long> IDevAVDbUnitOfWork.QuoteItems {
get { return GetRepository(x => x.Set<QuoteItem>(), (QuoteItem x) => x.Id); }
}
IRepository<Quote, long> IDevAVDbUnitOfWork.Quotes {
get { return GetRepository(x => x.Set<Quote>(), (Quote x) => x.Id); }
}
IRepository<Evaluation, long> IDevAVDbUnitOfWork.Evaluations {
get { return GetRepository(x => x.Set<Evaluation>(), (Evaluation x) => x.Id); }
}
IRepository<Probation, long> IDevAVDbUnitOfWork.Probations {
get { return GetRepository(x => x.Set<Probation>(), (Probation x) => x.Id); }
}
IRepository<State, StateEnum> IDevAVDbUnitOfWork.States {
get { return GetRepository(x => x.Set<State>(), (State x) => x.ShortName); }
}
IRepository<DatabaseVersion, long> IDevAVDbUnitOfWork.Version {
get { return GetRepository(x => x.Set<DatabaseVersion>(), (DatabaseVersion x) => x.Id); }
}
}
}

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