예제 #1
0
    // Preps the data from server and places it within the Model
    // Not clear whether this should ammend or replace the data
    // At the moment it ammends!
    private void ProcessData(DT d, Roar.Callback <IDictionary <string, CT> > cb)
    {
        Dictionary <string, CT> o = converter.convert(d);

        // Flag server cache called
        // Must do before `set()` to flag before change events are fired
        HasDataFromServer = true;

        // Update the Model
        this.Set(o);
        if (cb != null)
        {
            cb(new Roar.CallbackInfo <IDictionary <string, CT> >(o, WebAPI.OK, null));
        }

        logger.DebugLog("Setting the model in " + name + " to : " + Roar.Json.ObjectToJSON(o));
        logger.DebugLog("[roar] -- Data Loaded: " + name);

        // Broadcast data ready event
        RoarManager.OnComponentReady(this.name);
    }