Ejemplo n.º 1
0
        private void Menu_Add_Click(object sender, RoutedEventArgs e)
        {
            var openFileDialog = new Microsoft.Win32.OpenFileDialog()
            {
                Filter = "Excel Files (*.exe)|*.exe"
            };
            var result = openFileDialog.ShowDialog();

            if (result == true)
            {
                string   path = openFileDialog.FileName;
                FileInfo fi   = new FileInfo(path);

                string name = fi.Name.Substring(0, fi.Name.LastIndexOf("."));
                if (!GameConfig.IsExistsGame(fi.Name))
                {
                    ObservableCollection <ListBoxGameItem> test = this.DataContext as ObservableCollection <ListBoxGameItem>;
                    test.Add(new ListBoxGameItem {
                        Name = name, ImagePath = MyInfo.iconFolder + "\\" + name + ".png"
                    });
                    GameConfig.AddGame(name, path);
                    util.IconUtil.GetIconFromFile(path, 2, MyInfo.iconFolder + "\\" + name + ".png");
                    util.JAVAUtil.AddSourceToHTTP(MyInfo.iconFolder + "\\" + name + ".png", false);
                }
            }
        }
Ejemplo n.º 2
0
 /// <summary>
 /// 更新软件列表
 /// </summary>
 /// <param name="list">需要更新的游戏列表</param>
 public static void UpdateMyGame(List <ApplacationItem> list)
 {
     foreach (ApplacationItem a in list)
     {
         GameConfig.AddGame(a.appName, a.packageName);
         util.IconUtil.GetIconFromFile(a.packageName, 2, MyInfo.iconFolder + "\\" + a.appName + ".png");
     }
 }