Esempio n. 1
0
 private void Ga_Update(object sender, EventArgs e)
 {
     CurrentGeneration++;
     RaisePropertyChanged(nameof(ShortestRouteFound));
     RaisePropertyChanged(nameof(CurrentGeneration));
     UpdateUI?.Invoke(this, EventArgs.Empty);
 }
Esempio n. 2
0
        private void QueueWork()
        {
            string       queuePath = Dns.GetHostName() + ConfigurationManager.AppSettings["local_queue_path"];
            MessageQueue queue     = null;

            if (!MessageQueue.Exists(queuePath))
            {
                queue = MessageQueue.Create(queuePath);
            }
            else
            {
                queue = new MessageQueue(queuePath);
            }
            queue.Formatter = new XmlMessageFormatter(new Type[] { typeof(String) });
            while (true)
            {
                System.Messaging.Message message = queue.Receive();
                if (message.Label == "key")
                {
                    DataBlob blob = (DataBlob)Serializer.DeserializeObject(Convert.FromBase64String(message.Body.ToString()));
                    ConfigurationManager.AppSettings.Set("RSA", blob.Data);
                    UpdateUI d = new UpdateUI(UpdateUIAfterRSARecieved);
                    Invoke(d);
                    Thread.CurrentThread.Abort();
                }
            }
        }
Esempio n. 3
0
 public void Init(GameController gameController, UpdateUI ui, MapRegion r)
 {
     this.gameController = gameController;
     this.ui             = ui;
     this.region         = r;
     isHovered           = false;
 }
Esempio n. 4
0
 public void Deselect()
 {
     SelectedFaces.Clear();
     SelectedVertices.Clear();
     _isFaceSelected = false;
     UpdateUI?.Invoke();
 }
Esempio n. 5
0
        /// <summary>
        /// Creates new <c>CommandUI</c> for use during an editing update. This doesn't refer to
        /// the UpdateUI itself, it refers to a command that is the subject of the update.
        /// </summary>
        /// <param name="editId">The ID of the edit this command deals with.</param>
        /// <param name="updcmd">The update command (not null) that is controlling this command.</param>
        protected CommandUI(IControlContainer cc, EditingActionId editId, UpdateUI updcmd)
        {
            if (updcmd == null)
            {
                throw new ArgumentNullException();
            }

            m_Container = cc;
            m_EditId    = editId;
            m_UpdCmd    = updcmd;
            m_Draw      = updcmd.ActiveDisplay;
            //m_Update = updcmd.SelectedObject;
            m_Recall = null;

            /*
             * this.Update = update;
             *
             * if (update==null)
             * {
             *  m_Draw = EditingController.Current.ActiveDisplay;
             *  m_Recall = null;
             * }
             */

            Debug.Assert(m_Draw != null);
        }
Esempio n. 6
0
 public void Execute(UndoItem ui)
 {
     ui.Redo();
     Redo.Clear();
     Undo.Push(ui);
     UpdateUI?.Invoke();
 }
Esempio n. 7
0
        private void QueueWork()
        {
            string   queuePath = Dns.GetHostName() + ConfigurationManager.AppSettings["server_queue_path"];
            UpdateUI d         = new UpdateUI(UpdateUIWithQueuePath);

            Invoke(d);
            MessageQueue queue = null;

            if (!MessageQueue.Exists(queuePath))
            {
                queue = MessageQueue.Create(queuePath);
            }
            else
            {
                queue = new MessageQueue(queuePath);
            }
            queue.Formatter = new XmlMessageFormatter(new Type[] { typeof(String) });
            while (true)
            {
                System.Messaging.Message message = queue.Receive();
                if (message.Label == "path")
                {
                    DataBlob clientPath = (DataBlob)Serializer.DeserializeObject(Convert.FromBase64String(message.Body.ToString()));
                    ClientConnectionHandler.SendRSAKeyToClientQueue(clientPath.Data);
                }
            }
        }
