System.EventHandler.Invoke(object, System.EventArgs)

Here are the examples of the csharp api System.EventHandler.Invoke(object, System.EventArgs) taken from open source projects. By voting up you can indicate which examples are most useful and appropriate.

7931 Examples 7

19 View Source File : MemcachedProcess.cs
License : MIT License
Project Creator : 0ffffffffh

private static void Process_Exited(object sender, EventArgs e)
        {
            MemcachedProcess mp;
            Process process = sender as Process;

            Log.Error("memcached process {0} had lost with {1} code",
                process.Id, process.ExitCode);

            if (_Processes.TryGetValue(process.Id, out mp))
            {
                if (mp.Exited != null)
                {
                    Log.Info("Calling memcached process's exit event");
                    mp.Exited(mp, null);
                }

                Log.Info("removing instance from the mc proc list");

                _Processes.Remove(process.Id);
            }

            //register new instance search
        }

19 View Source File : GmicPipeServer.cs
License : GNU General Public License v3.0
Project Creator : 0xC0000054

private void OnOutputImageChanged()
        {
            OutputImageChanged?.Invoke(this, EventArgs.Empty);
        }

19 View Source File : FScrollBar.cs
License : MIT License
Project Creator : 0xLaileb

public virtual void OnScroll(ScrollEventType type = ScrollEventType.ThumbPosition)
        {
            ValueChanged?.Invoke(this, EventArgs.Empty);
        }

19 View Source File : MetroThumb.cs
License : MIT License
Project Creator : 1217950746

void Change()
        {
            if (ValueChange != null) { ValueChange(this, null); }
        }

19 View Source File : MetroColorPicker.xaml.cs
License : MIT License
Project Creator : 1217950746

private void ApplyColor(HsbaColor hsba)
        {
            currentColor = hsba;
            currentRgbaColor = currentColor.RgbaColor;

            if (!rgbaR.IsSelectionActive) { rgbaR.Text = currentRgbaColor.R.ToString(); }
            if (!rgbaG.IsSelectionActive) { rgbaG.Text = currentRgbaColor.G.ToString(); }
            if (!rgbaB.IsSelectionActive) { rgbaB.Text = currentRgbaColor.B.ToString(); }
            if (!rgbaA.IsSelectionActive) { rgbaA.Text = currentRgbaColor.A.ToString(); }

            if (!hsbaH.IsSelectionActive) { hsbaH.Text = ((int)(currentColor.H / 3.6)).ToString(); }
            if (!hsbaS.IsSelectionActive) { hsbaS.Text = ((int)(currentColor.S * 100)).ToString(); }
            if (!hsbaB.IsSelectionActive) { hsbaB.Text = ((int)(currentColor.B * 100)).ToString(); }
            if (!hsbaA.IsSelectionActive) { hsbaA.Text = ((int)(currentColor.A * 100)).ToString(); }

            if (!hex.IsSelectionActive) { if (canTransparent) { hex.Text = currentColor.HexString; } else { hex.Text = string.Format("#{0:X2}{1:X2}{2:X2}", currentRgbaColor.R, currentRgbaColor.G, currentRgbaColor.B); } }

            if (!thumbH.IsDragging) { thumbH.YPercent = currentColor.H / 360.0; }
            if (!thumbSB.IsDragging) { thumbSB.XPercent = currentColor.S; thumbSB.YPercent = 1 - currentColor.B; }
            if (!thumbA.IsDragging) { thumbA.YPercent = Math.Abs(1 - currentColor.A); }

            selectColor.H = currentColor.H;
            selectColor.A = currentColor.A;
            viewSelectColor.Fill = selectColor.OpaqueSolidColorBrush;
            if (canTransparent)
            {
                viewSelectColor.Opacity = viewSelectColor1.Opacity = viewSelectColor2.Opacity = 1 - thumbA.YPercent;
            }
            viewAlpha.Color = selectColor.OpaqueColor;
            if (canTransparent)
            {
                Background = currentColor.SolidColorBrush;
            }
            else
            {
                Background = currentColor.OpaqueSolidColorBrush;
            }

            ColorChange?.Invoke(this, null);
        }

19 View Source File : RedisClient.cs
License : MIT License
Project Creator : 2881099

void OnConnectionConnected(object sender, EventArgs args)
        {
            if (Connected != null)
                Connected(this, args);
        }

19 View Source File : RedisClientPool.cs
License : MIT License
Project Creator : 2881099

