本文整理汇总了C#中System.Windows.Threading.DispatcherTimer类的典型用法代码示例。如果您正苦于以下问题:C# System.Windows.Threading.DispatcherTimer类的具体用法?C# System.Windows.Threading.DispatcherTimer怎么用?C# System.Windows.Threading.DispatcherTimer使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
System.Windows.Threading.DispatcherTimer类属于命名空间,在下文中一共展示了System.Windows.Threading.DispatcherTimer类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Gameplay
//------------------------------------------------------
//
// Constructor
//
//------------------------------------------------------
public Gameplay(int initialHeight, int initialWidth)
{
InitializeComponent();
this.initialHeight = initialHeight;
this.initialWidth = initialWidth;
tileSizeWidth = CANVAS_SIZE[0] / initialWidth;
tileSizeHeight = CANVAS_SIZE[1] / initialHeight;
canvas.Width = CANVAS_SIZE[0];
canvas.Height = CANVAS_SIZE[1];
//focus on button to enable keyhanling
buttonNewPuzzle.Focus();
//new game
buttonNewPuzzle_Click(null, null);
//speed of autosolver
dispatcherTimer = new System.Windows.Threading.DispatcherTimer();
dispatcherTimer.Tick += new EventHandler(dispatcherTimer_Tick);
dispatcherTimer.Interval = new TimeSpan(0, 0, 0, 0, 400);
dispatcherTimer.Start();
//clock timer
timererek = new System.Windows.Threading.DispatcherTimer();
timererek.Tick += new EventHandler(timerek_Tick);
timererek.Interval = new TimeSpan(0, 0, 1);
timererek.Start();
}
示例2: RuleLine
public RuleLine()
{
InitializeComponent();
_doubleClickTimer = new System.Windows.Threading.DispatcherTimer();
_doubleClickTimer.Interval = new TimeSpan(0, 0, 0, 0, 200);
_doubleClickTimer.Tick += new EventHandler(DoubleClick_Timer);
}
示例3: SplashScreen
public SplashScreen()
{
InitializeComponent();
_splashTimer = new System.Windows.Threading.DispatcherTimer();
this.Loaded += new RoutedEventHandler(SplashScreen_Loaded);
progressBar.IsIndeterminate = true;
}
示例4: StartTimer
public void StartTimer()
{
submitTimer = new System.Windows.Threading.DispatcherTimer();
submitTimer.Interval = TimeSpan.FromSeconds(10);
submitTimer.IsEnabled = true;
submitTimer.Tick += SubmitTimer_Tick;
}
示例5: MainWindow
public MainWindow()
{
InitializeComponent();
logger.Trace("After InitializeComponent");
// Add all the sample stations to the main grid
addStationControlToGrid(sampleGrid);
logger.Trace("Added station control to grid");
// Create a dispatch timer that will be triggered every second.
dispatcherTimer = new System.Windows.Threading.DispatcherTimer();
dispatcherTimer.Interval = new TimeSpan(0, 0, 1);
logger.Trace("Timer created");
// Search for the NLog config named sampleFile (or wrapped_sampleFile) and show the location on the screen
LoggingConfiguration config = LogManager.Configuration;
foreach (Target currentTarget in config.AllTargets)
{
if (currentTarget is FileTarget)
{
if (currentTarget.Name.StartsWith("sampleFile"))
{
FileTarget standardTarget = currentTarget as FileTarget;
string expandedFileName = NLog.Layouts.SimpleLayout.Evaluate(standardTarget.FileName.ToString());
logFileLocationTextBlock.Text = expandedFileName;
break;
}
}
}
}
示例6: Button_Click
private void Button_Click(object sender, RoutedEventArgs e)
{
OpenFileDialog ofd = new OpenFileDialog();
ofd.AddExtension = true;
ofd.DefaultExt = "*.*";
ofd.Filter = "Media Files (*.*)|*.*";
ofd.ShowDialog();
try
{
mediaElement.Source = new Uri(ofd.FileName);
textBlock.Text = mediaElement.Volume.ToString();
mediaElement.Pause();
}
catch
{
new NullReferenceException("Error");
}
System.Windows.Threading.DispatcherTimer dispatchTimer = new System.Windows.Threading.DispatcherTimer();
dispatchTimer.Tick += new EventHandler(timer_Tick);
dispatchTimer.Interval = new TimeSpan(0, 0, 1);
dispatchTimer.Start();
}
示例7: CuttingPage
public CuttingPage(YellowstonePathology.Business.Test.AliquotOrder aliquotOrder,
YellowstonePathology.Business.Test.Model.TestOrder testOrder,
YellowstonePathology.Business.Test.AccessionOrder accessionOrder,
YellowstonePathology.Business.Label.Model.HistologySlidePaperLabelPrinter histologySlidePaperLabelPrinter,
YellowstonePathology.UI.Navigation.PageNavigator pageNavigator)
{
this.m_AliquotOrder = aliquotOrder;
this.m_AccessionOrder = accessionOrder;
this.m_TestOrder = testOrder;
this.m_PageNavigator = pageNavigator;
this.m_HistologySlidePaperLabelPrinter = histologySlidePaperLabelPrinter;
this.m_SpecimenOrder = this.m_AccessionOrder.SpecimenOrderCollection.GetSpecimenOrderByAliquotOrderId(this.m_AliquotOrder.AliquotOrderId);
this.m_PanelSetOrder = this.m_AccessionOrder.PanelSetOrderCollection.GetPanelSetOrderByTestOrderId(this.m_TestOrder.TestOrderId);
this.m_PanelOrder = this.m_AccessionOrder.PanelSetOrderCollection.GetPanelOrderByTestOrderId(this.m_TestOrder.TestOrderId);
this.m_SystemIdentity = Business.User.SystemIdentity.Instance;
this.m_ListBoxSlidesMouseDownTimer = new System.Windows.Threading.DispatcherTimer();
this.m_ListBoxSlidesMouseDownTimer.Interval = new TimeSpan(0, 0, 0, 0, 750);
this.m_ListBoxSlidesMouseDownTimer.Tick += new EventHandler(ListBoxSlidesMouseDownTimer_Tick);
this.m_BarcodeScanPort = YellowstonePathology.Business.BarcodeScanning.BarcodeScanPort.Instance;
InitializeComponent();
DataContext = this;
this.m_PageTimeoutTimer = new System.Windows.Threading.DispatcherTimer();
this.m_PageTimeoutTimer.Interval = TimeSpan.FromMinutes(15);
this.m_PageTimeoutTimer.Tick += new EventHandler(PageTimeoutTimer_Tick);
this.m_PageTimeoutTimer.Start();
this.Loaded += new RoutedEventHandler(CuttingPage_Loaded);
this.Unloaded += new RoutedEventHandler(CuttingPage_Unloaded);
}
示例8: StandardMainControl
public StandardMainControl()
{
UserIDClick = new Utility.CommandHandler(
delegate(object sender)
{
UserSelectWindow win = new UserSelectWindow();
win.EquipmentInstance = EquipmentInstance;
win.Owner = Application.Current.Windows.OfType<Window>().SingleOrDefault(x => x.IsActive);
if ((bool)win.ShowDialog() == true)
{
EquipmentInstance.CurrentUser = win.SelectedUser;
}
}, true);
InitializeComponent();
Manager.LogManager.Instance.OnWriteTraceLog += WriteTraceLog;
System.Windows.Threading.DispatcherTimer timer = new System.Windows.Threading.DispatcherTimer();
timer.Interval = new TimeSpan(0, 0, 0, 0, 500);
timer.Tick +=
delegate(object sender, EventArgs e)
{
CurrentTime = DateTime.Now;
};
timer.Start();
}
示例9: OnPlotterAttached
public override void OnPlotterAttached(Plotter plotter)
{
base.OnPlotterAttached(plotter);
timer = new System.Windows.Threading.DispatcherTimer();
timer.Tick += new EventHandler(timer_Tick);
timer.Interval = TimeSpan.FromMilliseconds(1);
plotter.CentralGrid.MouseLeftButtonDown += new MouseButtonEventHandler(CentralGrid_MouseLeftButtonDown);
plotter.CentralGrid.MouseLeftButtonUp += new MouseButtonEventHandler(CentralGrid_MouseLeftButtonUp);
plotter.CentralGrid.MouseMove += new MouseEventHandler(CentralGrid_MouseMove);
plotter.CentralGrid.MouseWheel += new MouseWheelEventHandler(CentralGrid_MouseWheel);
plotter.CentralGrid.MouseLeave += new MouseEventHandler(CentralGrid_MouseLeave);
//plotter.CentralGrid.MouseEnter += new MouseEventHandler(CentralGrid_MouseEnter);
plotter.KeyDown += new KeyEventHandler(plotter_KeyDown);
plotter.KeyUp += new KeyEventHandler(plotter_KeyUp);
zoomingRect.Stroke = new SolidColorBrush(Colors.LightGray);
Color fillColor = new Color();
fillColor.A = 40;
fillColor.R = 0x80;
fillColor.G = 0x80;
fillColor.B = 0x80;
zoomingRect.RadiusX = 2;
zoomingRect.RadiusY = 2;
zoomingRect.Fill = new SolidColorBrush(fillColor);
}
示例10: ButtonStart_Click
private async void ButtonStart_Click(object sender, RoutedEventArgs e)
{
ButtonStart.IsEnabled = false;
Slider_Duration.IsEnabled = false;
TimeSpan duration = TimeSpan.FromSeconds(this.Slider_Duration.Value);
System.Windows.Threading.DispatcherTimer timer = new System.Windows.Threading.DispatcherTimer();
timer.Interval = TimeSpan.FromSeconds(1);
timer.Start();
timer.Tick += timer_Tick;
LabelCountdown.Content = Convert.ToInt32(duration.TotalSeconds);
try
{
await StartTimerAsync(duration);
}
finally
{
timer.Stop();
ButtonStart.IsEnabled = true;
Slider_Duration.IsEnabled = true;
LabelCountdown.Content = 0;
}
}
示例11: MainPage
// コンストラクター
public MainPage()
{
InitializeComponent();
// 100ミリ秒毎に満了する様にタイマーを開始
readTimer = new System.Windows.Threading.DispatcherTimer();
readTimer.Tick += new EventHandler( readTimer_Tick );
readTimer.Interval = TimeSpan.FromMilliseconds( 100 );
//readTimer.Start();
try {
canvas1.Width = width;
canvas1.Height = height;
myClient.BeginJoinGroup(
result =>
{
try {
myClient.EndJoinGroup( result );
myClient.MulticastLoopback = true;
}
catch ( Exception ex ) {
MessageBox.Show( "Join succeeded. but something wrong. " + ex.Message );
}
}, null
);
Receive();
}
catch ( Exception ex ) {
MessageBox.Show( "Join failed. " + ex.Message );
}
}
示例12: Visualiser
public Visualiser()
{
InitializeComponent();
//sourceFile = "../../Resources/salestable.xml";
//tvvm = new TreeViewViewModel(sourceFile);
//ModelTreeView.DataContext = tvvm;
myToolbox = new Toolbox();
//string elementsFile = DirectoryHelper.getFilePath("Resources\\ToolBoxItems.xml");
//loadToolboxes(elementsFile);
suggestions = new ObservableCollection<Suggestion>();
suggestionsListBox.ItemsSource = suggestions;
//initiate the scheduling canvas
initiateSchedulingCanvas();
prettyPrinter = new XmlPrettyPrinter();
ShowSample = false;//set popup for sample to false
popupTimer = new System.Windows.Threading.DispatcherTimer();
popupTimer.Tick += new EventHandler(dispatcherTimer_Tick);
popupTimer.Interval = new TimeSpan(0, 0, 2);
logger = new Logger("VisualiserLogger");
logsTab.Content = logger;
}
示例13: MainPage
public MainPage()
{
InitializeComponent();
SettingsFrame.Opacity = 0;
if (!Application.Current.IsRunningOutOfBrowser)
{
closeImage.Visibility = System.Windows.Visibility.Collapsed;
minimizeImage.Visibility = System.Windows.Visibility.Collapsed;
}
if (Application.Current.InstallState == InstallState.NotInstalled)
Application.Current.InstallStateChanged += Current_InstallStateChanged;
else
InstallBtn.Visibility = System.Windows.Visibility.Collapsed;
Alarms = new ObservableCollection<Classes.Alarm>();
Alarms.Add(new Classes.Alarm("Wake up my ChickPea!") { Enabled = true, AlarmTime = new Classes.Time(7,30,00), Desc = "She is wonderful and deserves a loving wakeup call... :)" });
Alarms.Add(new Classes.Alarm("Arise! Seize the Day! Carpe Diem!!") { Enabled = true });
AlarmFrame.DataContext = Alarms;
Storyboard.SetTarget(ColorAnim, (Classes.ColorResourceWrapper)Application.Current.Resources["Hinting"]);
System.Windows.Threading.DispatcherTimer Checker = new System.Windows.Threading.DispatcherTimer();
Checker.Interval = new TimeSpan(0, 0, 1);
Checker.Tick += Checker_Tick;
Checker.Start();
}
示例14: ScratchpadControl
/// <summary>
/// Initializes a new instance of the <see cref="ScratchpadControl"/> class.
/// </summary>
public ScratchpadControl()
{
this.InitializeComponent();
mDlgOpen = new Microsoft.Win32.OpenFileDialog {Filter = "Text files (*.txt)|*.txt"};
mDlgSave = new Microsoft.Win32.SaveFileDialog
{
Filter = "Text file (*.txt)|*.txt",
//REMOVE IN RELEASE
InitialDirectory = @"D:\Applications\Workspace\Cpp\"
};
contentPath = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) + "\\ScratchPadExtension";
Directory.CreateDirectory(contentPath);
contentPath += "\\currContent.txt";
//Make config file if doesn't exist
if (!File.Exists(contentPath))
{
File.WriteAllText(contentPath, "");
}
// Set timer to save file contents no more often than once every 30 seconds and only after modification
dispatcherTimer = new System.Windows.Threading.DispatcherTimer();
dispatcherTimer.Tick += dispatcherTimer_Tick;
dispatcherTimer.Interval = new TimeSpan(0, 0, 30);
//Read file path of last content
ScratchBox.Text = File.ReadAllText(contentPath);
}
示例15: TaskDialogViewModel
/// <summary>
/// Initializes a new instance of the <see cref="TaskDialogViewModel"/> class.
/// </summary>
/// <param name="options">Options to use.</param>
public TaskDialogViewModel(TaskDialogOptions options)
: this()
{
this.options = options;
_expandedInfoVisible = options.ExpandedByDefault;
_verificationChecked = options.VerificationByDefault;
if (options.EnableCallbackTimer)
{
// By default it will run on the default dispatcher and with Background priority
_callbackTimer = new System.Windows.Threading.DispatcherTimer();
_callbackTimer.Interval = CallbackTimerInterval;
_callbackTimer.Tick += new EventHandler(CallbackTimer_Tick);
}
FixAllButtonLabelAccessKeys();
// If radio buttons are defined, set the radio result to the default selected radio
if (RadioButtons.Count > 0)
{
_radioResult = RadioButtons[DefaultButtonIndex].ID;
}
}