Esempio n. 8
0
        public static void ChangeState(string id, string state)
        {
            try
            {
                Form form = Application.OpenForms["Form1"];

                if (form == null)
                {
                    return;
                }

                Label ctrl = form.Controls.Find(id, true).FirstOrDefault() as Label;

                if (ctrl == null)
                {
                    return;
                }

                if (ctrl.InvokeRequired)
                {
                    UpdateUI ph = new UpdateUI(ChangeState);
                    ctrl.BeginInvoke(ph, id, state);
                }
                else
                {
                    ctrl.Text = state;
                }
            }
            catch (Exception e)
            {
            }
        }
Esempio n. 9
0
 public void SelectFaces(IEnumerable <Face> Faces)
 {
     SelectedFaces = Faces.ToList();
     SelectedVertices.Clear();
     _isFaceSelected = SelectedFaces.Count > 0;
     UpdateUI?.Invoke();
 }
Esempio n. 10
0
        public Inventory()
        {
            InitializeComponent();

            _Device = new DeviceSettings(this);
            _UpdateUIHandler = new UpdateUI(myUpdateUI);

            defaultType();
            defaultServer();
            disableSetButton();

            RoomParser rooms = new RoomParser();
            _RoomTable = rooms.Rooms;
            _TagTable = new Hashtable(1023);
            _TagList = new List<ListViewItem>(5000);
            _MaxRead = -100;
            _InRoom = false;

            _User = new User();
            if (_User.ShowDialog() == DialogResult.OK)
                userLabel.Text = _User.UserName;
            else
                Application.Exit();

            Connect();

            _TimeStamps = new Queue();
            _TimeStamps.Enqueue(DateTime.Now.ToString(_DateFormat));
            _TagRec = new TagRecords();

            if (_IsConnected)
                StartSequence();
        }
Esempio n. 11
0
        private void DownLoadUpdateFiles()
        {
            if (updateList == null || updateList.Count < 1)
            {
                BroadCastOnUpdateComplete();
                return;
            }

            try
            {
                UpdateUI         dUpdateUI         = new UpdateUI(UpdateUIInfo);
                AsycDownLoadFile dAsycDownLoadFile = new AsycDownLoadFile(DownLoadFile);
                for (int i = 0; i < updateList.Count; i++)
                {
                    string file         = updateList[i];
                    string destFile     = String.Concat(updateTmpPath, "\\", file);
                    string destFileName = destFile.Substring(destFile.LastIndexOf("/") + 1);
                    string srcFile      = String.Concat(url, file);
                    var    srcFileName  = file.Trim('/');
                    destFile = destFile.Replace("/", "\\");
                    Directory.CreateDirectory(destFile.Substring(0, destFile.LastIndexOf("\\")));
                    string curentFile = String.Concat("正在更新第", i + 1, "/", updateList.Count, "个", file);

                    Invoke(dAsycDownLoadFile, new object[] { srcFileName, srcFileName, i });
                    Thread.Sleep(50);
                    Invoke(dUpdateUI, new object[] { i, curentFile });
                }
            }
            catch (Exception ex)
            {
                Debug.WriteLine(ex.Message);
            }

            BroadCastOnUpdateComplete();
        }
Esempio n. 12
0
        public void FindSmallestBoundaryPolygon(List <Point> points)
        {
            int step = 0;

            PointsToEnclose = points;

            int  vertices  = BoundaryPolygon.Vertices.Count;
            bool developed = true;

            while (developed)
            {
                developed = false;
                for (int v = 0; v < vertices; v++)
                {
                    step++;
                    Point vertex        = BoundaryPolygon.Vertices.ElementAt(v);
                    Point bestNeighbour = FindBestNeighbour(vertex, v);

                    if (!vertex.Equals(bestNeighbour))
                    {
                        BoundaryPolygon.ExchangeVertexAt(v, bestNeighbour);
                        //v--;
                        developed = true;

                        Thread.Sleep(5);
                        UpdateUI?.Invoke(this, new HillClimbingEventArgs(new Polygon(BoundaryPolygon)));
                    }
                }
            }
        }
        /// <summary>
        /// Initializes a new instance of the <see cref="LineSubdivisionUpdateForm"/> class.
        /// </summary>
        /// <param name="up">The command that's running things.</param>
        internal LineSubdivisionUpdateForm(UpdateUI up)
        {
            InitializeComponent();

            m_UpdCmd          = up;
            this.DialogResult = DialogResult.Cancel;
        }
