Beispiel #1
0
        protected override Form CreateForm(int id)
        {
            FolderWithBLOBs oldFolder = null;

            using (IDbSession session = _sessionFactory.NewSession())
            {
                oldFolder = session.QueryForObject <FolderWithBLOBs>("GetFolderWithBLOBs", id);
            }

            return(new dialogs.FolderPropertyDlg(_extensionRegistry
                                                 , _contentService, _iconResourceService, _virtualFs, oldFolder));
        }
        public FolderWithBLOBs GetResult()
        {
            FolderWithBLOBs folder = _folder ?? new FolderWithBLOBs();

            folder.Name = this.txtFolderCaption.Text;
            folder.Icon = iconComboBox.SelectedImagePath;


            folder.Misc["Timeout"]         = this.archivingSettingPane.Time;
            folder.Misc["ActionOfTimeout"] = this.archivingSettingPane.Action;

            return(folder);
        }
        public FolderPropertyDlg(IExtensionRegistry extensionRegistry
                                 , IHierarchyDecoratorService contentService
                                 , IIconResourceService iconResourceService
                                 , IVirtualFileSystem virtualFs
                                 , FolderWithBLOBs folder)
        {
            _extensionRegistry   = extensionRegistry;
            _contentService      = contentService;
            _iconResourceService = iconResourceService;
            _virtualFs           = virtualFs;

            InitializeComponent();
            this.archivingSettingPane.Initialize(extensionRegistry);


            foreach (string path in System.IO.Directory.GetFiles(_virtualFs.GetBinPath("icons")))
            {
                try
                {
                    Bitmap img = new Bitmap(Image.FromFile(path));
                    img.MakeTransparent();
                    string imageFile = "$(file)\\icons\\" + System.IO.Path.GetFileName(path);

                    iconComboBox.Add(imageFile, img);
                }
                catch
                { }
            }


            string[] icons = new string[] { "jingxian.ui.icons.edit.png",
                                            "jingxian.folder.attachments.png",
                                            "jingxian.folder.calendar.png",
                                            "jingxian.folder.draft.png",
                                            "jingxian.folder.dynamicfolder.png",
                                            "jingxian.folder.inbox.png",
                                            "jingxian.folder.junk.png",
                                            "jingxian.folder.mailinglist.png",
                                            "jingxian.folder.newsgroup.png",
                                            "jingxian.folder.note.png",
                                            "jingxian.folder.outbox.png",
                                            "jingxian.folder.sent.png",
                                            "jingxian.folder.standard.png",
                                            "jingxian.folder.today.png",
                                            "jingxian.folder.trash.png" };

            foreach (string path in icons)
            {
                try
                {
                    Bitmap img = _iconResourceService.GetBitmap(path);
                    img.MakeTransparent();
                    iconComboBox.Add(path, img);
                }
                catch
                { }
            }

            //foreach (object obj in _contentService.GetChildren(_iconResourceService))
            //{
            //    PropertyContentProvider contentProvider = obj as PropertyContentProvider;
            //    if (null == contentProvider || "allIcons" != contentProvider.Name )
            //        continue;
            //}


            if (null == folder)
            {
                return;
            }

            _folder = folder;
            this.txtFolderCaption.Text = folder.Name;
            this.iconComboBox.Select(folder.Icon);

            this.archivingSettingPane.Time   = _folder.Misc["Timeout"];
            this.archivingSettingPane.Action = _folder.Misc["ActionOfTimeout"];
        }