Exemple #1
0
        // прослушивание входящих подключений
        protected internal void Listen()
        {
            try
            {
                //tcpListener = new TcpListener(IPAddress.Parse("10.0.0.4"), 8888);
                tcpListener = new TcpListener(IPAddress.Any, 8888);
                tcpListener.Start();
                Console.WriteLine("The server is running. Waiting for connections ...");

                while (true)
                {
                    TcpClient tcpClient = tcpListener.AcceptTcpClient();

                    Client clientObject = new Client(tcpClient, this);
                    EventStart += clientObject.Process;
                    clients.Add(clientObject);

                    EventStart.Invoke();
                }
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.Message);
                Disconnect();
            }
        }
Exemple #2
0
        public event EventHandler EventReset = null;  // Событие, которое происходит в момент нажатия на кнопку Reset


        // Метод-обработчик события Tick, которое реализует функционал запуска, остановки, обнуления счета таймера
        private void Timer_Tick(object sender, EventArgs e)
        {
            if (sender.GetType().Name != "DispatcherTimer")
            {
                myobject = ((Button)sender).Name;
            }
            switch (myobject) // Проверка на нажатую кнопку
            {
            case "Start":
            {
                timer.Start();          // Метод, который запускает таймер (запускает System.Windows.Threading.DispatcherTimer)
                EventStart.Invoke(sender, e);
                break;
            }

            case "Stop":
            {
                timer.Stop();          // Метод, который останавливает таймер (запускает System.Windows.Threading.DispatcherTimer)
                break;
            }

            case "Reset":
            {
                timer.Stop();
                EventReset.Invoke(sender, e);
                break;
            }

            default:
            {
                timer.Stop();
                break;
            }
            }
        }
Exemple #3
0
        private async Task Worker(CancellationToken token)
        {
            using (WebClient webClient = new WebClient())
            {
                webClient.Encoding = Encoding.UTF8;

                while (_isActive)
                {
                    var reader = await webClient.DownloadStringTaskAsync(_apiSetting.Url);

                    var list = _api.Parse(reader);

                    EventStart?.Invoke(list);

                    try
                    {
                        await Task.Delay(_millisec, token);
                    }
                    catch (OperationCanceledException ex)
                    {
                    }
                }
            }

            EventAbort?.Invoke();
        }
//$=============================================================================
//@ Sets a start delay on an existing EchoFXEvent
//@
//@ Parameters:
//@
//# idelay      - Delay, in seconds, before the event begins
//# icallback   - Optional callback that gets called when event first begins
//&=============================================================================
    public void StartDelay(float idelay, EventStart icallback = null)
    {
        fxStartDelay = idelay;

        if (icallback != null)
        {
            fxEventStart = icallback;
        }
    }
Exemple #5
0
 public Event(int id, EventType type, EventCategory mainCategory, int difficulty, string description, EventPossible possible, EventStart start)
 {
     Id           = id;
     Type         = type;
     MainCategory = mainCategory;
     Difficulty   = difficulty;
     Description  = description;
     Count        = 0;
     _possible    = possible;
     _start       = start;
 }
Exemple #6
0
 public void Dispose()
 {
     EventAwake.Dispose();
     EventFixedUpdate.Dispose();
     EventLateUpdate.Dispose();
     EventOnDestroy.Dispose();
     EventOnDisable.Dispose();
     EventOnEnable.Dispose();
     EventOnGUI.Dispose();
     EventStart.Dispose();
     EventUpdate.Dispose();
 }
Exemple #7
0
 /// <summary>
 /// 插件启用,运行一次这里.
 /// 登录成功,会启用一次这里.
 /// 之后每次插件被手动启用,都会运行一次
 /// </summary>
 /// <param name="json"></param>
 /// <returns></returns>
 private Boolean Do_EventStart(string json)
 {
     try
     {
         EventStartArgs eventStartArgs = JsonConvert.DeserializeObject <EventStartArgs>(json);
         EventStart?.Invoke(this, eventStartArgs);
         return(true);
     }
     catch (Exception ex)
     {
         DebugMessage(ex.Message);
         DebugMessage(ex.StackTrace);
         return(false);
     }
 }
 internal Event GetSerializableNews()
 {
     return(new Event()
     {
         Guid = ContentGuid,
         Created = Created.ToString("yyyy-MM-ddTHH:mm:ss"),
         Modified = Saved.ToString("yyyy-MM-ddTHH:mm:ss"),
         CreatedBy = CreatedBy,
         ModifiedBy = ChangedBy,
         DisplayName = DisplayName,
         EventStart = EventStart.ToString("yyyy-MM-ddTHH:mm:ss"),
         EventEnd = EventEnd.ToString("yyyy-MM-ddTHH:mm:ss"),
         Address = Address,
         MeetingLink = MeetingLink,
         AboutThisEvent = AboutThisEvent?.ToHtmlString()
     });
 }