Esempio n. 14
0
        /// <summary>
        /// Handles the Finish button.
        /// </summary>
        /// <returns>The point created at the intersection (null if an error was reported).
        /// The caller is responsible for disposing of the dialog and telling the controller
        /// the command is done)</returns>
        internal override PointFeature Finish()
        {
            // The intersection SHOULD be defined (the Finish button should have
            // been disabled if it wasn't)
            IPosition x = intersectInfo.Intersection;

            if (x == null)
            {
                MessageBox.Show("No intersection. Nothing to save");
                return(null);
            }

            // If we're not doing an update, just save the edit
            UpdateUI up = (GetCommand() as UpdateUI);

            if (up == null)
            {
                return(SaveDirLine());
            }

            // Remember the changes as part of the UI object (the original edit remains
            // unchanged for now)
            IntersectDirectionAndLineOperation op = (IntersectDirectionAndLineOperation)up.GetOp();
            UpdateItemCollection changes          = op.GetUpdateItems(getDirection.Direction,
                                                                      getLine.Line,
                                                                      intersectInfo.ClosestPoint);

            if (!up.AddUpdate(op, changes))
            {
                return(null);
            }

            // Return the point previously created at the intersect
            return(op.IntersectionPoint);
        }
Esempio n. 15
0
    // Use this for initialization
    IEnumerator Start()
    {
        spawnWeapons = GameObject.Find("Items").GetComponent <SpawnWeapons>();
        updateUI     = GameObject.Find("PlayerUI").GetComponent <UpdateUIRefrence>().updateUI;
        yield return(new WaitForSeconds(0.3f));

        checkDistances();
    }
Esempio n. 16
0
 private void updateUI(int i)
 {
     Dispatcher.Invoke(() =>
     {
         lstSample.Items.Add(i);
     });
     UpdateUI.Invoke(this, new EventArgs());
 }
Esempio n. 17
0
 public void FetchLessons()
 {
     if (SelectedCategory == DefaultMessage)
     {
         return;
     }
     Lessons = (LessonDataStore as LessonDataStore).GetItemsByCategoryAsync(SelectedCategory).Result.ToList();
     UpdateUI.Invoke(null, new EventArgs());
 }
Esempio n. 18
0
        internal TerminalControl(UpdateUI updcmd, bool isLast)
        {
            InitializeComponent();

            m_Cmd      = updcmd;
            m_IsLast   = isLast;
            m_Line     = null;
            m_Terminal = null;
        }
Esempio n. 19
0
        private bool EndDelegate(PlaceHolderTextView placeView, UITextView textview, string formattedText)
        {
            if (scrollForward && textScroller.ContentOffset.X < 50f)
            {
                ScrollForward(true);
                DispatchQueue.MainQueue.DispatchAfter(DispatchTime.Now, () => {
                    textScroller.FlashScrollIndicators();
                });
            }
            if (updateText)
            {
                int textViewLen  = formattedText.Length;
                int formattedLen = placeView.Text.Length;

                if ((formattedLen > textViewLen) && !deleting)
                {
                    char c = placeView.Text.Substring(textViewLen, 1).ToCharArray() [0];
                    if (c == ' ')
                    {
                        formattedText = formattedText + " ";
                    }
                    else if (c == '/')
                    {
                        formattedText = formattedText + "/";
                    }

                    textViewLen  = formattedText.Length;
                    formattedLen = placeView.Text.Length;
                }
                placeView.SetShowTextOffSet(Math.Min(textViewLen, formattedLen));
                if (!deleting || hasFullNumber || deletedSpace)
                {
                    textview.Text = formattedText;
                }
                else
                {
                    ret = true;
                }
            }
            if (flashForError)
            {
                FlashMessage("Please recheck number");
            }

            if (ccText.Text.Length == cardHelper.LengthOfFormattedStringForType(Type) && expiryText.Text.Length == 5 && cvTwoText.Text.Length == (Type == CardType.AMEX ? 4 : 3))
            {
                CompletelyDone = true;
            }
            else
            {
                CompletelyDone = false;
            }
            DispatchQueue.MainQueue.DispatchAsync(() => {
                UpdateUI.Invoke();
            });
            return(ret);
        }
