예제 #1
0
        private void NodeExpanded(object sender, TreeViewCancelEventArgs e)
        {
            var node = e.Node;

            foreach (TreeNode innerNode in node.Nodes)
            {
                var sitecorePath = innerNode.Tag as SitecorePath;
                var updater      = new UpdateNode(sitecorePath, innerNode, this);
                var thread       = new Thread(() =>
                {
                    try
                    {
                        updater.Update();
                    }
                    catch (WebException)
                    {
                        Globals.SitecoreAddin.AlertConnectionFailure();
                    }
                    catch (System.Web.Services.Protocols.SoapException)
                    {
                        Globals.SitecoreAddin.Alert("Window has gotten out of sync with Sitecore! Please refresh tab.");
                    }
                });
                thread.Start();
            }
        }
예제 #2
0
        public static void UpdateWPH(string WPH)
        {
            try
            {
                Form  form = Application.OpenForms["FormMonitoring"];
                Label W;
                if (form == null)
                {
                    return;
                }

                W = form.Controls.Find("WPH", true).FirstOrDefault() as Label;
                if (W == null)
                {
                    return;
                }

                if (W.InvokeRequired)
                {
                    UpdateNode ph = new UpdateNode(UpdateWPH);
                    W.BeginInvoke(ph, WPH);
                }
                else
                {
                    W.Text = WPH;
                }
            }
            catch
            {
                logger.Error("UpdateWPH: Update fail.");
            }
        }
예제 #3
0
 /// <summary>Calls a function every frame. If <paramref name="order"/> >= 0, function is called after LateUpdate; otherwise it is called before LateUpdate.</summary>
 /// <param name="receiver">Function to call</param>
 /// <param name="order">Determines the execution order of the function. A function with a smaller order is executed before a function with a larger order.
 /// </param>
 public static void AddLateUpdateReceiver(UpdateCallback receiver, int order = 0)
 {
     if (order < 0)
     {
         if (preLateUpdateNode == null)
         {
             preLateUpdateNode = FetchUpdateNode(receiver, order, null);
             preCallbackBroadcaster.OnLateUpdate = OnPreLateUpdateCall;
         }
         else
         {
             preLateUpdateNode = AddReceiverInternal(receiver, order, preLateUpdateNode);
         }
     }
     else
     {
         if (postLateUpdateNode == null)
         {
             postLateUpdateNode = FetchUpdateNode(receiver, order, null);
             postCallbackBroadcaster.OnLateUpdate = OnPostLateUpdateCall;
         }
         else
         {
             postLateUpdateNode = AddReceiverInternal(receiver, order, postLateUpdateNode);
         }
     }
 }
예제 #4
0
 public void CreateTask(Configuration config, UpdateNode updater, bool updateManually, ServerSubscribe serverSubscribe = null)
 {
     if (_config == null)
     {
         _config           = config;
         _updater          = updater;
         _notify           = updateManually;
         _serverSubscribes = new List <ServerSubscribe>();
         if (serverSubscribe != null)
         {
             _serverSubscribes.Add(serverSubscribe);
         }
         else
         {
             if (updateManually)
             {
                 _serverSubscribes.AddRange(config.serverSubscribes);
             }
             else
             {
                 foreach (var server in config.serverSubscribes.Where(server => server.AutoCheckUpdate))
                 {
                     _serverSubscribes.Add(server);
                 }
             }
         }
         Next();
     }
 }
예제 #5
0
    private static UpdateNode AddReceiverInternal(UpdateCallback receiver, int order, UpdateNode head)
    {
        if (head.order < order)
        {
            UpdateNode cachedHead = head;

            UpdateNode next = head.next;
            while (next != null && next.order <= order)
            {
                head = next;
                next = head.next;
            }

            if (head.order < order)
            {
                head.next = FetchUpdateNode(receiver, order, next);
            }
            else
            {
                head.receivers.Add(receiver);
            }

            return(cachedHead);
        }

        if (head.order == order)
        {
            head.receivers.Add(receiver);

            return(head);
        }

        return(FetchUpdateNode(receiver, order, head));
    }
예제 #6
0
        public static void UpdateJobMove(string JobId)
        {
            try
            {
                Form    form = Application.OpenForms["FormMonitoring"];
                TextBox tb;

                if (form == null)
                {
                    return;
                }

                tb = form.Controls.Find("LoadPort01_State", true).FirstOrDefault() as TextBox;

                if (tb == null)
                {
                    return;
                }

                if (tb.InvokeRequired)
                {
                    UpdateNode ph = new UpdateNode(UpdateJobMove);
                    tb.BeginInvoke(ph, JobId);
                }
                else
                {
                    Job Job = JobManagement.Get(JobId);
                    if (Job != null)
                    {
                        Node LastNode    = NodeManagement.Get(Job.LastNode);
                        Node CurrentNode = NodeManagement.Get(Job.Position);
                        if (LastNode != null)
                        {
                            Label present = form.Controls.Find(Job.LastNode + "_Slot_" + Job.LastSlot, true).FirstOrDefault() as Label;
                            if (present != null)
                            {
                                present.Text      = "No wafer";
                                present.BackColor = Color.DimGray;
                                present.ForeColor = Color.White;
                            }
                        }
                        if (CurrentNode != null)
                        {
                            Label present = form.Controls.Find(Job.Position + "_Slot_" + Job.Slot, true).FirstOrDefault() as Label;
                            if (present != null)
                            {
                                present.Text = Job.Host_Job_Id;

                                present.BackColor = Color.Green;
                                present.ForeColor = Color.White;
                            }
                        }
                    }
                }
            }
            catch
            {
                logger.Error("UpdateJobMove: Update fail.");
            }
        }
 public void CreateTask(Configuration config, UpdateNode updater, bool updateManually, List <ServerSubscribe> serverSubscribe = null)
 {
     if (_config != null)
     {
         return;
     }
     _config  = config;
     _updater = updater;
     _notify  = updateManually;
     if (serverSubscribe?.Count > 0)
     {
         _serverSubscribes = new Queue <ServerSubscribe>(serverSubscribe);
     }
     else
     {
         _serverSubscribes = new Queue <ServerSubscribe>();
         if (updateManually)
         {
             config.ServerSubscribes.ForEach(sub => _serverSubscribes.Enqueue(sub));
         }
         else
         {
             foreach (var server in config.ServerSubscribes.Where(server => server.AutoCheckUpdate))
             {
                 _serverSubscribes.Enqueue(server);
             }
         }
     }
     Next();
 }
예제 #8
0
 private static void PoolUpdateNode(UpdateNode node)
 {
     if (updateNodesPoolCount < UPDATE_NODE_POOL_MAX_SIZE)
     {
         node.next = null;
         updateNodesPool[updateNodesPoolCount++] = node;
     }
 }
예제 #9
0
    // Finds the UpdateNode that belongs to this node and triggers the quest, cutscene or dialogue updates
    public void CheckForUpdates(DialogueNode node, string npcName)
    {
        DialogueUpdate update     = GetDialogueUpdate(npcName);        // Get the DialogueUpdate from this npc
        UpdateNode     updateNode = GetNode(update.UpdateNodes, node); // Get the UpdateNode that matches this node

        m_CurrentUpdateNode = updateNode;

        UpdateTargets(m_CurrentUpdateNode.Targets);
    }
예제 #10
0
        public void Populate(int order, UpdateCallback receiver, UpdateNode next)
        {
            this.order = order;

            receivers = new List <UpdateCallback>();
            receivers.Add(receiver);

            this.next = next;
        }
예제 #11
0
        protected ITransactionOperation CreateTransactionOperation(TransactionType transactionType)
        {
            ITransactionOperation transactionOperation;

            switch (transactionType)
            {
            case TransactionType.CreateNode:
                transactionOperation = new CreateNode(MapObjects.Parameters);
                break;

            case TransactionType.DeleteNode:
                transactionOperation = new DeleteNode(MapObjects.Parameters);
                break;

            case TransactionType.CreateRelationship:
                transactionOperation = new CreateRelationship(MapObjects.Parameters);
                break;

            case TransactionType.DeleteRelationship:
                transactionOperation = new DeleteRelationship(MapObjects.Parameters);
                break;

            case TransactionType.CreateDescriptor:
                transactionOperation = new CreateDescriptor(MapObjects.Parameters);
                break;

            case TransactionType.CreateMetadata:
                transactionOperation = new CreateMetadata(MapObjects.Parameters);
                break;

            case TransactionType.UpdateMetadata:
                transactionOperation = new UpdateMetadata(MapObjects.Parameters);
                break;

            case TransactionType.DeleteMetadata:
                transactionOperation = new DeleteMetadata(MapObjects.Parameters);
                break;

            case TransactionType.UpdateNode:
                transactionOperation = new UpdateNode(MapObjects.Parameters);
                break;

            case TransactionType.UpdateRelationship:
                transactionOperation = new UpdateRelationship(MapObjects.Parameters);
                break;

            case TransactionType.UpdateDescriptor:
                transactionOperation = new UpdateDescriptor(MapObjects.Parameters);
                break;

            default:
                throw new NotSupportedException("The requested transaction type doesn't exist.");
            }

            return(transactionOperation);
        }