Exemple #9
0
        protected sealed override async Task Worker()
        {
            using (WebClient webClient = new WebClient())
            {
                webClient.Encoding = Encoding.UTF8;

                while (isActive)
                {
                    var reader = await webClient.DownloadStringTaskAsync(apiSetting.Url);

                    XDocument xDocument = XDocument.Parse(reader);

                    var list = apiXml.GetXml(xDocument);

                    EventStart?.Invoke(this, list);

                    await Task.Delay(300000);
                }

                EventAbort?.Invoke(this);
            }
        }
        protected override async Task Worker()
        {
            using (WebClient webClient = new WebClient())
            {
                webClient.Encoding = Encoding.UTF8;

                while (isActive)
                {
                    var reader = await webClient.DownloadStringTaskAsync(apiSetting.Url);

                    JObject json = JObject.Parse(reader);

                    var list = apiJson.GetJson(json);

                    EventStart?.Invoke(this, list);

                    await Task.Delay(300000);
                }
            }

            EventAbort?.Invoke(this);
        }
 public override string ToString()
 {
     return("SharepointCalendarEvent { Starts: " + EventStart.ToShortDateString() + " " + EventStart.ToShortTimeString() + ", Ends: " + EventEnd.ToShortDateString() + " " + EventEnd.ToShortTimeString() + ", All Day: " + AllDay + ", Title: " + Title + ", Location: " + Location + " }");
 }
Exemple #12
0
 public void Start()
 {
     isActiv = true;
     _time.Start();
     EventStart?.Invoke();
 }
Exemple #13
0
//$=============================================================================
//@ Sets a callback that is triggered when an event starts
//@
//@ Parameters:
//@
//# icallback - Method that gets called when the event is done.
//&=============================================================================
    public void SetEventStart(EventStart icallback)
    {
        fxEventStart = icallback;
    }
 public void Dispose()
 {
     EventAwake.Dispose();
     EventFixedUpdate.Dispose();
     EventLateUpdate.Dispose();
     EventOnAnimatorIK.Dispose();
     EventOnAnimatorMove.Dispose();
     EventOnApplicationFocus.Dispose();
     EventOnApplicationPause.Dispose();
     EventOnApplicationQuit.Dispose();
     EventOnAudioFilterRead.Dispose();
     EventOnBecameInvisible.Dispose();
     EventOnBecameVisible.Dispose();
     EventOnCollisionEnter.Dispose();
     EventOnCollisionEnter2D.Dispose();
     EventOnCollisionExit.Dispose();
     EventOnCollisionExit2D.Dispose();
     EventOnCollisionStay.Dispose();
     EventOnCollisionStay2D.Dispose();
     EventOnJointBreak.Dispose();
     EventOnJointBreak2D.Dispose();
     EventOnControllerColliderHit.Dispose();
     EventOnConnectedToServer.Dispose();
     EventOnDisconnectedFromServer.Dispose();
     EventOnMasterServerEvent.Dispose();
     EventOnFailedToConnect.Dispose();
     EventOnFailedToConnectToMasterServer.Dispose();
     EventOnDestroy.Dispose();
     EventOnDisable.Dispose();
     EventOnEnable.Dispose();
     EventOnDrawGizmos.Dispose();
     EventOnDrawGizmosSelected.Dispose();
     EventOnGUI.Dispose();
     EventOnMouseDown.Dispose();
     EventOnMouseDrag.Dispose();
     EventOnMouseEnter.Dispose();
     EventOnMouseExit.Dispose();
     EventOnMouseOver.Dispose();
     EventOnMouseUp.Dispose();
     EventOnMouseUpAsButton.Dispose();
     EventOnNetworkInstantiate.Dispose();
     EventOnParticleCollision.Dispose();
     EventOnParticleTrigger.Dispose();
     EventOnPlayerConnected.Dispose();
     EventOnPlayerDisconnected.Dispose();
     EventOnPostRender.Dispose();
     EventOnPreCull.Dispose();
     EventOnPreRender.Dispose();
     EventOnRenderImage.Dispose();
     EventOnRenderObject.Dispose();
     EventOnSerializeNetworkView.Dispose();
     EventOnServerInitialized.Dispose();
     EventOnTransformChildrenChanged.Dispose();
     EventOnTransformParentChanged.Dispose();
     EventOnTriggerEnter.Dispose();
     EventOnTriggerEnter2D.Dispose();
     EventOnTriggerExit.Dispose();
     EventOnTriggerExit2D.Dispose();
     EventOnTriggerStay.Dispose();
     EventOnTriggerStay2D.Dispose();
     EventOnWillRenderObject.Dispose();
     EventReset.Dispose();
     EventStart.Dispose();
     EventUpdate.Dispose();
 }