public RedisClient OnCreate()
        {
            return new RedisClient(_pool.TopOwner, _connectionStringBuilder.Host, _connectionStringBuilder.Ssl, _connectionStringBuilder.ConnectTimeout,
                _connectionStringBuilder.ReceiveTimeout, _connectionStringBuilder.SendTimeout, cli => Connected(cli, new EventArgs()));
        }

19 View Source File : RedisConnector.cs
License : MIT License
Project Creator : 2881099

void OnConnected()
        {
            _io.SetStream(_redisSocket.GetStream());
            if (Connected != null)
                Connected(this, new EventArgs());
        }

19 View Source File : RedisClientPool.cs
License : MIT License
Project Creator : 2881099

public RedisClient OnCreate()
        {
            RedisClient client = null;
            if (IPAddress.TryParse(_ip, out var tryip))
            {
                client = new RedisClient(new IPEndPoint(tryip, _port), _ssl);
            }
            else
            {
                var ips = Dns.GetHostAddresses(_ip);
                if (ips.Length == 0) throw new Exception($"无法解析“{_ip}”");
                client = new RedisClient(_ip, _port, _ssl);
            }
            client.Connected += (s, o) =>
            {
                Connected(s, o);
                if (!string.IsNullOrEmpty(_clientname)) client.ClientSetName(_clientname);
            };
            return client;
        }

19 View Source File : RedisSentinelClient.cs
License : MIT License
Project Creator : 2881099

void OnConnectionReconnected(object sender, EventArgs args)
        {
            if (Reconnected != null)
                Reconnected(this, args);
        }

19 View Source File : RedisSentinelManager.cs
License : MIT License
Project Creator : 2881099

void OnConnectionConnected(object sender, EventArgs args)
        {
            if (Connected != null)
                Connected(this, new EventArgs());
        }

19 View Source File : DefaultRedisSocket.cs
License : MIT License
Project Creator : 2881099

public void Connect()
        {
            lock (_connectLock)
            {
                ResetHost(Host);

                IPEndPoint endpoint = IPAddress.TryParse(_ip, out var tryip) ?
                    new IPEndPoint(tryip, _port) :
                    new IPEndPoint(Dns.GetHostAddresses(_ip).FirstOrDefault() ?? IPAddress.Parse(_ip), _port);
                var localSocket = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp);

                var asyncResult = localSocket.BeginConnect(endpoint, null, null);
                if (!asyncResult.AsyncWaitHandle.WaitOne(ConnectTimeout, true))
                    throw new TimeoutException("Connect to redis-server timeout");
                _socket = localSocket;
                _stream = new NetworkStream(Socket, true);
                _socket.ReceiveTimeout = (int)ReceiveTimeout.TotalMilliseconds;
                _socket.SendTimeout = (int)SendTimeout.TotalMilliseconds;
                Connected?.Invoke(this, new EventArgs());
            }
        }

19 View Source File : Utility.Http.cs
License : MIT License
Project Creator : 7Bytes-Studio

public void StartDownload()
                {
                    try
                    {
                        HttpWebRequest httpWebRequest = (HttpWebRequest)HttpWebRequest.Create(m_HttpDownloadInfo.Url);

                        if (0L < m_Position)
                        {
                            httpWebRequest.AddRange((int)m_Position);
                        }

                        WebResponse webResponse = httpWebRequest.GetResponse();
                        Stream webResponseStream = webResponse.GetResponseStream();

                        float progress = 0f;
                        long currentSize = m_Position;
                        long totalSize = m_Position + webResponse.ContentLength;

                        byte[] btContent = new byte[m_HttpDownloadInfo.DownloadBufferUnit];
                        int readSize = 0;
                        while (!m_Hreplacedtop && 0 < (readSize = webResponseStream.Read(btContent, 0, m_HttpDownloadInfo.DownloadBufferUnit)))
                        {
                            progress = (float)(currentSize += readSize) / totalSize;
                            if (null != OnDownloadProgress)
                            {
                                OnDownloadProgress.Invoke(this, new HttpDownloaderProgressEventArgs(progress));
                            }
                            m_FileStream.Flush();
                            m_FileStream.Write(btContent, 0, readSize);

                            System.Threading.Thread.Sleep(10);

                        }
                        m_FileStream.Close();
                        webResponseStream.Close();

                        if (!m_Hreplacedtop)
                        {
                            ReNameTempFile();

                            if (null != OnDownloadSuccess)
                            {
                                OnDownloadSuccess.Invoke(this, EventArgs.Empty);
                            }
                        }
                    }
                    catch (Exception ex)
                    {
                        if (null != OnDownloadFailure)
                        {
                            OnDownloadFailure.Invoke(this,new HttpDownloaderFailureEventArgs(ex));
                        }
                        throw ex;
                    }
                }