예제 #12
0
        private void AddRootNode(TreeView tree, string path, string title)
        {
            var sitecorePath = new SitecorePath(title, path);

            sitecorePath.GetDecendents();
            var node = sitecorePath.GetNode();

            UpdateNode.AddTreeNode(sitecorePath, node.Nodes);
            tree.Nodes.Add(node);
        }
예제 #13
0
    public override void UpdateState(int[] state, int[] state_, int rewd, BirdAction action)
    {
        UpdateNode node = new UpdateNode();

        node.state  = state;
        node.state_ = state_;
        node.rewd   = rewd;
        node.action = (int)action;
        Send(node);
    }
예제 #14
0
 public override void UpdateState(int state, int state_, int rewd, bool action)
 {
     if (init)
     {
         UpdateNode node = new UpdateNode();
         node.state  = state;
         node.state_ = state_;
         node.rewd   = rewd;
         node.action = action;
         Send(node);
     }
 }
예제 #15
0
        private void NodeExpanded(object sender, TreeViewCancelEventArgs e)
        {
            var node = e.Node;

            foreach (TreeNode innerNode in node.Nodes)
            {
                var sitecorePath = innerNode.Tag as SitecorePath;
                var updater      = new UpdateNode(sitecorePath, innerNode, this);
                var thread       = new Thread((updater.Update));
                thread.Start();
            }
        }
예제 #16
0
    private static UpdateNode FetchUpdateNode(UpdateCallback receiver, int order, UpdateNode next = null)
    {
        if (updateNodesPoolCount > 0)
        {
            UpdateNode pooledNode = updateNodesPool[--updateNodesPoolCount];
            updateNodesPool[updateNodesPoolCount] = null;

            pooledNode.Populate(order, receiver, next);
            return(pooledNode);
        }

        return(new UpdateNode(order, receiver, next));
    }
예제 #17
0
 public SubscribeWindow(MainController controller, UpdateSubscribeManager updateSubscribeManager, UpdateNode updateNodeChecker)
 {
     InitializeComponent();
     I18NUtil.SetLanguage(Resources, @"SubscribeWindow");
     Closed += (o, e) =>
     {
         controller.ConfigChanged -= controller_ConfigChanged;
         SubscribeWindowViewModel.SubscribesChanged -= SubscribeWindowViewModel_SubscribesChanged;
     };
     _controller                = controller;
     _updateSubscribeManager    = updateSubscribeManager;
     _updateNodeChecker         = updateNodeChecker;
     _controller.ConfigChanged += controller_ConfigChanged;
     LoadCurrentConfiguration();
     SubscribeWindowViewModel.SubscribesChanged += SubscribeWindowViewModel_SubscribesChanged;
 }
예제 #18
0
        private void AddRootNode(TreeView tree, string path, string title)
        {
            var sitecorePath = new SitecorePath(title, path);

            try
            {
                sitecorePath.GetDecendents();
            }
            catch (WebException)
            {
                MessageBox.Show(ConnectionLostMessage);
            }

            var node = sitecorePath.GetNode();

            UpdateNode.AddTreeNode(sitecorePath, node.Nodes);
            tree.Nodes.Add(node);
        }
예제 #19
0
        private static void AddRootNode(TreeView tree, string path, string title)
        {
            var sitecorePath = new SitecorePath(title, path);

            try
            {
                sitecorePath.GetDecendents();
            }
            catch (WebException)
            {
                Globals.SitecoreAddin.AlertConnectionFailure();
            }

            var node = sitecorePath.GetNode();

            UpdateNode.AddTreeNode(sitecorePath, node.Nodes);
            tree.Nodes.Add(node);
        }
예제 #20
0
 /// <summary>Stops calling a function every frame. Parameter '<paramref name="order"/>' must match the value used when calling AddLateUpdateReceiver.</summary>
 public static void RemoveLateUpdateReceiver(UpdateCallback receiver, int order = 0)
 {
     if (order < 0)
     {
         preLateUpdateNode = RemoveReceiverInternal(receiver, order, preLateUpdateNode);
         if (preLateUpdateNode == null)
         {
             preCallbackBroadcaster.OnLateUpdate = null;
         }
     }
     else
     {
         postLateUpdateNode = RemoveReceiverInternal(receiver, order, postLateUpdateNode);
         if (postLateUpdateNode == null)
         {
             postCallbackBroadcaster.OnLateUpdate = null;
         }
     }
 }
