/// <summary> /// Videoes the camera_ initialized. /// </summary> /// <param name="sender">The sender.</param> /// <param name="eventArgs">The event args.</param> private void VideoCamera_Initialized(object sender, object eventArgs) { if (Initialized != null) { Initialized.Invoke(this, new EventArgs()); } }
public override bool OnInit() { coreConfig = new CoreConfig(startup.Name); //Create the log. logListener = new LogFileListener(); logListener.openLogFile(CoreConfig.LogFile); Log.Default.addLogListener(logListener); Log.ImportantInfo("Running from directory {0}", FolderFinder.ExecutableFolder); startup.ConfigureServices(services); BuildPluginManager(); //Create containers var scope = this.pluginManager.GlobalScope; //Build engine var pluginManager = scope.ServiceProvider.GetRequiredService <PluginManager>(); mainTimer = scope.ServiceProvider.GetRequiredService <UpdateTimer>(); var frameClearManager = scope.ServiceProvider.GetRequiredService <FrameClearManager>(); PerformanceMonitor.setupEnabledState(scope.ServiceProvider.GetRequiredService <SystemTimer>()); MyGUIInterface.Instance.CommonResourceGroup.addResource(GetType().AssemblyQualifiedName, "EmbeddedScalableResource", true); MyGUIInterface.Instance.CommonResourceGroup.addResource(startup.GetType().AssemblyQualifiedName, "EmbeddedScalableResource", true); startup.Initialized(this, pluginManager); if (Initialized != null) { Initialized.Invoke(this); } return(true); }
protected internal virtual void OnInitialized(ServiceContainer i_Container) { if (Initialized != null) { Initialized.Invoke(this, i_Container); } }
public static Task <bool> WindowInitialized(int width, int height) { Initialized.Invoke(null, new Rectangle() { Height = height, Width = width }); return(Task.FromResult(true)); }
private async Task OnInitialized(object source, ClassInitializedEventArgs args) { if (Initialized == null) { return; } await Initialized.Invoke(source, args); }
private async Task OnInitialized(object source, EventArgs e) { if (Initialized == null) { return; } await Initialized.Invoke(source, e); }
public SubordinateViewModel(IScreen screen) { UrlPathSegment = nameof(SubordinateViewModel); HostScreen = screen; SearchText = string.Empty; _networkServiceOfPersons ??= Locator.Current.GetService <INetworkService <Person> >(); #region Init Chat service _clientService ??= Locator.Current.GetService <IClientService>(); _clientService.MessageReceived += MessageReceived; #endregion #region Init SelectPersonCommand SelectPersonCommand = ReactiveCommand.Create <Person, bool>(FillVisitorBySelected); this.WhenAnyValue(x => x.SelectedPerson) .InvokeCommand(SelectPersonCommand); #endregion #region Init SearchPersonCommand var canSearch = this.WhenAnyValue(x => x.SearchText, query => !string.IsNullOrWhiteSpace(query)); SearchPersonCommand = ReactiveCommand.CreateFromTask <string, IEnumerable <Person> >( async query => await SearchPersons(query), canSearch); SearchPersonCommand.ThrownExceptions.Subscribe(error => ShowError(error)); _searchedPersons = SearchPersonCommand.ToProperty(this, x => x.Persons); this.WhenAnyValue(x => x.SearchText) .Throttle(TimeSpan.FromSeconds(1), RxApp.MainThreadScheduler) .InvokeCommand(SearchPersonCommand); #endregion #region Init ClearSearchPersonCommand var canClearSearch = this.WhenAnyValue(x => x.SearchText, query => !string.IsNullOrWhiteSpace(query) || Persons.Any()); ClearSearchPersonCommand = ReactiveCommand.CreateFromTask <Unit, bool>(ClearSearchPersons, canClearSearch); #endregion #region Init SendPersonCommand var canSendPerson = this.WhenAnyValue( x => x.Visitor, x => x.Visitor.Comment, x => x.Visitor.FirstName, x => x.Visitor.Message, x => x.Visitor.MiddleName, x => x.Visitor.Post, x => x.Visitor.SecondName, (person, _, __, ___, ____, _____, ______) => !person.IsNullOrEmpty()); SendVisitorCommand = ReactiveCommand.CreateFromTask <Visitor, bool>(SendVisitor, canSendPerson); #endregion Initialized = SubordinateViewModel_Initialized; Initialized.Invoke(); }
public virtual Item Init(ItemPhysic itemData) { foreach (Item existingInteractiveObject in this.gameObject.GetComponents <Item>()) { Destroy(existingInteractiveObject); } itemId = itemData.id; initialized = true; Item item = itemData.CreateComponent(this.gameObject); if (Initialized != null) { Initialized.Invoke(item); } return(item); }
public bool RegisterClient(string args) { // Deserialize the configuration. var configuration = JsonConvert.DeserializeObject <ScriptingBridgeRegistrationConfiguration>(args, InternalJsonSettings); ClientCallGate = configuration.CallGateName; DocumentMode = configuration.DocumentMode; JsonSupported = configuration.JsonSupported; // Set the initialized flag. IsInitialized = true; // Invoke the initialized event. if (Initialized != null) { Initialized.Invoke(this, EventArgs.Empty); } return(true); }
private void OnLoading(FrameworkElement sender, object args) { if (Content != null) { return; } if (!HasOptions) { CopyVisualStateGroups(DemoModuleContent as FrameworkElement); Content = DemoModuleContent; } else { SplitView = new SplitView() { PanePlacement = SplitViewPanePlacement.Right, OpenPaneLength = OptionsPaneWidth, PaneBackground = new SolidColorBrush(Colors.Transparent) }; ScrollViewer paneScrollViewer = new ScrollViewer() { Width = OptionsPaneWidth }; paneScrollViewer.Style = (Style)Application.Current.Resources["DemoModulePaneScrollViewerStyle"]; paneScrollViewer.Content = Options; SplitView.Content = DemoModuleContent; SplitView.Pane = paneScrollViewer; CopyVisualStateGroups(SplitView); Content = SplitView; if (DesignMode.DesignModeEnabled) { SplitView.DisplayMode = SplitViewDisplayMode.Inline; SplitView.IsPaneOpen = true; } } if (!DesignMode.DesignModeEnabled) { Initialized.Invoke(this, null); } }
private void View_Initialized(object sender, EventArgs e) { Initialized?.Invoke(this, e); }
void Start() { Initialized?.Invoke(this, new InitializedEventArgs()); StartTime(); YearTicked?.Invoke(this, new TimeEventArgs(Minute, Hour, Year)); }
/// <summary>Callback for Windows.</summary> /// <param name="hwnd">Window handle of the browse dialog box.</param> /// <param name="uMsg">Dialog box event that generated the statusMessage.</param> /// <param name="lParam">Value whose meaning depends on the event specified in uMsg.</param> /// <param name="lpData">Application-defined value that was specified in the lParam member of the BROWSEINFO structure used in the call to SHBrowseForFolder.</param> /// <returns> /// Returns 0 except in the case of BFFM_VALIDATEFAILED. For that flag, returns 0 to dismiss the dialog or nonzero to keep the dialog displayed. /// </returns> //[CLSCompliant(false)] private int OnBrowseEvent(IntPtr hwnd, BrowseForFolderMessages uMsg, IntPtr lParam, IntPtr lpData) { var messsage = uMsg; href = new HandleRef(this, hwnd); switch (messsage) { case BrowseForFolderMessages.BFFM_INITIALIZED: // Dialog is being initialized, so set the initial parameters if (!string.IsNullOrEmpty(Caption)) { SetWindowText(href, Caption); } if (!string.IsNullOrEmpty(SelectedItem)) { SendMessage(href, (uint)BrowseForFolderMessages.BFFM_SETSELECTIONW, (IntPtr)1, SelectedItem); } if (Expanded) { SendMessage(href, (uint)BrowseForFolderMessages.BFFM_SETEXPANDED, (IntPtr)1, rootPidl.DangerousGetHandle()); } if (!string.IsNullOrEmpty(OkText)) { SendMessage(href, (uint)BrowseForFolderMessages.BFFM_SETOKTEXT, (IntPtr)0, OkText); } Initialized?.Invoke(this, new FolderBrowserDialogInitializedEventArgs(hwnd)); initialized = true; return(0); case BrowseForFolderMessages.BFFM_SELCHANGED: try { if (!initialized || pidl?.DangerousGetHandle() == lParam) { return(0); } var tmpPidl = new PIDL(lParam, false, false); var str = GetNameForPidl(tmpPidl); if (string.IsNullOrEmpty(str)) { return(0); } SelectedItem = str; pidl = tmpPidl; } catch { return(0); } SelectedItemChanged?.Invoke(this, new PropertyChangedEventArgs(nameof(SelectedItem))); return(0); case BrowseForFolderMessages.BFFM_VALIDATEFAILEDA: case BrowseForFolderMessages.BFFM_VALIDATEFAILEDW: if (InvalidFolderSelected != null) { var folderName = messsage == BrowseForFolderMessages.BFFM_VALIDATEFAILEDA ? Marshal.PtrToStringAnsi(lParam) : Marshal.PtrToStringUni(lParam); var e = new InvalidFolderEventArgs(folderName, true); InvalidFolderSelected?.Invoke(this, e); return(e.DismissDialog ? 0 : 1); } return(0); default: return(0); } }
internal static void Init() { Logger.Info("GraphicsManager initializing."); // Direct3D11 Init --- ResizeNextFrame = true; Factory = new FactoryDXGI(); ImagingFactory = new FactoryWIC(); Factory2D = new FactoryD2D(FactoryType.MultiThreaded, Engine.IsDebug ? DebugLevel.Error : DebugLevel.None); DirectWriteFactory = new FactoryDW(SharpDX.DirectWrite.FactoryType.Shared); CreateDevices(RenderSettings.GraphicsAdapter); Brushes = new MemoizingMRUCache <Colour, SolidColorBrush>( (colour, _) => new SolidColorBrush(Context2D, (Color4)colour) { Opacity = colour.A }, int.MaxValue, brush => brush.Dispose()); // ------------------------------------ Engine.HandleSet += hwnd => { var camera = Game.Workspace.CurrentCamera; camera.RenderHandle = hwnd; }; if (Engine.Handle != IntPtr.Zero) { var camera = Game.Workspace.CurrentCamera; camera.RenderHandle = Engine.Handle; } SamplerStates.Load(); Shaders.Init(); BlendStates.Load(); DepthStencilStates.Load(); RasterizerStates.Load(); //StandardConstants = new ConstantBuffer<StandardConstantData>(); StandardShader = Shaders.Get("Standard"); MainPass = StandardShader.GetPass(); LightingShader = Shaders.Get("Lighting"); LightingPass = LightingShader.GetPass(); PostProcessShader = Shaders.Get("PostProcess"); SkyboxShader = Shaders.Get("Skybox"); SkyboxPass = SkyboxShader.GetPass(); AdornShader = Shaders.Get("Adorn"); AALinePass = AdornShader.GetPass("AALine"); AdornSelfLitPass = AdornShader.GetPass("AdornSelfLit"); Shadows.Init(); // ------------------ IsInitialized = true; Initialized?.Invoke(); Initialized = null; //PixHelper.AllowProfiling(Engine.IsDebug); Logger.Info("Renderer initialized."); }
protected override void OnInitialized() { Initialized?.Invoke(this); base.OnInitialized(); }
public static void Initialize() { string[] args = Environment.GetCommandLineArgs(); // 프레임워크 초기화 { SpinWorker.Initialize(); _stopRunningEvent = new EventWaitHandle(false, EventResetMode.ManualReset); _releaseEvent = new EventWaitHandle(false, EventResetMode.ManualReset); Logger.Info(LogMask.Aegis, "Aegis Framework({0})", AegisVersion.ToString(3)); } AegisTask.Run(() => { // 컨텐츠 초기화 (UI 모드) if (Environment.UserInteractive) { AegisTask.SafeAction(() => { if (Initialized == null || Initialized.Invoke(args) == true) { Running?.Invoke(); } }); AegisTask.SafeAction(() => { Finalizing?.Invoke(CloseReason.Close); }); } // 컨텐츠 초기화 (서비스 모드) else { ServiceMain.Instance.EventStart = () => { AegisTask.SafeAction(() => { if (Initialized == null || Initialized?.Invoke(System.Environment.GetCommandLineArgs()) == true) { // Running이 설정된 경우에는 Running이 반환되기를 대기하고, 반환된 후 종료처리 진행 if (Running != null) { (new Thread(() => { AegisTask.SafeAction(() => { Running.Invoke(); }); ServiceMain.Instance.Stop(); })).Start(); } } }); }; ServiceMain.Instance.EventStop = () => { AegisTask.SafeAction(() => { Finalizing?.Invoke(CloseReason.ServiceStop); }); }; ServiceMain.Instance.EventShutDown = () => { AegisTask.SafeAction(() => { Finalizing?.Invoke(CloseReason.ShutDown); }); }; ServiceMain.Instance.Run(); } _stopRunningEvent.Set(); }); AegisTask.Run(() => { WaitForRunning(); // 프레임워크 종료 Calculate.IntervalTimer.DisposeAll(); NamedThread.DisposeAll(); NamedObjectManager.Clear(); SpinWorker.Release(); Logger.Info(LogMask.Aegis, "Aegis Framework finalized."); Logger.RemoveAll(); AegisTask.SafeAction(() => { Finalized?.Invoke(); }); Initialized = null; Finalizing = null; Finalized = null; Running = null; _releaseEvent.Set(); }); }
protected void OnInitialized() { Initialized?.Invoke(this); }
/// <summary> /// Raises the <see cref="Initialized"/> event. /// </summary> protected virtual void OnInitialized() => Initialized?.Invoke(this);
/// <summary> /// Fires the Initialized Event. /// </summary> protected virtual void OnInitialize() { _isInitialized = true; Initialized?.Invoke(this, EventArgs.Empty); }
/// <summary> /// Raises the <see cref="Initialized"/> event /// </summary> protected override void OnInitialized() { Initialized?.Invoke(this, CreateInitializedEventArgs()); }
/// <summary>Callback from VSTO/VSTA signalling successful Ribbon load, and providing the <see cref="IRibbonUI"/> handle.</summary> public virtual void OnRibbonLoad(IRibbonUI ribbonUI) { RibbonUI = ribbonUI; Initialized?.Invoke(this, EventArgs.Empty); }
/// <summary> /// Fires the Initialized event /// </summary> /// <param name="e">The event args.</param> protected virtual void OnInitialize(PaintEventArgs e) { Initialized?.Invoke(this, e); }
/// <summary> /// Raises the <see cref="Initialized"/> event. /// </summary> /// <param name="e">The <see cref="Catel.Services.CameraOperationCompletedEventArgs"/> instance containing the event data.</param> protected void RaiseInitialized(CameraOperationCompletedEventArgs e) { Initialized?.Invoke(this, e); }
void Start() { Initialized?.Invoke(this, new InitializedEventArgs()); }
/// <summary>ステートが初期化スクリプトを読み終えた事を通知します。</summary> public void NotifyInitialized() => Initialized?.Invoke(this, EventArgs.Empty);
/// <summary> /// Raises the Initialized event. /// </summary> /// <param name="e">An EventArgs containing the event data.</param> protected virtual void OnInitialized(EventArgs e) { Initialized?.Invoke(this, EventArgs.Empty); }
internal void RendererInitialized() { Initialized?.Invoke(this, null); }
public static Task <bool> WindowInitialized(int width, int height) { Initialized?.Invoke(null, new Rectangle(0, 0, width, height)); return(Task.FromResult(true)); }
/// <summary> /// 触发对象初始化的通知事件。 /// </summary> /// <param name="e"></param> protected virtual void OnInitialized(EventArgs e) { Initialized.Invoke(this, e); }
private static void Main(string[] args) { var fileName = Assembly.GetExecutingAssembly().GetName().Name; var showHelp = false; var options = new OptionSet { { "n|name=", "The bot's name and default alias.", name => Bot.BotName = name }, { "t|token=", "Required. The Slack API key to connect and operate with.", token => Bot.BotAccessToken = token ?? Environment.GetEnvironmentVariable("SLACK_API_TOKEN") }, { "ut|usertoken=", "The Slack API key to use in certain operations such as delete.", token => Bot.AccessToken = token ?? Environment.GetEnvironmentVariable("SLACK_API_USER_TOKEN") ?? Bot.BotAccessToken }, { "h|help", "Show help about the command line arguments and exit.", h => showHelp = h != null } }; try { options.Parse(args); } catch (OptionException ex) { Console.WriteLine(ex.Message); Console.WriteLine($"Please type {fileName} --help for more details."); Environment.Exit((int)ExitCodes.InvalidCommandLineArgs); } if (showHelp) { Console.WriteLine($"Usage: {fileName} --token <token> (options)"); Console.WriteLine(); // output the options Console.WriteLine("Options:"); options.WriteOptionDescriptions(Console.Out); Environment.Exit((int)ExitCodes.Normal); } var tokenRegex = new Regex(@"^xo\w{2}-\d{11}-\w{24}", RegexOptions.IgnoreCase); if (string.IsNullOrEmpty(Bot.BotAccessToken) || !tokenRegex.IsMatch(Bot.BotAccessToken)) { Console.WriteLine("A valid bot access token is required to start the program."); Environment.Exit((int)ExitCodes.InvalidToken); } if (string.IsNullOrEmpty(Bot.AccessToken) || !tokenRegex.IsMatch(Bot.AccessToken)) { Console.WriteLine( "A valid user access token wasn't provided. Some features such as message deletion might not work."); } Initialized += EventHandlers.OnInitialize; Initialized?.Invoke(); while (!ExitSignal) { var console = Console.ReadLine(); if (string.IsNullOrWhiteSpace(console)) { continue; } var input = console.Split(); var commandName = input[0].Replace("/", ""); var parameters = input.Skip(1).ToArray(); var command = CommandModule.Commands.FirstOrDefault(c => c.HasAlias(commandName)); if (command == null) { Console.WriteLine("Invalid command entered! Type /help for a list of available commands!"); continue; } command.Execute(commandName, parameters.ToList(), User.Self, new NewMessage { channel = "console" }); } Exit(); }