在加载模块后再增加模块,转载文章HERE

The following sequence diagram shows us that the InitializeModules() method is the last process run http://global-webnet.net/UML/prism.htm

Examining the baseclass code we find that the following is what actually loads the modules; suggesting that it is safe to run again because of  the statement in bold:

       private void LoadModuleTypes(IEnumerable<ModuleInfo> moduleInfos)
       {
            if (moduleInfos == null)
            {
                return;
            }

            foreach (ModuleInfo moduleInfo in moduleInfos)
            {
                if (moduleInfo.State == ModuleState.NotStarted)
   
             {
                    if (this.ModuleNeedsRetrieval(moduleInfo))
                    {
                        this.BeginRetrievingModule(moduleInfo);
                    }
                    else
                    {
                        moduleInfo.State = ModuleState.ReadyForInitialization;
                    }
                }
            }
            this.LoadModulesThatAreReadyForLoad();
        }


I did a quick Proof of Concept with the StockTraderRI application to see if it was as easy as what was suggested to add a module after the BootStrapper process;  I added the line in bold below to the App() class

namespace StockTraderRI
{
    public partial class App : Application
    {
        public App()
        {
            this.Startup += this.Application_Startup;
            this.Exit += this.Application_Exit;
            this.UnhandledException += this.Application_UnhandledException;

            InitializeComponent();
        }

        private void Application_Startup(object sender, StartupEventArgs e)
        {
            //this.RootVisual = new Shell();
            var bootstrapper = new StockTraderRIBootstrapper();
            bootstrapper.Run();

            // Watch module will not load without this line
            bootstrapper.PostCatalogProcessing(); 
        }

I then updated the StockTraderRIBootstrapper as follows. 

namespace StockTraderRI
{
    public partial class StockTraderRIBootstrapper : UnityBootstrapper
    {
        protected override IModuleCatalog GetModuleCatalog()
        {
            var catalog = new ModuleCatalog();
            catalog.AddModule(typeof(MarketModule))
                .AddModule(typeof(PositionModule), "MarketModule");
                //.AddModule(typeof(WatchModule), "MarketModule");   <= remarked out
                //.AddModule(typeof(NewsModule));                                <= remarked out

            return catalog;
        }

        public void PostCatalogProcessing()
        {
            ModuleCatalog catalog = (ModuleCatalog)Container.Resolve<IModuleCatalog>();
           
            catalog.AddModule(typeof(WatchModule), "MarketModule");
            catalog.AddModule(typeof(NewsModule));
            InitializeModules();
        }

posted @ 2009-03-22 11:44 寒萧 阅读(88) 评论(0) 编辑

见园子里有介绍office live 的文章,这两天试了下,总的感觉不错,与live Id团队或者朋友实现文件共享,在线查看word,excel或ppt等文件,还具有修改编辑回存等方便的网络操作功能,不论你到哪里工作就到哪,非常适合我们这样的懒人,但在使用过程中发现想将上传的文件发给其他人,如果是有live id的人并注册了office live 是很方便,通过共享就可以了,但在任何邮箱的朋友,想通过发邮件已附件的形式发给对方就不方便了,得先将文件下载下来再按正常发邮件附件的形式发邮件,这样个人感觉非常繁琐,如果能够在office live 菜单里有一个发选定文件的发邮件给其他人的菜单项就更好了,这种应用还是很多的,不知园子里有其他朋友有什么好的方法请共享出来。

posted @ 2008-10-17 10:50 寒萧 阅读(140) 评论(0) 编辑
如题
posted @ 2008-08-14 17:37 寒萧 阅读(56) 评论(1) 编辑
 

(无法显示隐藏文件以及无法双击打开分区)

用杀毒软件杀毒,所有驱动盘上的文件夹表现为不可见,实际为文件夹隐藏了。

如何判断是中了该种病毒,可以通过在命令行下键入:

cd C:"

dir /ah

如果有fun.xls.exe,再遵循以下的步骤即可.

fun.xls.exe tel.xls.exe 的变种

症状:

1.鼠标右键点盘符出现"Auto"字样

2.无法显示隐藏文件

杀毒方法:(切记:在操作过程中使用“右键->打开”,不可双击。)

1.结束注册表中的fun.xls.exe的进程(建议选中fun.xls.exe->右键->转到进程,查找到“algsrvs.exe 单击它,再选择“结束进程”)

2.删除文件:

C:"WINDOWS"system32"algsrvs.exe

C:"WINDOWS"system32"msfun80.exe

C:"WINDOWS"system32"msime82.exe

C:"WINDOWS"ufdata2000.log

3.打开注册表编辑器(“开始”-“运行”-输入“regedit”),删除注册表中的所有包含:fun.xls.exe的键值。用搜索!!

4.运行CMD,在每个驱动盘下使用如下命令:

先用dir/a命令看在每个分区下的根目录下是否存在这两个文件autorun.inffun.xls.exe,如果存在用如下命令取消隐藏。

Attrib –s –r –h autorun.inf

Attrib –s –r –h fun.xls.exe

5. 删除每个盘符下的隐藏文件:不要双击打开,点击右键选择打开

