コード例 #1
0
        private void ExecuteDelete(object parameter)
        {
            Collection <AssetTypeModel> deleteditems = new Collection <AssetTypeModel>();
            IMessageBoxService          msg          = new MessageBoxService();
            string title      = "Deleting Asset Type";
            string confirmtxt = "Do you want to delete the selected item";

            if (AssetTypes.Count(x => x.Selected) > 1)
            {
                title      = title + "s";
                confirmtxt = confirmtxt + "s";
            }
            if (msg.ShowMessage(confirmtxt + "?", title, GenericMessageBoxButton.OKCancel, GenericMessageBoxIcon.Question).Equals(GenericMessageBoxResult.OK))
            {
                foreach (AssetTypeModel si in AssetTypes)
                {
                    if (si.Selected)
                    {
                        if (si.ID > 0)
                        {
                            DeleteItem(si.ID, "AssetTypes");
                        }
                        deleteditems.Add(si);
                    }
                }
                foreach (AssetTypeModel pm in deleteditems)
                {
                    AssetTypes.Remove(pm);
                }
                deleteditems.Clear();
            }
            msg = null;
        }
コード例 #2
0
    public void RemoveAssetType(string value)
    {
        List <UpdatableAsset> assets = mAssets[value];

        foreach (UpdatableAsset asset in assets)
        {
            if (asset.CurrentStatus != UpdatableAsset.Status.NEW)
            {
                mAdmin.DeleteAsset(asset, (Asset resultAsset, NPNFError error) => {
                    string assetName = (resultAsset != null ? resultAsset.Name : "<Name Unknown>");
                    if (error != null)
                    {
                        Debug.Log("Deleting asset failed: " + assetName);
                    }
                    else
                    {
                        Debug.Log("Deleting asset succeeded: " + assetName);
                    }
                });
            }
        }
        mAssets.Remove(value);
        AssetTypes.Remove(value);
        if (CurrentAssetType == value)
        {
            CurrentAssetType = null;
        }
    }