19 View Source File : Utility.Http.cs
License : MIT License
Project Creator : 7Bytes-Studio

public void Start()
                {
                    if (IsWorking) return;

                    try
                    {
                        m_HttpListener = new HttpListener();
                        //监听的路径
                        m_HttpListener.Prefixes.Add(Address + "/");
                        for (int i = 0; i < Prefixes.Length; i++)
                        {
                            m_HttpListener.Prefixes.Add(Prefixes[i]);
                        }
                        //设置匿名访问
                        m_HttpListener.AuthenticationSchemes = AuthenticationSchemes.Anonymous;
                        m_HttpListener.Start();

                        if (null != m_HttpServerInfo.OnStartSucceed)
                        {
                            m_HttpServerInfo.OnStartSucceed.Invoke(this, EventArgs.Empty);
                        }

                        IsWorking = true;



                        while (IsWorking)
                        {
                            var context = m_HttpListener.GetContext();
                            HttpListenerRequest request = context.Request;
                            HttpListenerResponse response = context.Response;
                            response.ContentEncoding = Encoding.UTF8;
                            response.AddHeader("Access-Control-Allow-Origin", "*"); //允许跨域请求。

                            byte[] handleContent = null;
                            if (request.HttpMethod == "GET")
                            {
                                if (null != m_HttpServerInfo.GetHandler)
                                {
                                    handleContent = m_HttpServerInfo.GetHandler.Invoke(request);
                                }

                            }
                            else if (request.HttpMethod == "POST")
                            {
                                if (null != m_HttpServerInfo.PostHandler)
                                {
                                    handleContent = m_HttpServerInfo.PostHandler.Invoke(request);
                                }
                            }
                            else
                            {
                                if (null != m_HttpServerInfo.DefaultHandler)
                                {
                                    handleContent = m_HttpServerInfo.DefaultHandler.Invoke(request);
                                }
                            }

                            if (null!= m_HttpServerInfo.OnBeforeResponse)
                            {
                                m_HttpServerInfo.OnBeforeResponse.Invoke(response);
                            }

                            response.ContentLength64 = handleContent.Length;
                            Stream output = response.OutputStream;
                            output.Write(handleContent, 0, handleContent.Length);
                            output.Close();
                        }

                        m_HttpListener.Close();
                        m_HttpListener.Abort();
                    }
                    catch (Exception ex)
                    {
                        IsWorking = false;
                        if (null != m_HttpServerInfo.OnStartFailure)
                        {
                            m_HttpServerInfo.OnStartFailure.Invoke(this,new StartFailureEventArgs(ex));
                        }
                    }








                }

19 View Source File : Event.Subscriber.partial.cs
License : MIT License
Project Creator : 7Bytes-Studio

internal void OnReceived(EventTopic eventTopic)
            {
                if (null!= EventHandler)
                {
                    EventHandler.Invoke(eventTopic.Publisher.Target,eventTopic.Content);
                }
            }

19 View Source File : SettingsManager.cs
License : MIT License
Project Creator : a1xd

public void OnDeviceChangeMessage()
        {
            SystemDevices = MultiHandleDevice.GetList();
            SetActiveHandles();

            DeviceChangeField?.Invoke(this, EventArgs.Empty);
        }

19 View Source File : BTCChinaWebSocketApi.cs
License : MIT License
Project Creator : aabiryukov

public void Start()
		{
			if(m_webSocket != null)
				return;

			const string httpScheme = "https://";
			const string wsScheme = "wss://";
			const string webSocketUrl = "websocket.btcc.com/socket.io/";

			#region handshake

			string polling;
			using (var wc = new HttpClient())
			{
				polling = wc.GetStringAsync(httpScheme + webSocketUrl + "?transport=polling").Result;
				if (string.IsNullOrEmpty(polling))
				{
					throw new BTCChinaException("BtcChinaWebSocketApi.Start", "", "failed to download config");
				}
			}

			var config = polling.Substring(polling.IndexOf('{'), polling.IndexOf('}') - polling.IndexOf('{') + 1);
			var wsc = JsonConvert.DeserializeObject<WsConfigHelper>(config);

			#endregion handshake

			//set timers
			m_pingTimeoutTimer = new Timer(_ =>
			{
				if (m_pong)
				{
					m_pong = false; //waiting for another ping
				}
				else
				{
					Log.Error("[BtcChina] Ping Timeout!");
					if (TimeoutReceived != null)
					{
						TimeoutReceived(this, new EventArgs());
					}
				}
			}, null, Timeout.Infinite, Timeout.Infinite);

			m_pingIntervalTimer = new Timer(_ =>
			{
				m_webSocket.Send(string.Format(CultureInfo.InvariantCulture, "{0}", (int)EngineioMessageType.PING));
				m_pingTimeoutTimer.Change(wsc.PingTimeout, Timeout.Infinite);
				m_pong = false;
			}, null, wsc.PingInterval, wsc.PingInterval);

			//setup websocket connections and events
			m_webSocket = new WebSocket(wsScheme + webSocketUrl + "?transport=websocket&sid=" + wsc.Sid);
			m_webSocket.Opened += btc_Opened;
			m_webSocket.Error += btc_Error;
			m_webSocket.MessageReceived += btc_MessageReceived;
			m_webSocket.DataReceived += btc_DataReceived;
			m_webSocket.Closed += btc_Closed;

			Log.Info("[BtcChina] Opening websockets...");
			m_webSocket.Open();
		}

19 View Source File : WaitMessageForm.cs
License : MIT License
Project Creator : aabiryukov

private void cancelButton_Click(object sender, EventArgs e)
        {
            cancelButton.Text = "Canceling...";
            cancelButton.Enabled = false;

            if (m_onCancel != null)
            {
                m_onCancel(sender, e);
            }
        }

19 View Source File : WebSocketApi.cs
License : MIT License
Project Creator : aabiryukov

public void Start()
		{
			if(m_webSocket != null)
				return;

			const string webSocketUrl = "wss://real.okcoin.com:10440/websocket/okcoinapi";

			//set timers
			m_pingTimeoutTimer = new Timer(_ =>
			{
				if (m_pong)
				{
					m_pong = false; //waiting for another ping
				}
				else
				{
					Log.Error("[Huobi] Ping Timeout!");
					if (TimeoutReceived != null)
					{
						TimeoutReceived(this, new EventArgs());
					}
				}
			}, null, Timeout.Infinite, Timeout.Infinite);

			m_pingIntervalTimer = new Timer(_ =>
			{
				m_webSocket.Send("{'event':'ping'}");
				m_pingTimeoutTimer.Change(PingTimeout, Timeout.Infinite);
				m_pong = false;
			}, null, PingInterval, PingInterval);

			//setup websocket connections and events
			m_webSocket = new WebSocket(webSocketUrl);
			m_webSocket.Opened += btc_Opened;
			m_webSocket.Error += btc_Error;
			m_webSocket.MessageReceived += btc_MessageReceived;
			m_webSocket.DataReceived += btc_DataReceived;
			m_webSocket.Closed += btc_Closed;

			Log.Info("[Huobi] Opening websockets...");
			m_webSocket.Open();
		}

19 View Source File : WebSocketApi.cs
License : MIT License
Project Creator : aabiryukov

public void Start()
		{
			if(m_webSocket != null)
				return;

			const string webSocketUrl = "wss://real.okcoin.com:10440/websocket/okcoinapi";

			//set timers
			m_pingTimeoutTimer = new Timer(_ =>
			{
				if (m_pong)
				{
					m_pong = false; //waiting for another ping
				}
				else
				{
					Log.Error("[OKCoin] Ping Timeout!");
					if (TimeoutReceived != null)
					{
						TimeoutReceived(this, new EventArgs());
					}
				}
			}, null, Timeout.Infinite, Timeout.Infinite);

			m_pingIntervalTimer = new Timer(_ =>
			{
				m_webSocket.Send("{'event':'ping'}");
				m_pingTimeoutTimer.Change(PingTimeout, Timeout.Infinite);
				m_pong = false;
			}, null, PingInterval, PingInterval);

			//setup websocket connections and events
			m_webSocket = new WebSocket(webSocketUrl);
			m_webSocket.Opened += btc_Opened;
			m_webSocket.Error += btc_Error;
			m_webSocket.MessageReceived += btc_MessageReceived;
			m_webSocket.DataReceived += btc_DataReceived;
			m_webSocket.Closed += btc_Closed;

			Log.Info("[OKCoin] Opening websockets...");
			m_webSocket.Open();
		}

19 View Source File : DataBaseManager.cs
License : MIT License
Project Creator : Abdesol

public void PropertyChanged()
        {
            var lst = new ObservableCollection<CodeBoxModel>();
            foreach (var code in AllCodes)
            {
                if (code.isFav) lst.Add(code);
            }
            FavCodes = lst;

            AllCodesUpdated?.Invoke(this, EventArgs.Empty);
            FavCodesUpdated?.Invoke(this, EventArgs.Empty);
        }

19 View Source File : DataBaseManager.cs
License : MIT License
Project Creator : Abdesol

public void PropertyChanged()
        {
            var lst = new ObservableCollection<CodeBoxModel>();
            foreach (var code in AllCodes)
            {
                if (code.IsFav) lst.Add(code);
            }
            FavCodes = lst;

            AllCodesUpdated?.Invoke(this, EventArgs.Empty);
            FavCodesUpdated?.Invoke(this, EventArgs.Empty);
        }

19 View Source File : CompletionList.cs
License : MIT License
Project Creator : Abdesol

public void RequestInsertion(EventArgs e)
		{
			if (InsertionRequested != null)
				InsertionRequested(this, e);
		}

19 View Source File : TextDocument.cs
License : MIT License
Project Creator : Abdesol

public void BeginUpdate()
		{
			VerifyAccess();
			if (inDoreplacedentChanging)
				throw new InvalidOperationException("Cannot change doreplacedent within another doreplacedent change.");
			beginUpdateCount++;
			if (beginUpdateCount == 1) {
				undoStack.StartUndoGroup();
				if (UpdateStarted != null)
					UpdateStarted(this, EventArgs.Empty);
			}
		}

19 View Source File : TextDocument.cs
License : MIT License
Project Creator : Abdesol

public void EndUpdate()
		{
			VerifyAccess();
			if (inDoreplacedentChanging)
				throw new InvalidOperationException("Cannot end update within doreplacedent change.");
			if (beginUpdateCount == 0)
				throw new InvalidOperationException("No update is active.");
			if (beginUpdateCount == 1) {
				// fire change events inside the change group - event handlers might add additional
				// doreplacedent changes to the change group
				FireChangeEvents();
				undoStack.EndUndoGroup();
				beginUpdateCount = 0;
				if (UpdateFinished != null)
					UpdateFinished(this, EventArgs.Empty);
			} else {
				beginUpdateCount -= 1;
			}
		}

19 View Source File : TextDocument.cs
License : MIT License
Project Creator : Abdesol

internal void FireChangeEvents()
		{
			// it may be necessary to fire the event multiple times if the doreplacedent is changed
			// from inside the event handlers
			while (fireTextChanged) {
				fireTextChanged = false;
				if (TextChanged != null)
					TextChanged(this, EventArgs.Empty);
				OnPropertyChanged("Text");

				int textLength = rope.Length;
				if (textLength != oldTextLength) {
					oldTextLength = textLength;
					OnPropertyChanged("TextLength");
				}
				int lineCount = lineTree.LineCount;
				if (lineCount != oldLineCount) {
					oldLineCount = lineCount;
					OnPropertyChanged("LineCount");
				}
			}
		}

19 View Source File : TextDocument.cs
License : MIT License
Project Creator : Abdesol

void OnFileNameChanged(EventArgs e)
		{
			EventHandler handler = this.FileNameChanged;
			if (handler != null)
				handler(this, e);
		}

19 View Source File : Caret.cs
License : MIT License
Project Creator : Abdesol

void RaisePositionChanged()
		{
			if (textArea.Doreplacedent != null && textArea.Doreplacedent.IsInUpdate) {
				raisePositionChangedOnUpdateFinished = true;
			} else {
				if (PositionChanged != null) {
					PositionChanged(this, EventArgs.Empty);
				}
			}
		}

19 View Source File : Caret.cs
License : MIT License
Project Creator : Abdesol

internal void OnDoreplacedentUpdateFinished()
		{
			if (raisePositionChangedOnUpdateFinished) {
				if (PositionChanged != null) {
					PositionChanged(this, EventArgs.Empty);
				}
			}
		}

19 View Source File : InsertionContext.cs
License : MIT License
Project Creator : Abdesol

[System.Diagnostics.Codereplacedysis.SuppressMessage("Microsoft.Design", "CA1030:UseEventsWhereAppropriate",
														 Justification = "There is an event and this method is raising it.")]
		public void RaiseInsertionCompleted(EventArgs e)
		{
			if (currentStatus != Status.Insertion)
				throw new InvalidOperationException();
			if (e == null)
				e = EventArgs.Empty;

			currentStatus = Status.RaisingInsertionCompleted;
			int endPosition = this.InsertionPosition;
			this.wholeSnippetAnchor = new AnchorSegment(Doreplacedent, startPosition, endPosition - startPosition);
			TextDoreplacedentWeakEventManager.UpdateFinished.AddListener(Doreplacedent, this);
			deactivateIfSnippetEmpty = (endPosition != startPosition);

			foreach (IActiveElement element in registeredElements) {
				element.OnInsertionCompleted();
			}
			if (InsertionCompleted != null)
				InsertionCompleted(this, e);
			currentStatus = Status.Interactive;
			if (registeredElements.Count == 0) {
				// deactivate immediately if there are no interactive elements
				Deactivate(new SnippetEventArgs(DeactivateReason.NoActiveElements));
			} else {
				myInputHandler = new SnippetInputHandler(this);
				// disable existing snippet input handlers - there can be only 1 active snippet
				foreach (TextAreaStackedInputHandler h in TextArea.StackedInputHandlers) {
					if (h is SnippetInputHandler)
						TextArea.PopStackedInputHandler(h);
				}
				TextArea.PushStackedInputHandler(myInputHandler);
			}
		}

19 View Source File : SnippetReplaceableTextElement.cs
License : MIT License
Project Creator : Abdesol

bool IWeakEventListener.ReceiveWeakEvent(Type managerType, object sender, EventArgs e)
		{
			if (managerType == typeof(TextDoreplacedentWeakEventManager.TextChanged)) {
				string newText = GetText();
				if (this.Text != newText) {
					this.Text = newText;
					if (TextChanged != null)
						TextChanged(this, e);
				}
				return true;
			}
			return false;
		}

19 View Source File : DelayedEvents.cs
License : MIT License
Project Creator : Abdesol

public void Call()
			{
				handler(sender, e);
			}

19 View Source File : TextEditor.cs
License : MIT License
Project Creator : Abdesol

protected virtual void OnDoreplacedentChanged(EventArgs e)
		{
			if (DoreplacedentChanged != null) {
				DoreplacedentChanged(this, e);
			}
		}

19 View Source File : TextEditor.cs
License : MIT License
Project Creator : Abdesol

protected virtual void OnTextChanged(EventArgs e)
		{
			if (TextChanged != null) {
				TextChanged(this, e);
			}
		}

19 View Source File : TextArea.cs
License : MIT License
Project Creator : Abdesol

void OnDoreplacedentChanged(TextDoreplacedent oldValue, TextDoreplacedent newValue)
		{
			if (oldValue != null) {
				TextDoreplacedentWeakEventManager.Changing.RemoveListener(oldValue, this);
				TextDoreplacedentWeakEventManager.Changed.RemoveListener(oldValue, this);
				TextDoreplacedentWeakEventManager.UpdateStarted.RemoveListener(oldValue, this);
				TextDoreplacedentWeakEventManager.UpdateFinished.RemoveListener(oldValue, this);
			}
			textView.Doreplacedent = newValue;
			if (newValue != null) {
				TextDoreplacedentWeakEventManager.Changing.AddListener(newValue, this);
				TextDoreplacedentWeakEventManager.Changed.AddListener(newValue, this);
				TextDoreplacedentWeakEventManager.UpdateStarted.AddListener(newValue, this);
				TextDoreplacedentWeakEventManager.UpdateFinished.AddListener(newValue, this);
			}
			// Reset caret location and selection: this is necessary because the caret/selection might be invalid
			// in the new doreplacedent (e.g. if new doreplacedent is shorter than the old doreplacedent).
			caret.Location = new TextLocation(1, 1);
			this.ClearSelection();
			if (DoreplacedentChanged != null)
				DoreplacedentChanged(this, EventArgs.Empty);
			CommandManager.InvalidateRequerySuggested();
		}

19 View Source File : NonNativeKeyboard.cs
License : Apache License 2.0
Project Creator : abist-co-ltd