    AUTORUN.INF

    fun.xls.exe

6.重起电脑!

7.将隐藏的文件夹取消隐藏属性

cmd下用命令dir/a知道每个分区的隐藏文件夹

再用命令:attrib –s –r –h 文件夹名取消所有的隐藏文件夹。

posted @ 2008-03-29 16:58 寒萧 阅读(1354) 评论(0) 编辑

转发,试过了效果一级棒。大家快下下去研究研究。

终于解决了一个困扰许久的关于DWG文件的难题,还没完善,欢迎批评,高分相送
为了找一个合适的预览DWG文件的控件,不知道搜索了多少次,都没有满意的结果,R2002自带的控件无法预览R2004格式的文件,最近花了几天时间,终于解决了这个困扰好久了难题,直接从DWG文件中提取位图放在PictureBox中预览。唯一留下的遗憾是当文件被其它进程打开时,会导致程序返回速度太慢,不知道各位是否有好的方法解决这一问题(或是有什么办法可以强行打开正被其它进程打开的文件)。现将代码及注释贴出来,要知道我是刚学VB.Net的,而且纯属业余爱好。

    Private Structure BITMAPFILEHEADER
        Dim bfType As Short
        Dim bfSize As Integer
        Dim bfReserved1 As Short
        Dim bfReserved2 As Short
        Dim bfOffBits As Integer
    End Structure

Public Function GetDwgImage(ByVal FileName As String) As Image
        If Not File.Exists(FileName) Then Exit Function
        Dim DwgF As FileStream    '文件流
        Dim PosSentinel As Integer  '文件描述块的位置
        Dim br As BinaryReader  '读取二进制文件
        Dim TypePreview As Integer '缩略图格式
        Dim PosBMP As Integer '缩略图位置
        Dim LenBMP As Integer '缩略图大小
        Dim biBitCount As Short '缩略图比特深度
        Dim biH As BITMAPFILEHEADER 'BMP文件头,DWG文件中不包含位图文件头,要自行加上去
        Dim BMPInfo() As Byte  '包含在DWG文件中的BMP文件体
        Dim BMPF As New MemoryStream  '保存位图的内存文件流
        Dim bmpr As New BinaryWriter(BMPF) '写二进制文件类
        Dim myImg As Image
        Try
            DwgF = New FileStream(FileName, FileMode.Open, FileAccess.Read)    '文件流
            br = New BinaryReader(DwgF)
            DwgF.Seek(13, SeekOrigin.Begin) '从第十三字节开始读取
            PosSentinel = br.ReadInt32 '第13到17字节指示缩略图描述块的位置
            DwgF.Seek(PosSentinel + 30, SeekOrigin.Begin) '将指针移到缩略图描述块的第31字节

            TypePreview = br.ReadByte '第31字节为缩略图格式信息,2 为BMP格式,3为WMF格式
            Select Case TypePreview
                Case 1