Esempio n. 20
0
    void Awake()
    {
        updateUI = GameObject.FindGameObjectWithTag("MainCanvas").GetComponent <UpdateUI>();

        GameObject enemyGo = Instantiate(enemyPrefab, enemyLocation);

        enemyUnit      = enemyGo.GetComponent <EnemyUnit>();
        timesAttempted = new int[enemyUnit.questions.Length];
    }
Esempio n. 21
0
        public MainWindow()
        {
            InitializeComponent();
            RefreshUI = UpdateImage;

            //test code here
            Console.WriteLine("{0}, {1}", SystemParameters.WorkArea.Width, SystemParameters.WorkArea.Height);
            Console.WriteLine("{0}, {1}", SystemParameters.PrimaryScreenWidth, SystemParameters.PrimaryScreenHeight);
            Console.WriteLine(Marshal.SizeOf(typeof(Vertex)));
        }
Esempio n. 22
0
        internal SimpleLineSubdivisionControl(UpdateUI updcmd)
        {
            InitializeComponent();

            m_Cmd       = updcmd;
            m_Line      = null;
            m_IsFromEnd = false;
            m_Length    = new Distance();
            m_MaxLength = 0.0;
        }
Esempio n. 23
0
    void Awake()
    {
        updateUI = GameObject.FindGameObjectWithTag("MainCanvas").GetComponent <UpdateUI>();

        GameObject enemyGo = Instantiate(enemyPrefab, enemyLocation);

        enemyUnit = enemyGo.GetComponent <EnemyUnit>();
        enemyLocation.GetComponentInChildren <Image>().sprite = enemyUnit.GetComponent <SpriteRenderer>().sprite;
        timesAttempted = new int[enemyUnit.questions.Length];
    }
Esempio n. 24
0
        internal ParallelControl(UpdateUI updcmd)
        {
            InitializeComponent();

            // Initialize everything.
            SetZeroValues();

            // Remember the command that's running the show.
            m_Cmd = updcmd;
        }
Esempio n. 25
0
 // Use this for initialization
 void Start()
 {
     jumpPuffs = 0;
     canJump   = 0;
     rb        = GetComponent <Rigidbody>();
     //distToGround = (GetComponent<Collider>().bounds.extents.y / 2);
     jumpingOnStar = false;
     anim          = GetComponent <Animator> ();
     sphereCol     = GetComponent <SphereCollider> ();
     ui            = GetComponent <UpdateUI> ();
 }