예제 #21
0
        public static void UpdateStatus(string Status)
        {
            try
            {
                Form   form = Application.OpenForms["FormMonitoring"];
                Button W;
                if (form == null)
                {
                    return;
                }

                W = form.Controls.Find("RunSwitch", true).FirstOrDefault() as Button;
                if (W == null)
                {
                    return;
                }

                if (W.InvokeRequired)
                {
                    UpdateNode ph = new UpdateNode(UpdateStatus);
                    W.BeginInvoke(ph, Status);
                }
                else
                {
                    if (Status.Equals("Start"))
                    {
                        W.Enabled   = true;
                        W.Text      = "Stop";
                        W.BackColor = Color.OrangeRed;
                    }
                    else
                    {
                        W.Text      = "Start";
                        W.Enabled   = false;
                        W.BackColor = Color.Lime;
                    }
                }
            }
            catch
            {
                logger.Error("UpdateStatus: Update fail.");
            }
        }
예제 #22
0
        public static void UpdateNodeStatus(List <Node> NodeList)
        {
            try
            {
                Form         form = Application.OpenForms["Form1"];
                DataGridView Node_gv;
                if (form == null)
                {
                    return;
                }

                Node_gv = form.Controls.Find("Node_gv", true).FirstOrDefault() as DataGridView;
                if (Node_gv == null)
                {
                    return;
                }

                if (Node_gv.InvokeRequired)
                {
                    UpdateNode ph = new UpdateNode(UpdateNodeStatus);
                    Node_gv.BeginInvoke(ph, NodeList);
                }
                else
                {
                    //TabControl tab = form.Controls.Find("tabControl1", true).FirstOrDefault() as TabControl;
                    //if (tab.SelectedIndex != 2)
                    //{
                    //    return;
                    //}


                    Node_gv.DataSource = null;
                    Node_gv.DataSource = NodeList;
                    //Conn_gv.Refresh();
                    Node_gv.ClearSelection();
                }
            }
            catch (Exception e)
            {
                logger.Error("UpdateNodeStatus: Update fail." + e.Message + "\n" + e.StackTrace);
            }
        }
예제 #23
0
    private static void ExecuteNodes(UpdateNode head)
    {
        while (head != null)
        {
            List <UpdateCallback> receivers = head.receivers;
            for (int i = receivers.Count - 1; i >= 0; i--)
            {
                if (receivers[i] != null)
                {
                    receivers[i]();
                }
                else
                {
                    receivers.RemoveAt(i);
                }
            }

            head = head.next;
        }
    }
예제 #24
0
    private static UpdateNode RemoveReceiverInternal(UpdateCallback receiver, int order, UpdateNode head)
    {
        if (head == null || head.order > order)
        {
            return(head);
        }

        if (head.order == order)
        {
            if (head.receivers.Remove(receiver) && head.receivers.Count == 0)
            {
                UpdateNode result = head.next;
                PoolUpdateNode(head);

                return(result);
            }

            return(head);
        }

        UpdateNode cachedHead = head;

        UpdateNode next = head.next;

        while (next != null && next.order < order)
        {
            head = next;
            next = head.next;
        }

        if (next != null && next.order == order)
        {
            if (next.receivers.Remove(receiver) && next.receivers.Count == 0)
            {
                head.next = next.next;
                PoolUpdateNode(next);
            }
        }

        return(cachedHead);
    }
예제 #25
0
        private void NodeExpanded(object sender, TreeViewCancelEventArgs e)
        {
            var node = e.Node;

            foreach (TreeNode innerNode in node.Nodes)
            {
                var sitecorePath = innerNode.Tag as SitecorePath;
                var updater      = new UpdateNode(sitecorePath, innerNode, this);
                var thread       = new Thread(() => {
                    try
                    {
                        updater.Update();
                    }
                    catch (WebException)
                    {
                        MessageBox.Show(ConnectionLostMessage);
                    }
                });
                thread.Start();
            }
        }
        public Tuple <string, UpdateNode> BuildUpdateNodePacket(string id, string idParent, double scale, double x, double y, double z, double rotationX, double rotationY, double rotationZ)
        {
            UpdateNode obj = new UpdateNode()
            {
                id   = "scene/node/update",
                data = new Data14()
                {
                    id        = id,
                    parent    = idParent,
                    transform = new Transform()
                    {
                        position = new double[] { x, y, z },
                        scale    = scale,
                        rotation = new double[] { rotationX, rotationY, rotationZ }
                    }
                }
            };

            string json = JsonConvert.SerializeObject(obj);

            return(new Tuple <string, UpdateNode>(json, obj));
        }
        private void uxBrowseDocuments_BeforeExpand(object sender, TreeViewCancelEventArgs e)
        {
            var node = e.Node;

            foreach (TreeNode innerNode in node.Nodes)
            {
                var sitecorePath = innerNode.Tag as SitecorePath;
                var updater      = new UpdateNode(sitecorePath, innerNode, this);
                var thread       = new Thread(() =>
                {
                    try
                    {
                        updater.Update();
                    }
                    catch (WebException)
                    {
                        Globals.SitecoreAddin.AlertConnectionFailure();
                    }
                });
                thread.Start();
            }
        }
