コード例 #1
0
        protected void onBnFace2Remove(object sender, EventArgs e)
        {
            TreeSelection selection = treeviewFace2.Selection;
            TreeModel     model;
            TreeIter      iter;

            if (selection.CountSelectedRows() == 1)
            {
                TreePath tp     = selection.GetSelectedRows()[0];
                int      iPlace = tp.Indices[0];

                if (selection.GetSelected(out model, out iter))
                {
                    // get the face1 list
                    //

                    Dictionary <String, String>         cardDefinition = CardGeneratorDB.Instance.getRowFromTable(CardGeneratorDB.TABLECardDefinitions, "FaceCardName", _SelectedCardTypeName);
                    List <CardDefinitions.CardDefClass> face1          = CardDefinitions.faceCardStructureFromJSONString(cardDefinition["Face2"]);
                    face1.RemoveAt(iPlace);
                    String face1JSONString = CardDefinitions.JSONStringFromfaceCardStructure(face1);

                    CardGeneratorDB.Instance.updateRowField(CardGeneratorDB.TABLECardDefinitions, CardGeneratorDB.COLUMNCardDefinitionID, cardDefinition[CardGeneratorDB.COLUMNCardDefinitionID], "Face2", face1JSONString);

                    SelectCardType(_SelectedCardTypeName);
                }
            }
        }
コード例 #2
0
        protected void onBnFace2Add(object sender, EventArgs e)
        {
            DialogAddFaceData dialog = new DialogAddFaceData();

            if (dialog.Run() == (int)ResponseType.Ok)
            {
                Dictionary <String, String>         cardDefinition = CardGeneratorDB.Instance.getRowFromTable(CardGeneratorDB.TABLECardDefinitions, "FaceCardName", _SelectedCardTypeName);
                List <CardDefinitions.CardDefClass> face           = CardDefinitions.faceCardStructureFromJSONString(cardDefinition["Face2"]);

                CardDefinitions.CardDefClass newFaceDef = new CardDefinitions.CardDefClass();
                newFaceDef.COLUMNSOURCE = dialog.Column;
                newFaceDef.LANGUAGECODE = dialog.LanguageCode;
                newFaceDef.TYPE         = dialog.Voice;

                face.Add(newFaceDef);
                String faceJSONString = CardDefinitions.JSONStringFromfaceCardStructure(face);
                CardGeneratorDB.Instance.updateRowField(CardGeneratorDB.TABLECardDefinitions, CardGeneratorDB.COLUMNCardDefinitionID, cardDefinition[CardGeneratorDB.COLUMNCardDefinitionID], "Face2", faceJSONString);
                SelectCardType(_SelectedCardTypeName);
            }
            dialog.Destroy();
        }