public virtual void StartHaptics(int strength, int frequency, float duration = 0.0f) { DelayedCall.Free(ref m_VibrationDC); // strength = Mathf.Clamp(strength, 0, 100); //[0,100],0 -> Default. XDevicePlugin.SendMessage(handle, XDevicePlugin.kMessage_TriggerVibration, (int)((strength <= 0?20:strength) | ((frequency << 16) & 0xFFFF0000)), (int)(duration * 1000) ); if (duration > 0.0f) { m_VibrationDC = Juggler.Main.DelayCall(StopHaptics, duration); } }
public void CreateAndEvaluateDelayedCall() { IFunction function = this.MakeFunction("f(X) -> X+1."); Context context = new Context(); var arguments = new object[] { 1 }; DelayedCall dcall = new DelayedCall(function, context, arguments); Assert.IsNotNull(dcall.Function); Assert.AreSame(function, dcall.Function); Assert.AreSame(context, dcall.Context); Assert.AreSame(arguments, dcall.Arguments); Assert.AreEqual(2, dcall.Evaluate()); }
/// <summary> /// /// </summary> public static void Push(DelayedCall item) { int i = s_Pool.IndexOf(item); if (i != -1) { Log.w("DelayedCall", "Push failed..."); return; } else { item.Reset(); // ResetToBeginning s_Pool.Add(item); ++s_LenPool; // Push } }
public MainWindow() { Instance = this; InitializeComponent(); Width = 1000; Height = 500; SettingsHelper.BindWindowState(this, App.Settings.MainWindowState); logItemsScrollPixelDc = DelayedCall.Create(() => { logItemsHostPanel.ScrollToPixel = true; }, 600); updateScrollmapDc = DelayedCall.Create(UpdateScrollmap, 100); App.Settings.OnPropertyChanged(s => s.ShowWarningsErrorsInScrollBar, () => InvalidateScrollmap(false)); App.Settings.OnPropertyChanged(s => s.ShowSelectionInScrollBar, () => InvalidateScrollmap(false)); }
public virtual DelayedCall DelayCall(DelayedCall.Call call, float delay) { if (call == null) { return(null); } DelayedCall delayedCall = DelayedCall.Pop(); delayedCall.juggler = this; delayedCall.Init( delay, 0.0f, DelayedCall.k_OneShot, call, null ); Add(delayedCall); return(delayedCall); }
public PropertyGrid() { _direction = ListSortDirection.Ascending; _allProperties = new ObservableCollection <PropertyInformation>(); _properties = new ObservableCollection <PropertyInformation>(); _filterCall = new DelayedCall(ProcessFilter, DispatcherPriority.Background); InitializeComponent(); Loaded += HandleLoaded; Unloaded += HandleUnloaded; CommandBindings.Add(new CommandBinding(ShowBindingErrorsCommand, HandleShowBindingErrors, CanShowBindingErrors)); CommandBindings.Add(new CommandBinding(ClearCommand, HandleClear, CanClear)); CommandBindings.Add(new CommandBinding(SortCommand, HandleSort)); }
public EasyForm() { renderPageDc = DelayedCall.Create(RenderPdfPage, 200); InitializeComponent(); FillCertificatesList(); ValidateUIState(); string[] args = Environment.GetCommandLineArgs(); if (args.Length > 1) { InputFileText.Text = args[1]; ValidateInputFile(); } }
public virtual DelayedCall UpdateCall(DelayedCall.Call call, float delay, float duration) { if (call == null) { return(null); } DelayedCall delayedCall = DelayedCall.Pop(); delayedCall.juggler = this; delayedCall.Init( delay, duration, DelayedCall.k_EveryFrame, call, null ); Add(delayedCall); return(delayedCall); }
public virtual DelayedCall RepeatCall(DelayedCall.Call call, float delay, float duration, int repeatCount) { if (call == null) { return(null); } DelayedCall delayedCall = DelayedCall.Pop(); delayedCall.juggler = this; delayedCall.Init( delay, duration, repeatCount, call, null ); Add(delayedCall); return(delayedCall); }
public void TriggerExpandCollapse() { if (_buttonItems.Count == 0) { return; } _expandSize = 2; // corresponds to the padding foreach (PreferencesButtonItem val in _buttonItems) { _expandSize += val.Height; } if (_isExpandable) { if (_isExpanded) { if (_dcExpand != null) { _dcExpand.Cancel(); _dcExpand.Dispose(); _dcExpand = null; } OnCollapsing(); _dcCollapse = DelayedCall.Create(CollapseButton, 1); _dcCollapse.Start(); } else { if (_dcCollapse != null) { _dcCollapse.Cancel(); _dcCollapse.Dispose(); _dcCollapse = null; } OnExpanding(); UpdateItems(true); _isExpanded = true; _dcExpand = DelayedCall.Create(ExpandButton, 1); _dcExpand.Start(); } } }
/// <summary> /// /// </summary> public static DelayedCall Pop() { DelayedCall ret = null; if (s_LenPool == 0) { ret = new DelayedCall(); } else { --s_LenPool; ret = DelayedCall.s_Pool[s_LenPool]; s_Pool.RemoveAt(s_LenPool); } ret.m_IsRunning = true; return(ret); }
/// <summary> /// Initializes a new instance of the <see cref="ModernTaskWindow"/> class. /// </summary> /// <param name="autoCloseTime">The auto close window duration in milliseconds.</param> /// <param name="userControl">The user control.</param> public ModernTaskWindow(long autoCloseTime, Control userControl) : this() { if (userControl != null) { this.ControlContainer.Controls.Add(userControl); userControl.Dock = DockStyle.Fill; } this._closeTime = autoCloseTime; if (this._closeTime > 0d) { this._delayedCallTimer = DelayedCall.Start(this.UpdateProgress, 4); this._lastUpdateTime = DateTime.Now; this._thresholdTime = this._closeTime / 1.5d; } }
// [UnityEditor.Callbacks.DidReloadScripts(100)] // private static void OnScriptsReloaded() // { //// Debug.Log("Scripts Reloaded"); // ExecuteProcessor(); // } private static void ExecuteProcessor() { if (EditorApplication.isPlayingOrWillChangePlaymode) { return; } if (EditorApplication.isCompiling || EditorApplication.isUpdating) { DelayedCall.Run(2f, ExecuteProcessor); return; } ProcessorsSettings.ResetInstance(); if (!ProcessorsSettings.Instance.RunDoozyAssetsProcessor) { return; } DelayedCall.Run(3f, Run); }
protected override void OnChecked(RoutedEventArgs e) { if (ShowMenu && ContextMenu != null) { base.OnChecked(e); if (cancelOpen) { DelayedCall.Start(() => { cancelOpen = false; }, 50); IsChecked = false; return; } ContextMenu.Closed += ContextMenu_Closed; ContextMenu.Placement = System.Windows.Controls.Primitives.PlacementMode.Bottom; ContextMenu.PlacementTarget = this; ContextMenu.IsOpen = true; } }
public SnoopUI() { _filterCall = new DelayedCall(ProcessFilter, DispatcherPriority.Background); InheritanceBehavior = InheritanceBehavior.SkipToThemeNext; InitializeComponent(); // wrap the following PresentationTraceSources.Refresh() call in a try/catch // sometimes a NullReferenceException occurs // due to empty <filter> elements in the app.config file of the app you are snooping // see the following for more info: // http://snoopwpf.codeplex.com/discussions/236503 // http://snoopwpf.codeplex.com/workitem/6647 try { PresentationTraceSources.Refresh(); PresentationTraceSources.DataBindingSource.Switch.Level = SourceLevels.Error; } catch (NullReferenceException) { // swallow this exception since you can Snoop just fine anyways. } CommandBindings.Add(new CommandBinding(IntrospectCommand, HandleIntrospection)); CommandBindings.Add(new CommandBinding(RefreshCommand, HandleRefresh)); CommandBindings.Add(new CommandBinding(InspectCommand, HandleInspect)); CommandBindings.Add(new CommandBinding(SelectFocusCommand, HandleSelectFocus)); CommandBindings.Add(new CommandBinding(SelectFocusScopeCommand, HandleSelectFocusScope)); //NOTE: this is up here in the outer UI layer so ESC will clear any typed filter regardless of where the focus is // (i.e. focus on a selected item in the tree, not in the property list where the search box is hosted) CommandBindings.Add(new CommandBinding(ClearSearchFilterCommand, ClearSearchFilterHandler)); CommandBindings.Add(new CommandBinding(CopyPropertyChangesCommand, CopyPropertyChangesHandler)); InputManager.Current.PreProcessInput += HandlePreProcessInput; Tree.SelectedItemChanged += HandleTreeSelectedItemChanged; // we can't catch the mouse wheel at the ZoomerControl level, // so we catch it here, and relay it to the ZoomerControl. MouseWheel += SnoopUI_MouseWheel; }
public MetroTaskWindow(int duration, Control userControl, Point location) : this() { controlContainer.Controls.Add(userControl); userControl.Dock = DockStyle.Fill; closeTime = duration * 500; if (location == Point.Empty) { enableTaskBar = true; } else { Location = location; } if (closeTime > 0) { timer = DelayedCall.Start(UpdateProgress, 5); } }
public void AnimateStatusText(string newText) { int durationMs = 300; TimeSpan duration = TimeSpan.FromMilliseconds(durationMs); double offset = Math.Max(15, StatusText.ActualHeight); // Prepare animation if (statusTextAnimationDc != null) { statusTextAnimationDc.Fire(); } StatusTextShadow.Text = newText; // Animate both text blocks AnimationHelper.AnimateEaseOut(StatusTextTranslateTransform, TranslateTransform.YProperty, 0, -offset, duration); AnimationHelper.AnimateEaseOut(StatusText, TextBlock.OpacityProperty, 1, 0, duration); AnimationHelper.AnimateEaseOut(StatusTextShadowTranslateTransform, TranslateTransform.YProperty, offset, 0, duration); AnimationHelper.AnimateEaseOut(StatusTextShadow, TextBlock.OpacityProperty, 0, 1, duration); // Finish up animation statusTextAnimationDc = DelayedCall.Start(StatusTextAnimationFinished, durationMs); }
private void UpdateProgress() { if (elapsedTime == closeTime) { timer.Dispose(); timer = null; Close(); return; } elapsedTime += 5; if (cancelTimer) elapsedTime = 0; double perc = (double)elapsedTime / ((double)closeTime / 100); progressWidth = (int)((double)Width * (perc / 100)); Invalidate(new Rectangle(0,0,Width,5)); if (!cancelTimer) timer.Reset(); }
/// <summary> /// Call this at the beginning of the scene to fade in. /// </summary> /// <param name="fadeScreen">Fade screen.</param> public void UseFadeScreen(Animator fadeScreen, float delay = 0f, string fadeInTrigger = null, string fadeOutTrigger = null) { if (fadeScreen) { if (fadeInTrigger != null) { FadeInTrigger = Animator.StringToHash(fadeInTrigger); } else { FadeInTrigger = Animator.StringToHash("FadeIn"); } if (fadeOutTrigger != null) { FadeOutTrigger = Animator.StringToHash(fadeOutTrigger); } else { FadeOutTrigger = Animator.StringToHash("FadeOut"); } _fadeScreen = fadeScreen; if (delay > 0) { DelayedCall.Create(UseFadeScreen, delay, false); } else { UseFadeScreen(); } } else { _fadeScreen = null; } }
/// <summary> /// Invoke the specified function. It's unlikely that you will need to call this function yourself. /// </summary> public static void FindAndExecute(uint objID, byte funcID, params object[] parameters) { TNObject obj = TNObject.Find(objID); if (obj != null) { if (!obj.Execute(funcID, parameters)) { #if UNITY_EDITOR Debug.LogError("Unable to execute function with ID of '" + funcID + "'. Make sure there is a script that can receive this call.\n" + "GameObject: " + GetHierarchy(obj.gameObject), obj.gameObject); #endif } } else if (TNManager.isInChannel) { DelayedCall dc = new DelayedCall(); dc.objID = objID; dc.funcID = funcID; dc.parameters = parameters; mDelayed.Add(dc); } #if UNITY_EDITOR else Debug.LogError("Trying to execute a function " + funcID + " on TNObject #" + objID + " before it has been created."); #endif }
public ElementTreeExplorerViewModel() { base.DisplayName = "Element Tree Explorer"; _filterCall = new DelayedCall(ProcessFilter, DispatcherPriority.Background); }
protected virtual void OnDestroy() { DelayedCall.Free(ref m_DelayedCall); }
public void Next() { if (cancellationPending) { return; // and don't come back } timePassed += interval; if (timePassed > duration) { if (handler != null) { handler(target); } return; } try { Control c; Form f; Rectangle wa; switch (type) { case AnimationTypes.ResizeVert: c = target as Control; c.Height = start + (int)((end - start) * MakeCurve()); wa = Screen.FromControl(c).WorkingArea; if (c is Form && c.Bottom > wa.Bottom) { c.Top -= c.Bottom - wa.Bottom; if (c.Top < wa.Top) { c.Top = wa.Top; } } break; case AnimationTypes.ResizeHoriz: c = target as Control; c.Width = start + (int)((end - start) * MakeCurve()); wa = Screen.FromControl(c).WorkingArea; if (c is Form && c.Right > wa.Right) { c.Left -= c.Right - wa.Right; if (c.Left < wa.Left) { c.Left = wa.Left; } } break; case AnimationTypes.FadeIn: f = target as Form; f.Opacity = (double)(start + ((end - start) * MakeCurve())) / 100; break; case AnimationTypes.FadeOut: f = target as Form; f.Opacity = (double)(start + ((end - start) * MakeCurve())) / 100; break; case AnimationTypes.Callback: callback(target, start + (int)((end - start) * MakeCurve())); break; } DelayedCall.Start(Next, interval); } catch (ObjectDisposedException) { // Control is gone, stop here } }
public virtual void Stop() { DelayedCall.Free(ref m_DelayedCall); // m_IsPlaying = false; }
private void LogDirsListView_ClientSizeChanged(object sender, EventArgs args) { DelayedCall.Start(UpdateColumnWidths, 1); }
public virtual void StopHaptics() { DelayedCall.Free(ref m_VibrationDC); // XDevicePlugin.SendMessage(handle, XDevicePlugin.kMessage_TriggerVibration, -1, 0); }
/// <summary> /// Invoke the specified function. It's unlikely that you will need to call this function yourself. /// </summary> public static void FindAndExecute(uint objID, string funcName, params object[] parameters) { TNObject obj = TNObject.Find(objID); if (obj != null) { if (!obj.Execute(funcName, parameters)) { #if UNITY_EDITOR Debug.LogError("Unable to execute function '" + funcName + "'. Did you forget an [RFC] prefix, perhaps?\n" + "GameObject: " + GetHierarchy(obj.gameObject), obj.gameObject); #endif } } else if (TNManager.isInChannel) { DelayedCall dc = new DelayedCall(); dc.objID = objID; dc.funcName = funcName; dc.parameters = parameters; mDelayed.Add(dc); } #if UNITY_EDITOR else Debug.LogError("Trying to execute a function '" + funcName + "' on TNObject #" + objID + " before it has been created."); #endif }