Example #1
0
    protected override void OnMouseLeftDoubleClick(PointerEventData eventData)
    {
        base.OnMouseLeftDoubleClick(eventData);

        //if (_MyKVContainer.KVDateDic.ContainsKey (TreeItemID.ToString ())) {
        //	Debug.Log ("==========>包含:" + TreeItemID.ToString ());
        //}
        //else
        //{
        //	Debug.Log ("==========>不包含:" + TreeItemID.ToString ());
        //}

        //if (_MyKVContainer.KVDateDic[TreeItemID.ToString()].ContainsKey(Index)) {
        //	Debug.Log ("==========>包含Index:" + Index);
        //}
        //else
        //{
        //	Debug.Log ("==========>不包含Index:" + Index);
        //}

        KVData data  = _MyKVContainer.KVDateDic[TreeItemID.ToString()][Index];
        string title = "title";
        string key   = data.key;
        string value = data.value;
        string type  = data.type;

        Log.i("KVListItem", "OnMouseLeftDoubleClick", "Index:" + Index + " type:" + type + " key:" + key + " value:" + value);
        KVDataModifyDialog.Open(OnDialogReturnValue, _MyKVContainer.Name, title, data.key, value, type);
    }
Example #2
0
    /// <summary>
    /// 检测本地是否存在TreeItmeID的数据,
    /// 不存在就去sql中查找,并存到本地,返回找到的这个treeItem的数据
    /// 存在就直接返回
    public Dictionary <int, KVData> CheckAndLoadTreeItemData2Local(string TreeItemID)
    {
        //根据TreeItem.ID判断本地是否有对应的Kvitem的数据,如果有就直接填充数据
        bool b = BeKVListDataCache(TreeItemID);

        Dictionary <int, KVData> kvDic = null;

        if (b)        //如果有缓存就从缓存刷新数据
        {
            Log.i("KVContainer", "RefreshKVList", "从本地缓存刷数据 ID:" + TreeItemID, BeShowLog);

            kvDic = GetLocaCacheKVListData(TreeItemID);
//			if (beRefreshUI) {
//				RefreshKVListUI(GetLocaCacheKVListData(TreeItemID));
//				CurTreeItemID = TreeItemID;
//			}
        }
        else        //如果没有就使用TreeItem.ID从sql查询读取,并缓存到本地
        {
            Log.i("KVContainer", "RefreshKVList", "从sql查询获取数据 ID:" + TreeItemID, BeShowLog);
            //这里要把不同tab的row刷出来填进去
            int _id = Convert.ToInt32(TreeItemID);
            //string[] rowNames = GEditorConfig.GetKVRowNames(Name);
            //string[] openType = GEditorConfig.GetKVRowOpenType(Name);
            //这里查询结果要存到本地缓存,这里查询到的是某个id的数据
            string[] queryResult = GEditorDataMgr.QueryKVSqlData(Name /*, rowNames*/, _id);

            kvDic = new Dictionary <int, KVData>();
            for (int i = 0, j = 0; i < queryResult.Length; i += 3, j++)       //nafio nsql
            {
                KVData kvdata = new KVData();
                kvdata.key   = queryResult [i];
                kvdata.value = queryResult[i + 1];
                kvdata.type  = queryResult[i + 2];
                kvDic.Add(j, kvdata);
                //Log.i("KVContainer","RefreshKVList","从sql向本地填充queryResult["+i+"]->key:"+kvdata.key+" value:"+kvdata.value+" type:"+kvdata.type);
            }

            KVDateDic.Add(TreeItemID, kvDic);
        }

//		if (beRefreshUI){
//			RefreshKVListUI(kvDic);
//			CurTreeItemID = TreeItemID;
//		}

        return(kvDic);
    }
Example #3
0
    /// <summary>
    /// 一个KVData就是上面的一行数据
    /// KVDic就是存储了上面全部的数据
    /// </summary>
    /// <returns>The template data.</returns>
    public static Dictionary <int, KVData> GetTemplateData()
    {
        Dictionary <int, KVData> KVDic = new Dictionary <int, KVData>();

        int count = Content.GetLength(0);

        for (int i = 0; i < count; i++)
        {
            KVData data = new KVData();
            data.key   = Content[i, 0];
            data.value = Content[i, 1];
            data.type  = Content[i, 2];
            KVDic.Add(i, data);
        }


        //NINFO 补全数据由SQLitHelper4DataEditor.InsertValues来处理了,不需要各个模板自己处理
        //模板数据比sql中最大数据少多少
        //		int nullData =SQLiteHelper4DataEditor.MAX_NUM - count;
        //
        //		if (nullData>0){
        //			if ((nullData%3)!=0) {//因为每条数据都是3项,所以这个数一定是3的倍数,如果不是,说明数据错误,报警
        //				Log.e("SkillDataTemplate.GetTemplateData->为模板数据补全sql占位数据时发生错误 nulData="+nullData);
        //				return null;
        //			}
        //
        //			for(int i=0;i<nullData;i++){
        //				KVData data = new KVData();
        //				data.key = "";
        //				data.value = "";
        //				data.type = "";//这里应该指向一个能打开默认dialog的类型,""空串就指定到默认值
        //
        //				int tempInt = count + i;
        //				KVDic.Add (tempInt, data);
        //			}
        //		}

        return(KVDic);
    }