Exemple #1
0
    /// <summary>
    /// Initializes and returns a record using an id that you provide..
    ///
    /// Use this method to initialize a new record object with the specified ID. The newly created record contains no data.
    /// </summary>
    /// <param name="id">The ID to assign to the record itself. The ID cannot currently be in use by any other record and must not be nil. </param>
    /// <param name="type">A string reflecting the type of record that you want to create. Define the record types that your app supports, and use them to distinguish between records with different types of data. </param>
    public CK_Record(CK_RecordID id, string type)
    {
        _Id   = id;
        _Type = type;

        IndexRecord();
    }
	/// <summary>
	/// Do not use this method. It is created for plugin internal use only.
	/// </summary>
	public CK_Record(string name, string template) {


		_Id = new CK_RecordID(name);

		string[] DataArray = template.Split(IOSNative.DATA_SPLITTER); 
		_Type = DataArray[0];

		for(int i = 1; i < DataArray.Length; i += 2) {
			if(DataArray[i] == IOSNative.DATA_EOF) {
				break;
			}

			SetObject(DataArray[i], DataArray[i + 1]);
		}

		IndexRecord();
	}
	void OnGUI() {

		UpdateToStartPos();

		GUI.Label(new Rect(StartX, StartY, Screen.width, 40), "Cloud Kit", style);

		StartY+= YLableStep;
		if(GUI.Button(new Rect(StartX, StartY, buttonWidth, buttonHeight), "Create Record")) {

			CK_RecordID recordId =  new CK_RecordID("1");

			CK_Record record =  new CK_Record(recordId, "Post");
			record.SetObject("PostText", "Sample point of interest");
			record.SetObject("PostTitle", "My favorite point of interest");


			CK_Database database = ISN_CloudKit.Instance.PublicDB;
			database.SaveRecrod(record);

			database.ActionRecordSaved += Database_ActionRecordSaved;
		}


		StartX += XButtonStep;
		if(GUI.Button(new Rect(StartX, StartY, buttonWidth, buttonHeight), "Delete Record")) {
			CK_RecordID recordId =  new CK_RecordID("1");
			CK_Database database = ISN_CloudKit.Instance.PublicDB;

			database.DeleteRecordWithID(recordId);
			database.ActionRecordDeleted += Database_ActionRecordDeleted;

		}

		StartX += XButtonStep;
		if(GUI.Button(new Rect(StartX, StartY, buttonWidth, buttonHeight), "Fetch Record")) {
			CK_RecordID recordId =  new CK_RecordID("1");
			CK_Database database = ISN_CloudKit.Instance.PublicDB;

			database.FetchRecordWithID(recordId);
			database.ActionRecordFetchComplete += Database_ActionRecordFetchComplete;
		}


	}
Exemple #4
0
    /// <summary>
    /// Do not use this method. It is created for plugin internal use only.
    /// </summary>
    public CK_Record(string name, string template)
    {
        _Id = new CK_RecordID(name);

        string[] DataArray = template.Split(SA.Common.Data.Converter.DATA_SPLITTER);
        _Type = DataArray[0];

        for (int i = 1; i < DataArray.Length; i += 2)
        {
            if (DataArray[i] == SA.Common.Data.Converter.DATA_EOF)
            {
                break;
            }

            SetObject(DataArray[i], DataArray[i + 1]);
        }

        IndexRecord();
    }
    void OnGUI()
    {
        UpdateToStartPos();

        GUI.Label(new Rect(StartX, StartY, Screen.width, 40), "Cloud Kit", style);

        StartY += YLableStep;
        if (GUI.Button(new Rect(StartX, StartY, buttonWidth, buttonHeight), "Create Record"))
        {
            CK_RecordID recordId = new CK_RecordID("1");

            CK_Record record = new CK_Record(recordId, "Post");
            record.SetObject("PostText", "Sample point of interest");
            record.SetObject("PostTitle", "My favorite point of interest");


            CK_Database database = ISN_CloudKit.Instance.PublicDB;
            database.SaveRecrod(record);

            database.ActionRecordSaved += Database_ActionRecordSaved;
        }


        StartX += XButtonStep;
        if (GUI.Button(new Rect(StartX, StartY, buttonWidth, buttonHeight), "Delete Record"))
        {
            CK_RecordID recordId = new CK_RecordID("1");
            CK_Database database = ISN_CloudKit.Instance.PublicDB;

            database.DeleteRecordWithID(recordId);
            database.ActionRecordDeleted += Database_ActionRecordDeleted;
        }

        StartX += XButtonStep;
        if (GUI.Button(new Rect(StartX, StartY, buttonWidth, buttonHeight), "Fetch Record"))
        {
            CK_RecordID recordId = new CK_RecordID("1");
            CK_Database database = ISN_CloudKit.Instance.PublicDB;

            database.FetchRecordWithID(recordId);
            database.ActionRecordFetchComplete += Database_ActionRecordFetchComplete;
        }
    }