예제 #28
0
        public MenuViewController(ShadowsocksController controller)
        {
            this.controller = controller;

            LoadMenu();

            controller.ToggleModeChanged     += controller_ToggleModeChanged;
            controller.ToggleRuleModeChanged += controller_ToggleRuleModeChanged;
            controller.ConfigChanged         += controller_ConfigChanged;
            controller.Errored += controller_Errored;

            _notifyIcon = new NotifyIcon();
            UpdateTrayIcon();
            _notifyIcon.Visible     = true;
            _notifyIcon.ContextMenu = contextMenu1;
            _notifyIcon.MouseClick += notifyIcon1_Click;

            updateNodeChecker = new UpdateNode();
            updateNodeChecker.NewNodeFound += updateNodeChecker_NewNodeFound;
            updateSubscribeManager          = new UpdateSubscribeManager();

            updateChinaIPChecker = new UpdateChinaIP();
            updateChinaIPChecker.NewChinaIPFound += updateChinaIPChecker_NewChinaIPFound;
            updateChinaIPManager = new UpdateChinaIPManager();

            LoadCurrentConfiguration();

            Configuration config = controller.GetCurrentConfiguration();

            if (config.nodeFeedAutoUpdate)
            {
                updateSubscribeManager.CreateTask(config, updateNodeChecker);
            }

            timerDelayCheckUpdate          = new System.Timers.Timer(1000.0 * 10);
            timerDelayCheckUpdate.Elapsed += timer_Elapsed;
            timerDelayCheckUpdate.Start();
        }
예제 #29
0
        public void PushSymbolReference(ProtoCore.DSASM.SymbolNode symbol)
        {
            Debug.Assert(null != symbol);
            Debug.Assert(null != updateNodeRefList);
            UpdateNode updateNode = new UpdateNode();
            updateNode.symbol = symbol;
            updateNode.nodeType = UpdateNodeType.kSymbol;

            UpdateNodeRef nodeRef = new UpdateNodeRef();
            nodeRef.block = symbol.runtimeTableIndex;
            nodeRef.PushUpdateNode(updateNode);

            updateNodeRefList.Add(nodeRef);
        }
예제 #30
0
        public void PushSymbolReference(ProtoCore.DSASM.SymbolNode symbol, ProtoCore.AssociativeGraph.UpdateNodeType type = UpdateNodeType.kSymbol)
        {
            Debug.Assert(null != symbol);
            Debug.Assert(null != updateNodeRefList);
            UpdateNode updateNode = new UpdateNode();
            updateNode.symbol = symbol;
            updateNode.nodeType = type;

            UpdateNodeRef nodeRef = new UpdateNodeRef();
            nodeRef.PushUpdateNode(updateNode);

            updateNodeRefList.Add(nodeRef);
        }
예제 #31
0
        public void PushProcReference(ProtoCore.DSASM.ProcedureNode proc)
        {
            Debug.Assert(null != proc);
            Debug.Assert(null != updateNodeRefList);
            UpdateNode updateNode = new UpdateNode();
            updateNode.procNode = proc;
            updateNode.nodeType = UpdateNodeType.kMethod;

            UpdateNodeRef nodeRef = new UpdateNodeRef();
            nodeRef.PushUpdateNode(updateNode);

            updateNodeRefList.Add(nodeRef);
        }
예제 #32
0
 public void PushUpdateNode(UpdateNode node)
 {
     Validity.Assert(null != nodeList);
     nodeList.Add(node);
 }
예제 #33
0
 public bool IsEqual(UpdateNode rhs)
 {
     if (nodeType == rhs.nodeType)
     {
         if (nodeType == UpdateNodeType.kSymbol || nodeType == UpdateNodeType.kLiteral)
         {
             return symbol.IsEqualAtScope(rhs.symbol);
         }
         else if (nodeType == UpdateNodeType.kMethod)
         {
             return procNode.IsEqual(rhs.procNode);
         }
     }
     return false;
 }
예제 #34
0
 public void Visit(UpdateNode node)
 {
     throw new NotImplementedException();
 }
예제 #35
0
 public void Visit(UpdateNode node)
 {
     SetQueryPart(QueryPart.Update);
 }