                Case 2, 3
                    PosBMP = br.ReadInt32 'DWG文件保存的位图所在位置
                    LenBMP = br.ReadInt32 '位图的大小
                    DwgF.Seek(PosBMP + 14, SeekOrigin.Begin) '移动指针到位图块
                    biBitCount = br.ReadInt16 '读取比特深度
                    DwgF.Seek(PosBMP, SeekOrigin.Begin) '从位图块开始处读取全部位图内容备用
                    BMPInfo = br.ReadBytes(LenBMP)  '不包含文件头的位图信息
                    br.Close()
                    DwgF.Close()
                    With biH  '建立位图文件头
                        .bfType = &H4D42
                        If biBitCount < 9 Then .bfSize = 54 + 4 * (2 ^ biBitCount) + LenBMP Else .bfSize = 54 + LenBMP
                        .bfReserved1 = 0 '保留字节
                        .bfReserved2 = 0 '保留字节
                        .bfOffBits = 14 + &H28 + 1024 '图像数据偏移
                    End With
                    '以下开始写入位图文件头
                    bmpr.Write(biH.bfType) '文件类型
                    bmpr.Write(biH.bfSize) '文件大小
                    bmpr.Write(biH.bfReserved1) '0
                    bmpr.Write(biH.bfReserved2) '0
                    bmpr.Write(biH.bfOffBits) '图像数据偏移
                    bmpr.Write(BMPInfo) '写入位图


                    BMPF.Seek(0, SeekOrigin.Begin) '指针移到文件开始处

                    myImg = Image.FromStream(BMPF) '创建位图文件对象
                    Return myImg
                    bmpr.Close()
                    BMPF.Close()
            End Select
        Catch ex As Exception
            Return Nothing
        End Try

      
    End Function

这个程序涉及到了DWG文件的内部格式。编出来的人很了不起。

posted @ 2007-07-03 22:38 寒萧 阅读(1094) 评论(0) 编辑
摘要: 申银万国:最看好偏股型基金1、建议关注的基金:上投摩根阿尔法、嘉实主题精选、富国天益、景顺长城内需增长、鹏华行业成长、交行施罗德精选、工银瑞信核心价值、华安保利配置、华宝兴业宝康灵活配置等。2、重点关注的基金公司:上投摩根、交银施罗德、工银瑞信、嘉实、景顺长城、广发、华宝兴业、富国等。中投证券:年均获利25%以上重点推荐上投摩根中国优势、景顺长城内需增长、华夏大盘精选、富国天益价值、鹏华中国50、...阅读全文
posted @ 2007-01-04 13:25 寒萧 阅读(261) 评论(0) 编辑
摘要: 在刚刚过去的2006年里,随着股市的牛气冲天,汇市的波澜起伏,金融创新产品的层出不穷,老百姓投资理财热情空前高涨,基金俨然成为投资理财的“明星”产品。那么,2007年哪些基金值得投资者购买呢?经过对2006年整年基金投资业绩进行盘点后,专家认为,2007年最值得购买的十大基金为:景顺长城内需增长、泰达荷银行业精选、上投摩根中国优势、汇添富优势精选、银华核心价值优选、易方达策...阅读全文
posted @ 2007-01-04 13:18 寒萧 阅读(7648) 评论(0) 编辑
摘要: 2006年马上就要过去,在这一年里,想想自已学到了什么,什么都想学,结果什么都不精,在今后的学习中还得要专。昨天我开始玩基金,听别人的忽悠。阅读全文
posted @ 2006-12-31 15:57 寒萧 阅读(58) 评论(0) 编辑
摘要: 秘诀1:大家知道,WindowsXP的密码存放在系统所在的Winnt\System32\Config下SAM文件中,SAM文件即账号密码数据库文件。当我们登录系统的时 候,系统会自动地和Config中的SAM自动校对,如发现此次密码和用户名全与SAM文件中的加密数据符合时,你就会顺利登录;如果错误则无法登录。既然如此,我们的第一个方法就产生了:删除SAM文件来恢复密码。   如果你不用管本来系统卡...阅读全文
posted @ 2006-12-06 21:42 寒萧 阅读(1081) 评论(0) 编辑
摘要: Structured Shutdown - Cancelable events with CABPublished 07 octubre 06 05:03 p.m. | matiaswoloski A recurring question on the CAB/SCSF community is how to perform a voting mechanism to close an appli...阅读全文
posted @ 2006-10-25 17:49 寒萧 阅读(137) 评论(0) 编辑

公告