Esempio n. 26
0
        private void ImageCallBack_2(IntPtr m_BufForDriver, ref MyCamera.MV_FRAME_OUT_INFO_EX pFrameInfo, IntPtr pUser)
        {
            MyCamera.MVCC_INTVALUE stParam = new MyCamera.MVCC_INTVALUE();
            int nRet = cameraArr1[0].MV_CC_GetIntValue_NET("PayloadSize", ref stParam);

            if (MyCamera.MV_OK != nRet)
            {
                MessageBox.Show("Get PayloadSize failed", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }
            UInt32 nPayloadSize = stParam.nCurValue;

            if (nPayloadSize > m_nBufSizeForDriver)
            {
                if (m_BufForDriver != IntPtr.Zero)
                {
                    Marshal.Release(m_BufForDriver);
                }
                m_nBufSizeForDriver = nPayloadSize;
                m_BufForDriver      = Marshal.AllocHGlobal((Int32)m_nBufSizeForDriver);
            }
            if (m_BufForDriver == IntPtr.Zero)
            {
                MessageBox.Show("采集失败,请重新连接设备", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }
            // 将海康数据类型转为Mat
            nRet = cameraArr1[0].MV_CC_GetOneFrameTimeout_NET(m_BufForDriver, nPayloadSize, ref pFrameInfo, 1000); // m_BufForDriver为图像数据接收指针
            //pTemp = m_BufForDriver;
            byte[] byteImage = new byte[pFrameInfo.nHeight * pFrameInfo.nWidth];
            Marshal.Copy(m_BufForDriver, byteImage, 0, pFrameInfo.nHeight * pFrameInfo.nWidth);
            Mat matImage = new Mat(pFrameInfo.nHeight, pFrameInfo.nWidth, MatType.CV_8UC1, byteImage);
            // 单通道图像转为三通道
            Mat matImageNew = new Mat();

            Cv2.CvtColor(matImage, matImageNew, ColorConversionCodes.GRAY2RGB);
            Bitmap bitmap = matImageNew.ToBitmap();  // Mat转为Bitmap
                                                     // 是否进行推理
            DeepLearning deepLearning = new DeepLearning();

            if (isInference2)
            {
                bitmap = deepLearning.Inference(model2, modelType, bitmap);
            }
            if (pictureBox2.InvokeRequired)  // 当一个控件的InvokeRequired属性值为真时,说明有一个创建它以外的线程想访问它
            {
                UpdateUI update = delegate { pictureBox2.Image = bitmap; };
                pictureBox2.BeginInvoke(update);
            }
            else
            {
                pictureBox2.Image = bitmap;
            }
        }
Esempio n. 27
0
 public void SelectVertex(Pt?vertex)
 {
     SelectedFaces.Clear();
     SelectedVertices.Clear();
     if (vertex != null)
     {
         SelectedVertices.Add(vertex.Value);
     }
     _isFaceSelected = false;
     UpdateUI?.Invoke();
 }
Esempio n. 28
0
 public void SelectFace(Face face)
 {
     SelectedFaces.Clear();
     if (face != null && Faces.Contains(face))
     {
         SelectedFaces.Add(face);
     }
     SelectedVertices.Clear();
     _isFaceSelected = SelectedFaces.Count > 0;
     UpdateUI?.Invoke();
 }
Esempio n. 29
0
 public void SelectFace(int?index)
 {
     SelectedVertices.Clear();
     SelectedFaces.Clear();
     if (index != null && index.Value >= 0 && index.Value < Faces.Count)
     {
         SelectedFaces.Add(Faces[index.Value]);
     }
     _isFaceSelected = SelectedFaces.Count > 0;
     UpdateUI?.Invoke();
 }
Esempio n. 30
0
 public void SelectVertices(IEnumerable <Pt> vertices)
 {
     SelectedVertices.Clear();
     if (vertices != null)
     {
         SelectedVertices.AddRange(vertices.Distinct());
     }
     SelectedFaces.Clear();
     _isFaceSelected = false;
     UpdateUI?.Invoke();
 }
Esempio n. 31
0
    void Update()
    {
        if (!started)
        {
            started = true;
            GameObject playerBlipInst = Instantiate(playerBlip);
            playerBlipInst.transform.SetParent(this.transform);
            playerBlipInst.transform.localPosition = new Vector3(0, 0, 0);
            PBI = playerBlipInst.GetComponent <RectTransform>();
            PBI.anchoredPosition = new Vector3(0, 0, 0);
            PBI.localScale       = new Vector3(1, 1, 1);

            playerLoc = player.GetComponent <UpdateUI>();

            orbInst   = new RectTransform[orbs.Length];
            orbLocs   = new OrbControl[orbs.Length];
            receptors = new Receptor[orbs.Length];

            for (int i = 0; i < orbs.Length; i++)
            {
                GameObject lInst = Instantiate(orbBlip);
                lInst.transform.SetParent(this.transform);
                lInst.transform.localPosition = new Vector3(0, 0, 0);

                GameObject rInst = Instantiate(receptorBlip);
                rInst.transform.SetParent(this.transform);
                rInst.transform.localPosition = new Vector3(0, 0, 0);


                orbInst[i] = lInst.GetComponent <RectTransform>();
                orbInst[i].anchoredPosition = new Vector3(0, 0, 0);
                orbInst[i].localScale       = new Vector3(1, 1, 1);
                orbLocs[i] = orbs[i].GetComponent <OrbControl>();

                receptors[i] = orbLocs[i].receptor.GetComponent <Receptor>();

                Debug.Log(receptors[i].location.toVector2);

                RectTransform rT = rInst.GetComponent <RectTransform>();
                rT.localScale       = new Vector3(1, 1, 1);
                rT.anchoredPosition = 150 / 90f * receptors[i].location.toVector2;

                lInst.GetComponent <Image>().color = orbLocs[i].color;

                rInst.GetComponent <Image>().color = orbLocs[i].color;
            }
        }

        PBI.anchoredPosition = 150 / 90f * playerLoc.getLocation().toVector2;
        for (int i = 0; i < orbs.Length; i++)
        {
            orbInst[i].anchoredPosition = 150 / 90f * orbLocs[i].getLocation().toVector2;
        }
    }
Esempio n. 32
0
        public test(string xoml, string rules)
        {
            InitializeComponent();
            RefreshWFEvent = new UpdateUI(refreshWFInfoMethod);
            setSubmitEnabled = new UpdateUI(setSubmitEnabledMethod);
            setSubmitResult = new UpdateUI(setSubmitResultMethod);

            this.llSubmit.Enabled = false;

            rtbXoml = xoml;
            rtbRules = rules;
            this.start();
        }
Esempio n. 33
0
    private void Awake()
    {
        if(AttachedType == barType.health)
        {
            UpdateUI.healthBar = this;
        }
        else if(AttachedType == barType.shield)
        {
            UpdateUI.shieldBar = this;
        }
        else if(AttachedType == barType.ammo)
        {
            UpdateUI.ammoBar = this;
        }
        else if(AttachedType == barType.fuel)
        {
            UpdateUI.fuelBar = this;
        }

        slider = gameObject.GetComponent<UISlider> ();
    }
Esempio n. 34
0
 private void ProcessText(string text)
 {
     if (text == null || text.Length == 0||text.IndexOf("|")==-1)
     {
         return;
     }
     if (text[0] == 13)
     {
         text = text.Substring(1);
     }
     string[] data = text.Split('|');
     if (text.StartsWith("HGFOZ"))
     {
         UpdateUI ui = new UpdateUI(ProcessFmz);
         //this.ProcessDimension(data);
         this.Invoke(ui, new object[] { data });
     }
     else if (text.StartsWith("ZCCCH"))
     {
         UpdateUI ui = new UpdateUI(ProcessWhole);
         //this.ProcessDimension(data);
         this.Invoke(ui, new object[] { data });
         //this.ProcessWhole(data);
         //this.Invoke()
     }
     else if (text.StartsWith("QTZS21_V1.0"))
     {
         UpdateUI ui = new UpdateUI(ProcessDimension);
         //this.ProcessDimension(data);
         this.Invoke(ui, new object[] { data });
     }
 }
Esempio n. 35
0
 public void SetUpdateUIFunction(UpdateUI _updateUI)
 {
     this.updateUI = _updateUI;
 }
Esempio n. 36
0
 public ChatClient()
 {
     InitializeComponent();
     updateUi = new UpdateUI(SetText);
 }