Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Runtime.InteropServices;
- using DocsVision.Platform.CardHost;
- using DocsVision.Platform.ObjectModel;
- using DocsVision.Platform.ObjectModel.Mapping;
- using DocsVision.Platform.WinForms;
- using DocsVision.BackOffice.ObjectModel;
- using DocsVision.BackOffice.ObjectModel.Mapping;
- using DocsVision.BackOffice.WinForms;
- using YourCompanyName.YourProjectName.ObjectModel;
- using YourCompanyName.YourProjectName.ObjectModel.Mapping;
- namespace YourCompanyName.YourProjectName.ObjectModel
- {
- public static class YourProject
- {
- public static void Register(ObjectContext context)
- {
- context.GetService<IObjectMapperFactoryRegistry>().RegisterFactory(typeof(YourProjectNameMapperFactory));
- }
- }
- public class YourDictionaryCard : BaseCard
- {
- #region Properties
- public override BaseCardSystemInfo SystemInfo
- {
- get { return null; }
- }
- public override ObjectCollection<BaseCardProcess> Processes
- {
- get { return null; }
- }
- /* some other sections of your dictionary */
- #endregion
- #region Constructors
- protected internal YourDictionaryCard() : this(null) { }
- protected internal YourDictionaryCard(ObjectInitializationData data) : base(data) { }
- #endregion
- }
- }
- namespace YourCompanyName.YourProjectName.ObjectModel.Mapping
- {
- public sealed class YourProjectNameMapperFactory : ObjectMapperFactory
- {
- #region Constructors
- protected internal YourProjectNameMapperFactory(ObjectContext context) : base(context)
- {
- RegisterObjectMapper(typeof(YourDictionaryCard), typeof(YourDictionaryCardMapper));
- }
- #endregion
- }
- public sealed class YourDictionaryCardMapper : BaseCardMapper<YourDictionaryCard>
- {
- #region Constructors
- protected internal YourDictionaryCardMapper(ObjectContext context) : base(context) { }
- #endregion
- #region BaseCardMapper methods overriding
- protected override ObjectMap GetObjectMap()
- {
- return new ObjectMap(); // <<< build your dictionary card map here!
- }
- protected override YourDictionaryCard CreateObject(ObjectInitializationData data)
- {
- return new YourDictionaryCard(data);
- }
- #endregion
- }
- }
- namespace YourCompanyName.YourProjectName.WinForms
- {
- [Customizable(false), CardFrameWindowType(typeof(CardFrameForm))]
- [ClassInterface(ClassInterfaceType.None), ComVisible(true), Guid("4226D147-C67B-4F3E-B690-E28C8379AB75")]
- public partial class YourDictionaryCardControl : BaseCardControl
- {
- #region Properties
- public override BaseCard BaseObject
- {
- get { return DictionaryCard; }
- }
- private YourDictionaryCard DictionaryCard
- {
- get
- {
- return ObjectContext.GetObject<YourDictionaryCard>(CardData.Id);
- }
- }
- #endregion
- #region Constructors
- public YourDictionaryCardControl() : base()
- {
- if (IsInDesignMode())
- {
- InitializeComponent();
- }
- }
- #endregion
- #region BaseCardControl methods overriding
- protected override void OnCardInitialized(EventArgs args)
- {
- base.OnCardInitialized(args);
- InitializeComponent();
- }
- protected override void OnObjectContextInitializing(ObjectContextEventArgs args)
- {
- base.OnObjectContextInitializing(args);
- YourProject.Register(args.ObjectContext); // <<< register object mappers in object context
- }
- #endregion
- #region Class methods
- private void InitializeComponent() { }
- #endregion
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement