protected void OnStarted() { if (Started != null) { Started.Invoke(this); } }
public virtual void StartServer(int port) { Socket.Listen(port); IsRunning = true; if (Started != null) { Started.Invoke(); } if (LookForModules) { // Find modules var modules = LookInChildrenOnly ? GetComponentsInChildren <ServerModuleBehaviour>() : FindObjectsOfType <ServerModuleBehaviour>(); // Add modules foreach (var module in modules) { AddModule(module); } // Initialize modules InitializeModules(); } }
public void PlayPause(bool pause) { if (pause) { Stop(); } else { IsPlaying = true; startSample = GetSampleTime(); currentBlock = StartBlock; if (backingTrackPlayers != null) { foreach (AudioSource player in backingTrackPlayers) { player.Play(); player.time = (float)(StartBlock * GetBlockTimeLength()); } } Started.Invoke(); if (playbackStartedEvent != null) { playbackStartedEvent.Invoke(); } AdvanceBlock(); } }
internal void OnStarted(object sender, ListingProgressArgs args) { if (Started != null) { Started.Invoke(sender, args); } }
protected virtual void OnStarted(EventArgs e) { if (Started != null) { Started.Invoke(this, e); } }
public void Start() { foreach (Transport t in transports) { t.Connected.AddListener(c => Connected.Invoke(c)); t.Started.AddListener(() => Started.Invoke()); } }
static void server_ServerStarted(object sender, EventArgs e) { OnDebug("Started"); if (Started != null) { Started.Invoke(sender, new EventArgs()); } }
// Use this for initialization void Start() { _isStarted = true; if (Started != null) { Started.Invoke(); } }
protected void DoStart() { if (!hasStarted) { Started.Invoke(); } hasStarted = true; }
public override void Run() { new Thread(() => { Thread.Sleep(5000); base.Run(); Started.Invoke(this, EventArgs.Empty); }).Start(); }
private void StartButtonClicked() { var vm = (InitialSetupViewModel)DataContext; vm.SaveNotesDirectory(); Started.Invoke(this, null); Close(); }
public CoroutineBasedTimer Start(float duration) { Abort(); current = target.StartCoroutine(GetTimer(duration)); if (Started != null) { Started.Invoke(); } return(this); }
internal void OnStarted(object sender, TransferFileProgressArgs args) { AddActiveTransfer(args.FilePath, args); if (Started != null) { Started.Invoke(sender, args); } if (Monitor != null) { Monitor.TransferStarted(this, args); } }
/// <summary> /// Called when the context starts running for the first time. /// </summary> public void startup() { if (Started != null) { Started.Invoke(this); } foreach (MvcModel model in models) { modelMemory.add(model.Name, model); } if (!String.IsNullOrEmpty(StartupAction)) { runAction(StartupAction); } focus(); }
public void Start() { if (IsRunning) { throw new Exception("Kcptun running"); } if (_server == null) { throw new Exception("No Server"); } try { Configuration config = controller.ConfigController.GetCurrentConfiguration(); string filename = GetKCPTunPath(); Console.WriteLine($"kcptun client: {filename}"); MyProcess p = new MyProcess(_server); p.StartInfo.FileName = filename; p.StartInfo.Arguments = BuildArguments(config.snmp, _server, localaddr, remoteaddr); p.StartInfo.WorkingDirectory = Utils.GetTempPath(); p.StartInfo.WindowStyle = ProcessWindowStyle.Hidden; p.StartInfo.UseShellExecute = false; p.StartInfo.CreateNoWindow = true; p.StartInfo.RedirectStandardError = true; p.StartInfo.RedirectStandardOutput = true; p.ErrorDataReceived += OnProcessErrorDataReceived; p.OutputDataReceived += OnProcessOutputDataReceived; p.Exited += OnProcessExited; p.EnableRaisingEvents = true; p.Start(); _process = p; p.BeginOutputReadLine(); p.BeginErrorReadLine(); Console.WriteLine("kcptun client started - " + p.server.FriendlyName()); if (Started != null) { Started.Invoke(this, new EventArgs()); } } catch (Exception e) { Logging.LogUsefulException(e); } }
/// <summary> /// Starts timing. /// </summary> /// <exception cref="ObjectDisposedException"><c>UniSharper.Timers.Timer</c> is disposed.</exception> public void Start() { if (disposed) { throw new ObjectDisposedException(GetType().FullName); } if (TimerState != TimerState.Running) { TimerState = TimerState.Running; if (Started != null) { Started.Invoke(this, EventArgs.Empty); } } }
private static void StartThreadStart() { if (ServiceHelper.StartTaskManagerAccessService(10000)) { if (Started != null) { Started.Invoke(null, new EventArgs()); } } else { if (StartFailed != null) { StartFailed.Invoke(null, new EventArgs()); } } }
/// <summary> /// Open up the port and listen for connections /// Use in servers. /// </summary> /// <exception>If we cannot start the transport</exception> /// <returns></returns> public override UniTask ListenAsync() { try { socket = new Socket(AddressFamily.InterNetworkV6, SocketType.Dgram, ProtocolType.Udp) { DualMode = true }; socket.Bind(new IPEndPoint(IPAddress.IPv6Any, Port)); // transport started Started.Invoke(); ListenCompletionSource = AutoResetUniTaskCompletionSource.Create(); return(ListenCompletionSource.Task); } catch (Exception ex) { return(UniTask.FromException(ex)); } }
public override UniTask ListenAsync() { if (Application.platform == RuntimePlatform.WebGLPlayer) { throw new PlatformNotSupportedException("Server mode is not supported in webgl"); } if (string.IsNullOrEmpty(CertificateName)) { server = new WebSocketServer(null); } else { // try loading the certificate X509Certificate2 certificate; string passphrase = GetPassphrase(); if (passphrase == null) { certificate = new X509Certificate2(CertificateName); } else { certificate = new X509Certificate2(CertificateName, passphrase); } server = new WebSocketServer(certificate); } server.Connected.AddListener(c => Connected.Invoke(c)); server.Started.AddListener(() => Started.Invoke()); return(server.Listen(Port)); }
public void InformStart() { Started?.Invoke(); }
private void Start_Click(object sender, EventArgs e) { Started.Invoke(sender, e); }
private void StartAppCenter() { if (Settings == null) { Debug.LogError("App Center isn't configured!"); return; } var services = Settings.Services; PrepareEventHandlers(services); InvokeInitializingServices(); AppCenter.SetWrapperSdk(); AppCenter.CacheStorageSize(Settings.MaxStorageSize.Size); if (Settings.CustomLogUrl.UseCustomUrl) { AppCenter.CacheLogUrl(Settings.CustomLogUrl.Url); } var appSecret = AppCenter.ParseAndSaveSecretForPlatform(Settings.AppSecret); var advancedSettings = GetComponent <AppCenterBehaviorAdvanced>(); if (IsStartFromAppCenterBehavior(advancedSettings)) { AppCenter.LogLevel = Settings.InitialLogLevel; if (Settings.CustomLogUrl.UseCustomUrl) { AppCenter.SetLogUrl(Settings.CustomLogUrl.Url); } if (Settings.MaxStorageSize.UseCustomMaxStorageSize && Settings.MaxStorageSize.Size > 0) { AppCenterInternal.SetMaxStorageSize(Settings.MaxStorageSize.Size); } var startupType = GetStartupType(advancedSettings); if (startupType != StartupType.Skip) { var transmissionTargetToken = GetTransmissionTargetToken(advancedSettings); var appSecretString = GetAppSecretString(appSecret, transmissionTargetToken, startupType); if (string.IsNullOrEmpty(appSecretString)) { AppCenterInternal.Start(services); } else { AppCenterInternal.Start(appSecretString, services); } } } #if UNITY_IOS || UNITY_ANDROID else { foreach (var service in services) { #if UNITY_IOS || UNITY_ANDROID // On iOS and Android we start crash service here, to give app an opportunity to assign handlers after crash and restart in Awake method var startCrashes = service.GetMethod("StartCrashes"); if (startCrashes != null) { startCrashes.Invoke(null, null); } #endif } } #endif InvokeInitializedServices(); if (Started != null) { Started.Invoke(); } }
protected virtual Task StartAsync() { Started?.Invoke(this); return(Task.CompletedTask); }
/// <summary> /// Everything si initilized and run here. /// Blocks till main window closes. /// </summary> private void run() { Logger.Log("Starting the MainController", Logger.LogLevel.debug); if (Arguments.AllArguments == null || Arguments.AllArguments.Count == 0) { Logger.Log("No command line arguments given, showing startup page", Logger.LogLevel.debug); Arguments.ParseConfigArgs(new string[] { "--url=ScChrom://internal/startup" }); } // prepare to cleanup Closed += () => { Started = null; WrittenOut = null; ErrorOut = null; }; WrittenOut += (text) => { Console.WriteLine(text); }; ErrorOut += (text) => { Console.Error.WriteLine(text); }; //For Windows 7 and above, best to include relevant app.manifest entries as well Cef.EnableHighDPISupport(); int max_runtime = Arguments.GetArgumentInt("max-runtime", 0); if (max_runtime > 0) { Task.Run(() => { System.Threading.ManualResetEvent waiting = new System.Threading.ManualResetEvent(false); Action handlePriorClosing = () => { waiting.Set(); }; Closed += handlePriorClosing; if (!waiting.WaitOne(1000 * max_runtime)) { Closed -= handlePriorClosing; Application.Exit(); } else { Logger.Log("Prevented closing due to max-runtime", Logger.LogLevel.debug); } }); } if (!Cef.IsInitialized) { var settings = new CefSettings() { // the positiv value enables uncaught exception UncaughtExceptionStackSize = 10 }; string backgroundColor = Arguments.GetArgument("background-color", "").Trim(); if (!string.IsNullOrWhiteSpace(backgroundColor)) { try { settings.BackgroundColor = Convert.ToUInt32(backgroundColor, 16); } catch (Exception) { Logger.Log("Ignored invalid color code given for attribute initial-background-color.", Logger.LogLevel.error); } } var scchromOptions = CefSharp.Enums.SchemeOptions.Secure | CefSharp.Enums.SchemeOptions.FetchEnabled | CefSharp.Enums.SchemeOptions.CspBypassing | CefSharp.Enums.SchemeOptions.CorsEnabled; settings.RegisterScheme(new CefCustomScheme("scchrom", scchromOptions)); string remoteDebuggingPort = Arguments.GetArgument("remote-debugging-port", "").Trim(); if (!string.IsNullOrWhiteSpace(remoteDebuggingPort)) { int port = 0; if (int.TryParse(remoteDebuggingPort, out port)) { settings.RemoteDebuggingPort = port; } else { Logger.Log("Ignored invalid number given for attribute remote-debugging-port: " + port, Logger.LogLevel.error); } } string useragent = Arguments.GetArgument("useragent", "").Trim(); if (!string.IsNullOrWhiteSpace(useragent)) { settings.UserAgent = useragent; } string cachePath = Arguments.GetArgument("cache-path", "false").Trim(); if (cachePath != "false") { string fullPath = null; try { if (cachePath.Contains("%configfile_dir%")) { if (Arguments.ConfigfileDirectory == null) { cachePath = cachePath.Replace("%configfile_dir%", Environment.CurrentDirectory); } else { cachePath = cachePath.Replace("%configfile_dir%", Arguments.ConfigfileDirectory); } } fullPath = Path.GetFullPath(cachePath); } catch (Exception ex) { // path not valid Program.ExitWithError((int)Program.Exitcode.InvalidCachePath, "Invalid cache-path given (" + cachePath + "), error was: " + ex.Message, true); } cachePath = Environment.ExpandEnvironmentVariables(cachePath); if (!Path.IsPathRooted(cachePath)) { cachePath = Path.Combine(Path.GetDirectoryName(Process.GetCurrentProcess().MainModule.FileName), cachePath); } settings.CachePath = cachePath; } else { // disable creation of the gpu cache settings.CefCommandLineArgs.Add("disable-gpu-shader-disk-cache", "1"); } // prevent interference with default command line args for cef settings.CommandLineArgsDisabled = true; if (Arguments.GetArgument("webrtc-media-enabled", "false") == "true") { settings.CefCommandLineArgs.Add("enable-media-stream", "1"); } // necessary to enable some special features for the scchrom 'protocol' settings.RegisterScheme(new CefCustomScheme("scchrom", CefSharp.Enums.SchemeOptions.Standard | CefSharp.Enums.SchemeOptions.CorsEnabled | CefSharp.Enums.SchemeOptions.FetchEnabled)); string proxy_settings = Arguments.GetArgument("proxy-settings"); if (proxy_settings != null) { var parts = proxy_settings.Split('|'); string proxy_ip = "", proxy_port = "", proxy_username = "", proxy_password = "", proxy_ignoreList = ""; if (parts.Length > 0) { proxy_ip = parts[0]; if (parts.Length > 1) { proxy_port = parts[1]; } if (parts.Length > 2) { proxy_username = parts[2]; } if (parts.Length > 3) { proxy_password = parts[3]; } if (parts.Length > 4) { proxy_ignoreList = parts[4]; } Logger.Log("Applying following proxy settings: Ip: " + proxy_ip + " Port: " + proxy_port + " username: "******" ignorelist: " + proxy_ignoreList, Logger.LogLevel.debug); CefSharpSettings.Proxy = new ProxyOptions(proxy_ip, proxy_password, proxy_username, proxy_password, proxy_ignoreList); // The previous setting alone might not work, so also add it to the command line arguments settings.CefCommandLineArgs.Add("proxy-server", proxy_ip + ":" + proxy_port); } else { Logger.Log("Ignored invalid value for parameter proxy-settings", Logger.LogLevel.info); } } handleHostResolverRules(Arguments.GetArgument("host-resolver-rules"), ref settings); // Perform dependency check to make sure all relevant resources are in our output directory Cef.Initialize(settings, performDependencyCheck: true, browserProcessHandler: null); } setupSchemes(); BrowserJsController = new BrowserJsController(Arguments.GetArgument("browser-js-allow_objects", "false")); var mainWindow = new BrowserForm(); WindowInstance = mainWindow; if (Started != null) { Started.Invoke(); } if (Program.OnlyCheck) { mainWindow.WindowState = FormWindowState.Minimized; mainWindow.ShowInTaskbar = false; Task.Run(() => { System.Threading.Thread.Sleep(1000); mainWindow.Invoke(new Action(() => { mainWindow.Close(); })); }); } mainWindow.ShowDialog(); }
public override UniTask ListenAsync() { Started.Invoke(); listenCompletionSource = new UniTaskCompletionSource(); return(listenCompletionSource.Task); }
private void Start() { Started.Invoke(this, null); }
public virtual void OnDialogueStarted() { Started?.Invoke(this, EventArgs.Empty); }
private void ProcessEvent() { while (m_Session != null) { try { m_Session.GetEvent(1, out IMFMediaEvent _event);//requests events and returns immediately _event.GetType(out MediaEventType eventtype); switch (eventtype) { case MediaEventType.MESessionEnded: State = PlaybackState.Stopped; Ended?.Invoke(this, new StoppedEventArgs()); break; case MediaEventType.MESessionPaused: Paused?.Invoke(this, new PausedEventArgs(GetPosition())); break; case MediaEventType.MESessionStopped: Stopped?.Invoke(this, new StoppedEventArgs()); break; case MediaEventType.MESessionStarted: Started.Invoke(this, new EventArgs()); break; case MediaEventType.MESessionTopologyStatus: //topology loaded Guid guidManager = typeof(IAudioSessionManager).GUID; (new MMDeviceEnumeratorComObject() as IMMDeviceEnumerator). GetDefaultAudioEndpoint(CoreAudioApi.DataFlow.Render, CoreAudioApi.Role.Multimedia, out IMMDevice endoint); endoint.Activate(ref guidManager, ClsCtx.ALL, IntPtr.Zero, out object _manager); IAudioSessionManager manager = _manager as IAudioSessionManager; manager.GetSimpleAudioVolume(Guid.Empty, 0, out m_Volume); m_Session.GetClock(out m_Clock); Guid guid_ratecontrol = typeof(IMFRateControl).GUID; Guid MF_RATE_CONTROL_SERVICE = Guid.Parse("866fa297-b802-4bf8-9dc9-5e3b6a9f53c9"); MediaFoundationInterop.MFGetService(m_Session, ref MF_RATE_CONTROL_SERVICE, ref guid_ratecontrol, out object _control); //gets rate control m_Rate = _control as IMFRateControl; IsPrepared = true; Prepared?.Invoke(this, new EventArgs()); break; } _event = null; } catch (COMException e) { if (e.HResult == MediaFoundationErrors.MF_E_NO_EVENTS_AVAILABLE) { continue; } else { throw e; } } catch (ThreadAbortException) { break; } } }
// // Start the driver service // public void Start(string processPath, string arguments) { if (!File.Exists(processPath)) { throw new FileNotFoundException(processPath + " not found!"); } // Try to start the driver try { // Create process start info ProcessStartInfo startInfo = new ProcessStartInfo { FileName = processPath, Arguments = arguments, UseShellExecute = false, RedirectStandardOutput = true, RedirectStandardError = true, RedirectStandardInput = true, CreateNoWindow = true, WindowStyle = ProcessWindowStyle.Normal }; // Create process processService = new Process { StartInfo = startInfo }; processService.OutputDataReceived += ProcessService_OutputDataReceived; processService.ErrorDataReceived += ProcessService_ErrorDataReceived; processService.Exited += ProcessService_Exited; processService.Disposed += ProcessService_Disposed; // Start process if (processService.Start()) { processService.BeginOutputReadLine(); // Set process priority try { processService.PriorityClass = ProcessPriorityClass.High; } catch (Exception) { } running = true; timerWatchdog.Start(); Started?.Invoke(this, new EventArgs()); } // Start failed else { throw new Exception("Can't start the driver service!"); } } // Start failed catch (Exception e) { throw e; } }
protected virtual void OnStarted() { Started?.Invoke(this, EventArgs.Empty); }