private void HandleStateChange(object sender, TypeEventArgs args)
 {
     if (args.Type.GetInterface("IState") != null)
     {
         RequestStateChange(args.Type);
     }
 }
Exemplo n.º 2
0
        private void getData()
        {
            string args;

            new Task(() =>
            {
                if (tcpClient.Connected)
                {
                    stream = tcpClient.GetStream();
                    reader = new BinaryReader(stream);
                }
                while (tcpClient.Connected)
                {
                    try
                    {
                        args = reader.ReadString();
                        Debug.Write(args);
                    }
                    catch (Exception ex)
                    {
                        break;
                    }
                    TypeEventArgs e = JsonConvert.DeserializeObject <TypeEventArgs>(args);
                    OnDataRecived?.Invoke(this, e);
                }
            }).Start();
        }
Exemplo n.º 3
0
        public void send(object sender, TypeEventArgs e)
        {
            string args = JsonConvert.SerializeObject(e);

            new Task(() =>
            {
                if (tcpClient.Connected)
                {
                    stream = tcpClient.GetStream();
                    writer = new BinaryWriter(stream);
                    try
                    {
                        mutex.WaitOne();

                        writer.Write(args);
                        mutex.ReleaseMutex();
                    }
                    catch (Exception exc)
                    {
                        mutex.ReleaseMutex();
                        return;
                    }
                }
            }).Start();
        }
Exemplo n.º 4
0
        public void sendToServer(string data, CommandEnum command)
        {
            string[] args = new string[1];
            args[0] = data;
            TypeEventArgs e = new TypeEventArgs((int)command, args);

            sendData?.Invoke(this, e);
        }
Exemplo n.º 5
0
        protected void UpdateProgress(TypeEventArgs e)
        {
            var status = string.Format("Performing analysis for {0}: {1} states, {2} transitions", e.EpaBuilder.Type.Name, e.EpaBuilder.States.Count,
                                       e.EpaBuilder.Transitions.Count);

            UpdateStatus(status);
            UpdateOutput(status);
        }
Exemplo n.º 6
0
        private void Navigator_ItemAdd(object sender, TypeEventArgs e)
        {
            this.m_SelectLast = true;
            Iocomp.Classes.CollectionBase collectionBase = base.WorkingInstance as Iocomp.Classes.CollectionBase;
            object value = GPFunctions.CreateInstance(e.Type, e.Type.FullName);

            ((IList)collectionBase).Add(value);
            base.Master.ForceDirtyUpdate(null);
        }
Exemplo n.º 7
0
        public LogModel()
        {
            logsList  = new List <Log>();
            webClient = WebClient.singeltonClient();
            sendData += webClient.send;
            webClient.OnDataRecived += GetDataFromServer;

            TypeEventArgs e = new TypeEventArgs((int)CommandEnum.LogCommand, null);

            sendData?.Invoke(this, e);
        }
Exemplo n.º 8
0
        //Сменить тип отображаемых кривых
        private void ChangeGraphType(object sender, TypeEventArgs e)
        {
            outsType = e.type;
            var gItems  = (List <GraphItem>)mDataModel.GetTypedItems(outsType);
            var gl      = (GraphsList)CurveDisplayController;
            var gToDraw = gItems.FindAll((x) => x.enabled == true);

            GraphicsAdapter.instance.Fill(gItems);
            gl.ResetCurvelist(gItems);
            GraphicsAdapter.instance.ResetTitles(outsType);
            //GraphicsAdapter.instance.
        }
Exemplo n.º 9
0
        public void Execute_RaisesClassContextBeingProcessed()
        {
            _codeManagerDynamicMock.Stub(stub => stub.FlushCodeToDisk()).Return(new string[0]);
            object        eventSender = null;
            TypeEventArgs eventArgs   = null;

            _mixer.TypeBeingProcessed += (sender, args) => { eventSender = sender; eventArgs = args; };
            _mixer.Execute(_configuration);

            Assert.That(eventSender, Is.SameAs(_mixer));
            Assert.That(eventArgs.Type, Is.SameAs(_fakeMixedType));
        }
Exemplo n.º 10
0
        private void updateAppconfig(TypeEventArgs e)
        {
            string[] data = e.Args;
            this.OutputDir  = data[0];
            this.SourceName = data[1];
            this.LogName    = data[2];
            this.Thumbnail  = data[3];

            for (int i = 4; i < data.Length; i++)
            {
                addHandler(data[i]);
            }
        }
Exemplo n.º 11
0
        private void GetDataFromServer(object sender, TypeEventArgs e)
        {
            int type = e.TypeArgs;

            switch (type)
            {
            case (int)CommandEnum.LogCommand:
                massageLog(e.Args);
                break;

            case (int)CommandEnum.NewFileCommand:
                LogFile(e.Args);
                break;
            }
        }
Exemplo n.º 12
0
        //private int _counter;

        private void OnTypeLoaded(object sender, TypeEventArgs e)
        {
            var type = e.Type;

            if (IsLinked(type))
            {
                FireTypeLinked(type);
            }
            else
            {
                LinkType(type);
            }

            //Debug.WriteLine((++_counter) + ":" + e.Type.FullName);
        }
Exemplo n.º 13
0
        public void getFromServer(object sender, TypeEventArgs e)
        {
            int type = e.TypeArgs;

            switch (type)
            {
            case (int)CommandEnum.GetConfigCommand:
                updateAppconfig(e);
                break;

            case (int)CommandEnum.CloseCommand:
                removeHandler(e);
                break;
            }
        }
Exemplo n.º 14
0
        public void getFile()
        {
            TypeEventArgs e = new TypeEventArgs((int)CommandEnum.LogCommand, null);

            sendData?.Invoke(this, e);
        }
Exemplo n.º 15
0
 private void OnTypeLinked(object sender, TypeEventArgs e)
 {
     RegisterType(e.Type);
 }
Exemplo n.º 16
0
        private void removeHandler(TypeEventArgs e)
        {
            string handler = e.Args[0];

            this.handlers.Remove(handler);
        }