示例#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);
 }
        public static WidgetOperation CreateSetOperation(string propertyName, string propertyValue)
        {
            WidgetOperation op = new WidgetOperation(OperationType.SET, propertyName, propertyValue, -1, -1);

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

            return op;
        }
        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);
 }
        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
 }
        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);
 }