예제 #1
0
        public String GetLastValidSet(String property)
        {
            String res = null;

            WidgetOperation[] operations = mOperationQueue.ToArray();

            // get the last valid set
            for (int i = operations.Length - 1; i >= 0; i--)
            {
                WidgetOperation operation = operations[i];
                if (operation.Type == WidgetOperation.OperationType.SET &&
                    operation.Property.Equals(property))
                {
                    res = operation.Value;
                    break;
                }
            }

            return(res);
        }
예제 #2
0
 /**
  * Adds an operation to the operation queue.
  * @param op The operation to be added.
  */
 public void AddOperation(WidgetOperation op)
 {
     MoSync.Util.RunActionOnMainThread(() =>
     {
         // we need to check if the widget was already created or not when the AddOperation is called
         // if so, we'll run the operation on the widget instead of inserting it into the queue
         IWidget widget = mRuntime.GetModule <NativeUIModule>().GetWidget(this.GetHandle());
         int handle     = this.GetHandle();
         if (widget is WidgetBaseMock)
         {
             (widget as WidgetBaseMock).OperationQueue.Enqueue(op);
         }
         else
         {
             // we need to check if the widget we got from the runtime can be cast to WidgetBaseWindowsPhone
             if (typeof(WidgetBaseWindowsPhone).IsAssignableFrom(widget.GetType()))
             {
                 (widget as WidgetBaseWindowsPhone).RunOperation(op);
             }
         }
     }, true);
 }
예제 #3
0
 /**
  * Runs a WidgetOperation on the current widget.
  * @param operation The widget operation (could be a ADD, INSERT, REMOVE, SET or GET) that
  * needs to be applied on the current widget.
  */
 public void RunOperation(WidgetOperation op)
 {
     // nothing to do here since this method should be overriden by the subclasses that
     // have a view on which to run the operation
 }
예제 #4
0
 /**
  * Adds an operation to the operation queue.
  * @param op The operation to be added.
  */
 public void AddOperation(WidgetOperation op)
 {
     MoSync.Util.RunActionOnMainThread(() =>
     {
         // we need to check if the widget was already created or not when the AddOperation is called
         // if so, we'll run the operation on the widget instead of inserting it into the queue
         IWidget widget = mRuntime.GetModule<NativeUIModule>().GetWidget(this.GetHandle());
         int handle = this.GetHandle();
         if (widget is WidgetBaseMock)
         {
             (widget as WidgetBaseMock).OperationQueue.Enqueue(op);
         }
         else
         {
             // we need to check if the widget we got from the runtime can be cast to WidgetBaseWindowsPhone
             if (typeof(WidgetBaseWindowsPhone).IsAssignableFrom(widget.GetType()))
             {
                 (widget as WidgetBaseWindowsPhone).RunOperation(op);
             }
         }
     }, true);
 }
예제 #5
0
        public static WidgetOperation CreateSetOperation(string propertyName, string propertyValue)
        {
            WidgetOperation op = new WidgetOperation(OperationType.SET, propertyName, propertyValue, -1, -1);

            return op;
        }
예제 #6
0
        public static WidgetOperation CreateRemoveOperation(int handle)
        {
            WidgetOperation op = new WidgetOperation(OperationType.REMOVE, "", "", handle, -1);

            return op;
        }
예제 #7
0
        public static WidgetOperation CreateInsertOperation(int handle, int index)
        {
            WidgetOperation op = new WidgetOperation(OperationType.REMOVE, "", "", handle, index);

            return op;
        }
예제 #8
0
 /**
  * Adds an operation to the operation queue.
  * @param op The operation to be added.
  */
 public void AddOperation(WidgetOperation op)
 {
     mOperationQueue.Enqueue(op);
 }
예제 #9
0
        public static WidgetOperation CreateAddOperation(int handle)
        {
            WidgetOperation op = new WidgetOperation(OperationType.ADD, "", "", handle, -1);

            return op;
        }
예제 #10
0
        static public WidgetOperation CreateRemoveOperation(int handle)
        {
            WidgetOperation op = new WidgetOperation(OperationType.REMOVE, "", "", handle, -1);

            return(op);
        }
예제 #11
0
        static public WidgetOperation CreateInsertOperation(int handle, int index)
        {
            WidgetOperation op = new WidgetOperation(OperationType.REMOVE, "", "", handle, index);

            return(op);
        }
예제 #12
0
        static public WidgetOperation CreateAddOperation(int handle)
        {
            WidgetOperation op = new WidgetOperation(OperationType.ADD, "", "", handle, -1);

            return(op);
        }
예제 #13
0
        static public WidgetOperation CreateGetOperation(string propertyName)
        {
            WidgetOperation op = new WidgetOperation(OperationType.GET, propertyName, "", -1, -1);

            return(op);
        }
예제 #14
0
        static public WidgetOperation CreateSetOperation(string propertyName, string propertyValue)
        {
            WidgetOperation op = new WidgetOperation(OperationType.SET, propertyName, propertyValue, -1, -1);

            return(op);
        }
예제 #15
0
 /**
  * Runs a WidgetOperation on the current widget.
  * @param operation The widget operation (could be a ADD, INSERT, REMOVE, SET or GET) that
  * needs to be applied on the current widget.
  */
 public void RunOperation(WidgetOperation op)
 {
     // nothing to do here since this method should be overriden by the subclasses that
     // have a view on which to run the operation
 }
예제 #16
0
        public static WidgetOperation CreateGetOperation(string propertyName)
        {
            WidgetOperation op = new WidgetOperation(OperationType.GET, propertyName, "", -1, -1);

            return op;
        }
예제 #17
0
 /**
  * Adds an operation to the operation queue.
  * @param op The operation to be added.
  */
 public void AddOperation(WidgetOperation op)
 {
     mOperationQueue.Enqueue(op);
 }