/// <summary> /// 初期化が必要であれば初期化する処理 /// </summary> private void init() { _clickParts = _clickParts == null ? new DataSharingManager.Object() : _clickParts; _clickPane = _clickPane == null ? new DataSharingManager.Object() : _clickPane; _tokenTray = _tokenTray == null ? new TokenTray() : _tokenTray; _finalizers = _finalizers == null ? new FinalizeManageBuffer() : _finalizers; _persister = _persister == null ? new PersistManager() : _persister; _timer = _timer == null ? new GuiTimer() : _timer; }
// Start is called before the first frame update void Start() { HUDCanvas = GameObject.FindWithTag("GUI"); anim = HUDCanvas.GetComponent <Animator>(); displayTimeTakenText = HUDCanvas.GetComponentInChildren <DisplayFinalTimeTaken>(); guiTimer = HUDCanvas.GetComponentInChildren <GuiTimer>(); }
private void timerm_5ms() { Win32.timeBeginPeriod(1); DateTime now = DateTime.Now; while (true) { Thread.Sleep(5); GuiTimer.timerm_5ms(Win32.Win32GetTime(now)); now = DateTime.Now; } }
void Start() { anim = GetComponent <Animator>(); player = GameObject.Find("Ruth"); playerHealth = player.GetComponent <PlayerHealth>(); HUDCanvas = GameObject.FindGameObjectWithTag("GUI"); guiTimer = HUDCanvas.transform.Find("Timer").GetComponent <GuiTimer>(); displayTimeTakenAfterLosing = HUDCanvas.transform.Find("LooseTimeTaken").GetComponent <DisplayTimeTakenAfterLosing>(); }
/// <summary> /// Starts the property updates worker. /// </summary> /// <exception cref="KeyNotFoundException">MediaElement does not have minimum set of MediaProperties</exception> private void StartPropertyUpdatesWorker() { // Check that we are not already started if (PropertyUpdatesWorker != null) { throw new InvalidOperationException($"{nameof(PropertyUpdatesWorker)} has to be null " + $"before calling {nameof(StartPropertyUpdatesWorker)}"); } // Check that all properties map back to the media state if (PropertyMapper.MissingPropertyMappings.Count > 0) { throw new KeyNotFoundException($"{nameof(MediaElement)} is missing properties exposed by {nameof(MediaEngineState)}. " + $"Missing properties are: {string.Join(", ", PropertyMapper.MissingPropertyMappings)}. " + $"Please add these properties to the {nameof(MediaElement)} class."); } // Properties Worker Logic PropertyUpdatesWorker = new GuiTimer(() => { UpdateNotificationProperties(); UpdateDependencyProperties(); }, HandledAsynchronousDispose); }
/// <summary> /// ルートグループがDisposeする /// </summary> private void disposeByRootGroup() { _timer?.Dispose(); _timer = null; }
// resumes the graph private void _resume() { if (_timer == null) { _timer = new GuiTimer(); _timer.Repeat(Interval, t => { RaiseEvent(new RoutedEventArgs(Seismograph.TickEvent)); for (var i = 0; i < Count; i++) { _drawNext(_polylines[i], _generators[i]); } }); } }
// pauses the graph private void _pause() { if (_timer != null) { _timer.Stop(); _timer = null; } }
// begins an animated transition private void _beginAnimatedTransition(Transition transition, Action onComplete) { // swap the front and back layers (without adding and removing them from the visual tree to avoid superfluous loaded/unloaded events) _flipLayers = !_flipLayers; // set the front layer's content FrontLayer.Content = Content; FrontLayer.ContentTemplate = ContentTemplate; FrontLayer.ContentTemplateSelector = ContentTemplateSelector; // start the transition from back layer to front layer InTransition = true; CoerceValue(ClipToBoundsProperty); _transitionData = new TransitionEventArgs(TransitionPanel.TransitionStartedEvent, this) { Bounds = RenderSize, OldContent = BackLayer.Content, NewContent = FrontLayer.Content, Transition = transition }; _transitionData.OnCompleteCallback = () => { _onCompleteAnimatedTransition(_transitionData); if (onComplete != null) onComplete(); }; Action invokeTransition = () => { _transitionData.BackSnapshot = _captureSnapshot(BackLayer, true); _transitionData.FrontSnapshot = _captureSnapshot(FrontLayer, true); transition.InvokeBeginTransition(_transitionData); }; RaiseEvent(_transitionData); if ((Content is DependencyObject) && GetHasNestedTransitionPanel((DependencyObject)Content)) { // if content has a nested transition panel, use a timer to allow the nested transition panel to draw its initial state before the // enclosing transition is started to avoid seeing a blank panel during the transition var timer = new GuiTimer(DispatcherPriority.Background); timer.Start(t => invokeTransition()); } else { invokeTransition(); } }