public void Init( MainWorkItem workItem, AppGroup appGroup, AppInfo appInfo, AppType appType, DeletedAppCollection deletedApps, AppStatCollection stat) { _AppGroup = appGroup; _Controller = new AppManagerController(workItem); AppTypes.ItemsSource = appGroup.AppTypes; _AppTypes = appGroup.AppTypes; AppTypeSelector.ItemsSource = appGroup.AppTypes; DeletedAppList.ItemsSource = deletedApps; _DeletedApps = deletedApps; StatList.ItemsSource = stat; //AppScanType.ItemsSource = appGroup.AppTypes; if (appInfo != null) { AppType selAppType = appGroup.FindAppType(appInfo); AppTypes.SelectedItem = selAppType; AppTypeSelector.SelectedItem = selAppType; _ItemToSelect = appInfo; AppList.SelectedItem = appInfo; AppTabs.SelectedIndex = 1; } if (appType != null) { AppType selAppType = appGroup.AppTypes.FindBySource(appType); AppTypes.SelectedItem = selAppType; AppTypeSelector.SelectedItem = selAppType; _ItemToSelect = appGroup.CreateNewAppInfo(selAppType); AppList.SelectedItem = _ItemToSelect; AppTabs.SelectedIndex = 1; } }
public void RestoreApp(AppGroup appGroup, DeletedAppCollection deletedApp, DeletedAppCollection recycleBin, AppType restore, string newAppTypeName) { if (deletedApp == null) { return; } if (newAppTypeName != null) { restore = new AppType() { AppTypeName = newAppTypeName }; appGroup.AppTypes.Add(restore); } for (int i = 0; i < deletedApp.Count; i++) { var item = deletedApp[i] as DeletedApp; var appTypeName = (item.DeletedFrom ?? restore).AppTypeName; var at = appGroup.FindAppType(appTypeName); if (at == null) { at = new AppType { AppTypeName = appTypeName }; appGroup.AppTypes.Add(at); } var ai = appGroup.CreateNewAppInfo( at, item.App.AppName, item.App.ExecPath, item.App.ImagePath); recycleBin.Remove(item); } }