public void PresentKeyboard()
        {
            ResetClosingTime();
            gameObject.SetActive(true);
            ActivateSpecificKeyboard(LayoutType.Alpha);

            OnPlacement(this, EventArgs.Empty);

            // todo: if the app is built for xaml, our prefab and the system keyboard may be displayed.
            InputField.ActivateInputField();

            SetMicrophoneDefault();
        }

19 View Source File : NonNativeKeyboard.cs
License : Apache License 2.0
Project Creator : abist-co-ltd

public void Previous()
        {
            OnPrevious(this, EventArgs.Empty);
        }

19 View Source File : NonNativeKeyboard.cs
License : Apache License 2.0
Project Creator : abist-co-ltd

public void Next()
        {
            OnNext(this, EventArgs.Empty);
        }

19 View Source File : NonNativeKeyboard.cs
License : Apache License 2.0
Project Creator : abist-co-ltd

public void Enter()
        {
            if (SubmitOnEnter)
            {
                // Send text entered event and close the keyboard
                if (OnTextSubmitted != null)
                {
                    OnTextSubmitted(this, EventArgs.Empty);
                }

                Close();
            }
            else
            {
                string enterString = "\n";

                m_CaretPosition = InputField.caretPosition;

                InputField.text = InputField.text.Insert(m_CaretPosition, enterString);
                m_CaretPosition += enterString.Length;

                UpdateCaretPosition(m_CaretPosition);
            }

        }

19 View Source File : NonNativeKeyboard.cs
License : Apache License 2.0
Project Creator : abist-co-ltd

public void Close()
        {
            if (IsMicrophoneActive())
            {
                dictationSystem.StopRecording();
            }
            SetMicrophoneDefault();
            OnClosed(this, EventArgs.Empty);
            gameObject.SetActive(false);
        }

19 View Source File : AudioDataAnalyzer.cs
License : MIT License
Project Creator : ABTSoftware

private void ProcessData(double[] input)
        {
            var offset = input.Length - _fftWindowSize;
            for (int i = 0; i < _fftWindowSize; i++)
            {
                Complex c = new Complex();
                c.X = (float)(input[offset + i] * FastFourierTransform.BlackmannHarrisWindow(i, _fftWindowSize));
                c.Y = 0;
                _fftInput[i] = c;
            }

            FastFourierTransform.FFT(true, _log2, _fftInput);

            ComputeDbValues(_fftInput, DbValues);

            Array.Copy(SpectrogramBuffer, FftDataPoints, SpectrogramBuffer, 0, (SpectrogramFrameCount - 1) * FftDataPoints);
            for (var i = 0; i < FftDataPoints; i++)
            {
                SpectrogramBuffer[SpectrogramFrameCount - 1, i] = DbValues[i];
            }

            Update?.Invoke(this, EventArgs.Empty);
        }

19 View Source File : AudioDeviceHandler.cs
License : MIT License
Project Creator : ABTSoftware

private void ProcessData()
        {
            while (!_token.IsCancellationRequested)
            {
                if (_processEvt.WaitOne(100))
                {
                    lock (_input)
                    {
                        Array.Copy(_input, _inputBack, _input.Length);
                    }
                    DataReceived?.Invoke(this, EventArgs.Empty);
                }
            }
        }

19 View Source File : AudioDeviceSource.cs
License : MIT License
Project Creator : ABTSoftware

private void RefreshDevices()
        {
            if (!_dispatcher.CheckAccess())
            {
                _dispatcher.BeginInvoke((Action)RefreshDevices);
                return;
            }
            DefaultDevice = GetDefaultDevice();

            var deviceMap = Devices.ToDictionary(d => d.ID, d => d);
            var presentDevices = new HashSet<string>();

            foreach (var d in _enumerator.EnumerateAudioEndPoints(DataFlow.Capture, DeviceState.Active))
            {
                presentDevices.Add(d.ID);
                if(deviceMap.TryGetValue(d.ID, out var device))
                {
                    device.Update(d);
                }
                else
                {
                    Devices.Add(new AudioDeviceInfo(d));
                }
                d.Dispose();
            }

            for (int i = Devices.Count - 1; i >=0; i--)
            {
                if (!presentDevices.Contains(Devices[i].ID))
                {
                    Devices.RemoveAt(i);
                }
            }

            DevicesChanged?.Invoke(this, EventArgs.Empty);
        }

19 View Source File : PropertyChangeNotifier.cs
License : MIT License
Project Creator : ABTSoftware

