public SmartAppControl(SmartApp mApp,RoutedEventHandler mClick1,RoutedEventHandler mClick2)
 {
     //默认的控件初始化函数
     InitializeComponent();
     //通过SmartApp实现数据绑定
     mAppButton.Click += mClick1;
     mAppDelete.Click += mClick2;
     //获取应用程序图标
     if (!File.Exists(mApp.AppPath))
     {
          mSource = new BitmapImage(new Uri("Resources\\Icon\\Icon_Error.png", UriKind.Relative));
     }
     else
     {
         Icon mIcon = System.Drawing.Icon.ExtractAssociatedIcon(mApp.AppPath);
         mSource = Imaging.CreateBitmapSourceFromHBitmap(
             mIcon.ToBitmap().GetHbitmap(), IntPtr.Zero, Int32Rect.Empty, BitmapSizeOptions.FromEmptyOptions());
     }
     //绑定应用程序图标
     mAppImage.Source = mSource;
     //绑定应用程序名称
     mAppLabel.Content = mApp.AppName;
     //绑定ToolTip
     mToolTip1.Content = mApp.AppName;
     mToolTip2.Content = mApp.AppName;
 }
 private void CreatNewApp(string mFile)
 {
     //获取当前Tab索引
     int mType = Tab.SelectedIndex;
     //获取当前应用程序列表
     mAppList = getAppList(mType);
     //获得XmlDB数据库
     XmlDB mDB = XmlDBFactory.LoadXmlDB(mFileName);
     SmartApp mApp = new SmartApp(mFile, mNames[mType].ToString());
     mDB.Insert(mApp);
     mDB.Commit();
     //构建界面
     SmartAppControl mControl = mApp.BuilderUI(new RoutedEventHandler(App_Click), new RoutedEventHandler(App_Click));
     if (mAppList.Count < 4)
     {
         mControl.SetValue(Grid.RowProperty, 0);
         mControl.SetValue(Grid.ColumnProperty, mAppList.Count);
     }
     else
     {
         mControl.SetValue(Grid.RowProperty, (mAppList.Count) / 4);
         mControl.SetValue(Grid.ColumnProperty, (mAppList.Count) % 4);
     }
     Grid mGrid = getGrid(mNames[mType]);
     //添加App到桌面
     mGrid.Children.Add(mControl);
     //修改词典
     mAppList = getAppList(mType);
     mAppList.Add(mApp);
 }