Document _Document;
DispatcherTimer timer = new DispatcherTimer();
+ const int Interval = 16;
+ const int IntervalWhenLostFocus = 160;
+
/// <summary>
/// コンストラクター
/// </summary>
this.gestureRecongnizer.ManipulationUpdated += gestureRecongnizer_ManipulationUpdated;
this.gestureRecongnizer.ManipulationCompleted += gestureRecongnizer_ManipulationCompleted;
- this.timer.Interval = new TimeSpan(0, 0, 0, 0, 16);
+ this.timer.Interval = new TimeSpan(0, 0, 0, 0, Interval);
this.timer.Tick += this.timer_Tick;
this.timer.Start();
{
base.OnGotFocus(e);
- if(this.textServiceManager == null)
+ System.Diagnostics.Debug.WriteLine("got focus");
+
+ if (this.textServiceManager == null)
{
await Task.Delay(500);
this.textServiceManager = CoreTextServicesManager.GetForCurrentView();
this.CreateTextContext();
this.View.IsFocused = true;
- this.timer.Start();
+ this.timer.Interval = new TimeSpan(0, 0, 0, 0, Interval);
this.Refresh();
}
this.RemoveTextContext();
+ System.Diagnostics.Debug.WriteLine("lost focus");
+
this.View.IsFocused = false;
this.Refresh(this.View.PageBound);
- this.timer.Stop();
+ this.timer.Interval = new TimeSpan(0, 0, 0, 0, IntervalWhenLostFocus);
}
private void CreateTextContext()
void timer_Tick(object sender, object e)
{
+ System.Diagnostics.Debug.WriteLine("interval {0}", DateTime.Now.Millisecond);
if (this.View.LayoutLines.HilightAll() || this.View.LayoutLines.GenerateFolding() || this.Document.IsRequestRedraw)
{
this.Refresh(this.View.PageBound);
bool isNotifyChanged = false;
Document _Document;
Popup popup;
-
+
+ const int Interval = 16;
+ const int IntervalWhenLostFocuse = 160;
+
static FooTextBox()
{
DefaultStyleKeyProperty.OverrideMetadata(typeof(FooTextBox), new FrameworkPropertyMetadata(typeof(FooTextBox)));
this.InputBindings.Add(new InputBinding(FooTextBoxCommands.ToggleCodePoint, new KeyGesture(Key.X, ModifierKeys.Alt)));
this.timer = new DispatcherTimer();
- this.timer.Interval = new TimeSpan(0, 0, 0, 0, 16);
+ this.timer.Interval = new TimeSpan(0, 0, 0, 0, Interval);
this.timer.Tick += new EventHandler(timer_Tick);
this.Loaded += new RoutedEventHandler(FooTextBox_Loaded);
base.OnGotKeyboardFocus(e);
this.textStore.SetFocus();
this.View.IsFocused = true;
- this.timer.Start();
+ this.timer.Interval = new TimeSpan(0,0,0,0,Interval);
this.Refresh();
}
{
base.OnLostKeyboardFocus(e);
this.View.IsFocused = false;
- //タイマーを止めるので強制的に再描写させる
- this.Refresh(this.View.PageBound);
- this.timer.Stop();
+ this.timer.Interval = new TimeSpan(0, 0, 0, 0, IntervalWhenLostFocuse);
+ this.Refresh();
}
#endregion
#region Event