protected void OnPropertyChanged()
        {
            var handler = PropertyChanged;
            if (handler != null)
            {
                handler(_propertyTarget, EventArgs.Empty);
            }
        }

19 View Source File : Bootstrapper.cs
License : MIT License
Project Creator : ABTSoftware

public void OnInitComplete()
        {
            var handler = WhenInit;

            handler?.Invoke(this, EventArgs.Empty);
        }

19 View Source File : CollapsableGridSplitter.cs
License : MIT License
Project Creator : ABTSoftware

protected virtual void OnCollapsed(EventArgs e)
        {
            EventHandler<EventArgs> handler = this.Collapsed;
            if (handler != null)
            {
                handler(this, e);
            }
        }

19 View Source File : CollapsableGridSplitter.cs
License : MIT License
Project Creator : ABTSoftware

protected virtual void OnExpanded(EventArgs e)
        {
            EventHandler<EventArgs> handler = this.Expanded;
            if (handler != null)
            {
                handler(this, e);
            }
        }

19 View Source File : SyncUsageHelper.cs
License : MIT License
Project Creator : ABTSoftware

public void LoadFromIsolatedStorage()
        {
            using (IsolatedStorageFile isf = IsolatedStorageFile.GetStore(IsolatedStorageScope.User | IsolatedStorageScope.replacedembly, null, null))
            {
                if (isf.FileExists("Usage.xml"))
                {
                    try
                    {
                        using (var stream = new IsolatedStorageFileStream("Usage.xml", FileMode.Open, isf))
                        {
                            var usageXml = "";
                            using (StreamReader reader = new StreamReader(stream))
                            {
                                var encryptedUsage = reader.ReadToEnd();
                                try
                                {
                                    usageXml = _encryptionHelper.Decrypt(encryptedUsage);
                                }
                                catch
                                {
                                    // Old file contents will not decrypt due to encryption changes.  We don't care.
                                }
                            }

                            using (var textReader = new StringReader(usageXml))
                            {
                                var xDoreplacedent = XDoreplacedent.Load(textReader);

                                _usageCalculator.Usages = SerializationUtil.Deserialize(xDoreplacedent);
                                var userIdNode = xDoreplacedent.Root.Attributes("UserId").FirstOrDefault();
                                if (userIdNode != null)
                                {
                                    userId = userIdNode.Value;
                                }
                                var lastSentNode = xDoreplacedent.Root.Attributes("LastSent").FirstOrDefault();
                                if (lastSentNode != null)
                                {
                                    lastSent = DateTime.ParseExact(lastSentNode.Value, "o", null);
                                }
                                var enabledNode = xDoreplacedent.Root.Attributes("Enabled").FirstOrDefault();
                                if (enabledNode != null)
                                {
                                    _enabled = bool.Parse(enabledNode.Value);
                                }
                            }
                        }

                        EnabledChanged?.Invoke(this, EventArgs.Empty);
                    }
                    catch
                    {
                        // If something goes wrong, delete the local file
                        try { isf.DeleteFile("Usage.xml"); }
                        catch { }
                    }
                }
                else
                {
                    // Default on.
                    _enabled = true;
                    EnabledChanged?.Invoke(this, EventArgs.Empty);
                }
            }
        }

19 View Source File : ZoomExtentsModifierEx.cs
License : MIT License
Project Creator : ABTSoftware

private void OnVisibleRangeChanged(object sender, VisibleRangeChangedEventArgs e)
        {
            if (e.IsAnimating == false)
            {
                this.XAxis.VisibleRangeChanged -= OnVisibleRangeChanged;
                ZoomExtentsCompleted?.Invoke(this, EventArgs.Empty);
            }
        }

19 View Source File : CoverFlowControl.cs
License : MIT License
Project Creator : ABTSoftware

private void CoverFlowItemSelected(object sender, EventArgs e)
        {
            if (sender is CoverFlowItemControl item)
            {
                var index = _items.IndexOf(item);

                if (index >= 0)
                {
                    if (NextPrevSelectionOnly && Math.Abs(index - SelectedIndex) > 1)
                    {
                        return;
                    }

                    if (index != SelectedIndex)
                    {
                        IndexSelected(index, true);
                    }
                    else
                    {
                        var handler = SelectedItemClick;
                        handler?.Invoke(this, new CoverFlowEventArgs
                        {
                            Index = index,
                            Item = _items[index].Content,
                            MouseClick = false
                        });
                    }
                }
            }
        }

See More Examples