Exemple #6
0
 public CK_RecordDeleteResult(int recordId) : base(true)
 {
     _RecordID = CK_RecordID.GetRecordIdByInternalId(recordId);
 }
	public CK_RecordDeleteResult(int recordId):base(true) {
		_RecordID = CK_RecordID.GetRecordIdByInternalId(recordId);
	}
	/// <summary>
	/// Initializes and returns a record using an id that you provide..
	/// 
	/// Use this method to initialize a new record object with the specified ID. The newly created record contains no data.
	/// </summary>
	/// <param name="id">The ID to assign to the record itself. The ID cannot currently be in use by any other record and must not be nil. </param>
	/// <param name="type">A string reflecting the type of record that you want to create. Define the record types that your app supports, and use them to distinguish between records with different types of data. </param>
	public CK_Record(CK_RecordID id, string type) {
		_Id = id;
		_Type = type;

		IndexRecord();
	}
	/// <summary>
	/// Deletes the specified record asynchronously from the current database.
	/// 
	/// Deleting a record may trigger additional deletions if the record was referenced by other records. 
	/// This method reports only the ID of the record you asked to delete. 
	/// CloudKit does not report deletions triggered by owning relationships between records.
	/// </summary>
	/// <param name="recordId">The ID of the record you want to delete.</param>
	public void DeleteRecordWithID(CK_RecordID recordId) {
		ISN_CloudKit.DeleteRecord(_InternalId, recordId.Internal_Id);
	}
Exemple #10
0
	/// <summary>
	/// Fetches one record asynchronously from the current database.
	/// 
	/// Use this method to fetch records that are not urgent to your app’s execution. 
	/// This method fetches the record with a low priority, which may cause the task to execute after higher-priority tasks.
	/// </summary>
	/// <param name="recordId">The ID of the record you want to fetch.</param>
	public void FetchRecordWithID(CK_RecordID recordId) {
		ISN_CloudKit.FetchRecord(_InternalId, recordId.Internal_Id);
	}
Exemple #11
0
 /// <summary>
 /// Deletes the specified record asynchronously from the current database.
 ///
 /// Deleting a record may trigger additional deletions if the record was referenced by other records.
 /// This method reports only the ID of the record you asked to delete.
 /// CloudKit does not report deletions triggered by owning relationships between records.
 /// </summary>
 /// <param name="recordId">The ID of the record you want to delete.</param>
 public void DeleteRecordWithID(CK_RecordID recordId)
 {
     ISN_CloudKit.DeleteRecord(_InternalId, recordId.Internal_Id);
 }
Exemple #12
0
 /// <summary>
 /// Fetches one record asynchronously from the current database.
 ///
 /// Use this method to fetch records that are not urgent to your app’s execution.
 /// This method fetches the record with a low priority, which may cause the task to execute after higher-priority tasks.
 /// </summary>
 /// <param name="recordId">The ID of the record you want to fetch.</param>
 public void FetchRecordWithID(CK_RecordID recordId)
 {
     ISN_CloudKit.FetchRecord(_InternalId, recordId.Internal_Id);
 }