public XNAAsyncDispatcher(TimeSpan dispatchInterval)
 {
     FrameworkDispatcher.Update();
     this._frameworkDispatcherTimer = new DispatcherTimer();
     this._frameworkDispatcherTimer.Tick += new EventHandler(frameworkDispatcherTimer_Tick);
     this._frameworkDispatcherTimer.Interval = dispatchInterval;
 }
Example #2
1
        public ViewModel()
        {
            mgt = new ManagementClass("Win32_Processor");
            procs = mgt.GetInstances();

            CPU = new ObservableCollection<Model>();
            timer = new DispatcherTimer();
            random = new Random();
            time = DateTime.Now;
            cpuCounter = new PerformanceCounter();
            cpuCounter.CategoryName = "Processor";
            cpuCounter.CounterName = "% Processor Time";
            cpuCounter.InstanceName = "_Total";
            ramCounter = new PerformanceCounter("Memory", "Available MBytes");
            ProcessorID = GetProcessorID();
            processes = Process.GetProcesses();
            Processes = processes.Length;
            MaximumSpeed = GetMaxClockSpeed();
            LogicalProcessors = GetNumberOfLogicalProcessors();
            Cores = GetNumberOfCores();
            L2Cache = GetL2CacheSize();
            L3Cache = GetL3CacheSize();
            foreach (ManagementObject item in procs)
                L1Cache = ((UInt32)item.Properties["L2CacheSize"].Value / 2).ToString() + " KB";

            timer.Interval = TimeSpan.FromMilliseconds(1000);
            timer.Tick += timer_Tick;
            timer.Start();
            for (int i = 0; i < 60; i++)
            {
                CPU.Add(new Model(time, 0,0));
                time = time.AddSeconds(1);
            }
        }
Example #3
1
        public PlatformWpf()
            : base(null, true)
        {
            var app = new Application ();
            var slCanvas = new Canvas ();
            var win = new Window
            {
                Title = Title,
                Width = Width,
                Height = Height,
                Content = slCanvas
            };

            var cirrusCanvas = new CirrusCanvas(slCanvas, Width, Height);
            MainCanvas = cirrusCanvas;

            win.Show ();

            EntryPoint.Invoke (null, null);

            var timer = new DispatcherTimer ();
            timer.Tick += runDelegate;
            timer.Interval = TimeSpan.FromMilliseconds (1);

            timer.Start ();
            app.Run ();
        }
        public MainViewModel(IConfigurationService configService, INuiService nuiService, IKeyboardService keyboardService)
        {
            this.keyboardService = keyboardService;
            this.keyboardService.KeyUp += new EventHandler<KeyEventArgs>(keyboardService_KeyUp);
            this.configService = configService;
            this.nuiService = nuiService;
            this.nuiService.UserRaisedHand += new EventHandler<HandRaisedEventArgs>(nuiService_UserRaisedHand);
            this.nuiService.UserEnteredBounds += new EventHandler(nuiService_UserEnteredBounds);
            this.nuiService.UserExitedBounds += new EventHandler(nuiService_UserExitedBounds);
            this.ToggleCommand = new RelayCommand(this.ExecuteToggleCommand);
            this.AutoPlayCommand = new RelayCommand(this.ExecuteAutoPlayCommand);
            this.ToggleKinectVisionCommand = new RelayCommand(this.ExecuteToggleKinectVisionCommand);
            this.MainBackgroundBrush = (Brush)Application.Current.Resources["DefaultBackground"];
            this.EngineeringBackgroundBrush = new SolidColorBrush(Color.FromArgb(255, 0, 49, 83));

            this.videoTimer = new DispatcherTimer();
            this.videoTimer.Interval = TimeSpan.FromMilliseconds(50);
            this.videoTimer.Tick += new EventHandler(videoTimer_Tick);
            this.videoTimer.Start();

            if (!IsInDesignMode)
            {
                Application.Current.MainWindow.SizeChanged += new SizeChangedEventHandler(MainWindow_SizeChanged);
            }
        }
        public AdvancedSearch()
        {
            stockIcons = new StockIcons();

            documentsStockIcon = stockIcons.DocumentAssociated;
            videosStockIcon = stockIcons.VideoFiles;
            musicStockIcon = stockIcons.AudioFiles;
            picturesStockIcon = stockIcons.ImageFiles;

            InitializeComponent();

            // Set our default
            DocumentsRadioButton.IsChecked = true;

            // 
            prop1prop2OperationComboBox.SelectedIndex = 0;

            // Because the search can take some time, using a background thread.
            // This timer will check if that thread is still alive and accordingly update
            // the cursor
            DispatcherTimer timer = new DispatcherTimer();
            timer.Interval = new TimeSpan(0, 0, 1);
            timer.IsEnabled = true;
            timer.Tick += new EventHandler(timer_Tick);
        }
Example #6
0
        public FlyThru()
        {
            // Start point/range
            float xs = -0.5f;
            float ys = 0.0f;
            float rs = 3.0f;

            // End point/range
            float xe = -.2649f;
            float ye = -.8506f;
            float re = 0.00048828125f;

            // Interpolate all the points in between
            float l = 1.0f / (RenderPoints.Length - 1);
            for (int i = 0; i < RenderPoints.Length; i++)
            {
                float scale = (float)Math.Pow(l * i, 0.03125);
                RenderPoints[i] = Tuple.Create(xs + (xe - xs) * scale, ys + (ye - ys) * scale, rs + (re - rs) * scale);
            }

            // Initialize the visible elements, just for fun
            XC = xs;
            YC = ys;
            Scale = rs;
            IsRyuJIT = MainWindow.IsRyuJITLoaded() ? Visibility.Visible : Visibility.Collapsed;

            // WPF initialization
            InitializeComponent();

            // Create the timer to update the screen
            renderClock = new DispatcherTimer() { Interval = new TimeSpan(0, 0, 0, 0, 16) };// 62.5 FPS should be sufficient
            renderClock.Tick += renderClock_Tick;
        }
Example #7
0
        private void Start()
        {
            //this.Hide();

            _timer = new DispatcherTimer();
            _timer.Interval = TimeSpan.FromMilliseconds(10);
            _timer.Tick += _timer_Tick;
            _timer.Start();

            _events = new Events();
            _storage = new Storage(_events);
            _trayIcon = new TrayIcon(this);

            _events.OnInvokeDrop += _storage.Drop;
            _events.OnInvokeExpire += _storage.Expire;
            _events.OnInvokePeek += _storage.Peek;
            _events.OnInvokePoke += _storage.Poke;
            _events.OnInvokePinch += _storage.Pinch;
            _events.OnInvokePop += _storage.Pop;
            _events.OnInvokePush += _storage.Push;
            _events.OnInvokeShunt += _storage.Shunt;
            _events.OnInvokeReverse += _storage.Reverse;
            _events.OnInvokeRotateLeft += _storage.RotateLeft;
            _events.OnInvokeRotateRight += _storage.RotateRight;
            _events.OnInvokeSwap += _storage.Swap;
            _events.OnInvokeWipe += _storage.Wipe;
        }
 public PointSymbolConfigControl()
 {
     DefaultStyleKey = typeof(PointSymbolConfigControl);
     
     _opacityChangedTimer = new DispatcherTimer() { Interval = new TimeSpan(0, 0, 0, 0, 500) };
     _opacityChangedTimer.Tick += OpacityChangedTimer_Tick;
 }
Example #9
0
 void StartTimer()
 {
     timer = new DispatcherTimer();
     timer.Interval = TimeSpan.FromSeconds(5);
     timer.Tick += new EventHandler(timer_Elapsed);
     timer.Start();
 }
Example #10
0
        public OverviewViewModel()
        {
            today = DateTime.Today;

            timer = new DispatcherTimer();
            timer.Interval = TimeSpan.FromMinutes(1);
            timer.Tick += (sender, args) =>
                {
                    if (DateTime.Today <= today) return;

                    today = DateTime.Today;
                    UpdateHeaders();
                };
            timer.Start();

            ItemSelectionChangedCommand = new ActionCommand(ItemSelectionChanged);
            LinkCommand = new ActionCommand(ShowLink);
            LoadedCommand = new ActionCommand(Loaded);
            TodayCommand = new ActionCommand(_ => Show(MenuRepository.GetTodaysMenu()));
            ExpandAllCommand = new ActionCommand(_ => SetAllExpansion(true));
            CollapseAllCommand = new ActionCommand(_ =>
                {
                    SetAllSelection(false);
                    SetAllExpansion(false);
                });
        }
Example #11
0
        public WorkspaceViewModel()
        {
            var dataUnitLocator = ContainerAccessor.Instance.GetContainer().Resolve<IDataUnitLocator>();
            _workspaceDataUnit = dataUnitLocator.ResolveDataUnit<IWorkspaceDataUnit>();
            _crmDataUnit = dataUnitLocator.ResolveDataUnit<ICrmDataUnit>();
            _eventDataUnit = dataUnitLocator.ResolveDataUnit<IEventDataUnit>();

            var time = (int?)ApplicationSettings.Read("LogoutTime");
            _logoutTime = (time.HasValue && time.Value > 0) ? time.Value : 30; // 30 minutes - default logout time

            EventManager.RegisterClassHandler(typeof(Window), UIElement.KeyDownEvent, new RoutedEventHandler(Window_KeyDown));
            EventManager.RegisterClassHandler(typeof(Window), UIElement.MouseDownEvent, new RoutedEventHandler(Window_MouseDown));
            EventManager.RegisterClassHandler(typeof(Window), UIElement.MouseMoveEvent, new RoutedEventHandler(Window_MouseMove));
            EventManager.RegisterClassHandler(typeof(Window), UIElement.MouseWheelEvent, new RoutedEventHandler(Window_MouseWheel));

            _timer = new Timer(LogoutByInactivity, null, 1000 * 60 * _logoutTime, Timeout.Infinite);

            _updateTimer = new DispatcherTimer { Interval = TimeSpan.FromSeconds(30) };
            _updateTimer.Tick += UpdateTimer_Tick;

            _updateTimer.Start();

            _updateTimerEvents = new DispatcherTimer { Interval = TimeSpan.FromSeconds(30) };
            _updateTimerEvents.Tick += _updateTimerEvents_Tick;

            _updateTimerEvents.Start();
        }
Example #12
0
        public DocumentViewModel(
            IDialogService dialogService,
            IWindowManager windowManager,
            ISiteContextGenerator siteContextGenerator,
            Func<string, IMetaWeblogService> getMetaWeblog,
            ISettingsProvider settingsProvider,
            IDocumentParser documentParser)
        {
            this.dialogService = dialogService;
            this.windowManager = windowManager;
            this.siteContextGenerator = siteContextGenerator;
            this.getMetaWeblog = getMetaWeblog;
            this.settingsProvider = settingsProvider;
            this.documentParser = documentParser;

            FontSize = GetFontSize();

            title = "New Document";
            Original = "";
            Document = new TextDocument();
            Post = new Post();
            timer = new DispatcherTimer();
            timer.Tick += TimerTick;
            timer.Interval = delay;
        }
        public MainWindow()
        {
            InitializeComponent();

            Stream iconResource = Assembly.GetExecutingAssembly().GetManifestResourceStream("DateTimeConverter.Images.Clock.ico");
            this.Icon = BitmapFrame.Create(iconResource);

            this.menuItemExit.Click += MenuItemExit_Click;
            this.menuItemClear.Click += MenuItemClear_Click;
            this.menuItemGithub.Click += MenuItemGithub_Click;
            this.menuItemAbout.Click += MenuItemAbout_Click;

            this.dateTimeOnRemoteComputer.Value = DateTime.Now;
            this.dateTimeOnRemoteComputer.Format = Xceed.Wpf.Toolkit.DateTimeFormat.Custom;
            this.dateTimeOnRemoteComputer.FormatString = this.dateTimeFormatStr;
            this.dateTimeOnRemoteComputer.ValueChanged += DateTimeOnRemoteComputer_ValueChanged;

            this.dateTimeOfEvent.Value = DateTime.Now;
            this.dateTimeOfEvent.Format = Xceed.Wpf.Toolkit.DateTimeFormat.Custom;
            this.dateTimeOfEvent.FormatString = this.dateTimeFormatStr;
            this.dateTimeOfEvent.ValueChanged += DateTimeOfEvent_ValueChanged;

            this.UpdateCurrentTime();
            dispatcherTimer = new System.Windows.Threading.DispatcherTimer();
            dispatcherTimer.Tick += new EventHandler(DispatcherTimer_Tick);
            dispatcherTimer.Interval = new TimeSpan(0, 0, 1);
            dispatcherTimer.Start();
        }
Example #14
0
 public void StartTimer()
 {
     this.startTime = DateTime.Now;
     this.timer = new DispatcherTimer { Interval = TimeSpan.FromMilliseconds(10) };
     this.timer.Tick += this.OnTimerTick;
     this.timer.Start();
 }
        public DlGroupMigrationMain()
        {
            InitializeComponent();

            _timer = new DispatcherTimer { Interval = TimeSpan.FromSeconds(1)};
            _timer.Tick += _timer_Tick;
        }
Example #16
0
 public ClearMineGame()
 {
     timer = new DispatcherTimer() { Interval = new TimeSpan(0, 0, 0, 0, 100) };
     timer.Tick += OnTick;
     Settings.Default.PropertyChanged += OnSettingsChanged;
     MessageManager.SubscribeMessage<CellStateMessage>(OnCellStatusChanged);
 }
Example #17
0
 public ViewModel()
 {
     Current = this;
     PrimarySerial.NewMessageReceived += PrimarySerial_NewMessageReceived;
     if (IsDebugMode)
     {
         DispatcherTimer dt = new DispatcherTimer() { Interval = TimeSpan.FromSeconds(1) };
         dt.Tick += delegate
         {
             if (!IsRandomizerEnabled || Calibrator.ActiveCalibrationSub == null)
                 return;
             double val = 0;
             switch (Calibrator.CalibrationTarget)
             {
                 case CalibrationTarget.Pump:
                     weight = weight + rnd.NextDouble() * (double)Calibrator.ActiveCalibrationSub.Setpoint / 500000;
                     val = weight;
                     break;
                 case CalibrationTarget.Stirrer:
                     val = (0.7 * rnd.NextDouble() + 0.3) * (double)Calibrator.ActiveCalibrationSub.Setpoint / 60;
                     break;
             }
             if (Calibrator.ActiveCalibrationSub != null)
                 Calibrator.ActiveCalibrationSub.AddPoint(new DataPoint(DateTime.Now, val));
         };
         dt.Start();
     }
 }
Example #18
0
 public StartPage()
 {
     InitializeComponent();
     dispatcherTimer = new DispatcherTimer();
     dispatcherTimer.Interval = TimeSpan.FromMilliseconds(1);
     dispatcherTimer.Tick += new EventHandler(dispatcherTimer_Tick);
 }
 private void startclock()
 {
     DispatcherTimer timer = new DispatcherTimer();
     timer.Interval = TimeSpan.FromSeconds(1);
     timer.Tick += tickevent;
     timer.Start();
 }
 public UpdateProgressViewModel(UpdateManager updateManger,IProductUpdate productUpdate)
 {
     _updateManger = updateManger;
     _productUpdate = productUpdate;
     _dispatcherTimer = new DispatcherTimer(DispatcherPriority.Normal, Dispatcher.CurrentDispatcher);
     StartUpdateProgressTimer();
 }
 public MainWindow()
 {
     //img = new Image();
     //img.Source = new BitmapImage(new Uri(String.Format("pack://application:,,,/niespodzianka;component/Images/Banana/1.png"), UriKind.RelativeOrAbsolute));
     //img.Source = new BitmapImage(new Uri("pack://application:,,,/niespodzianka;component/Properties/Resources/cat1.png", UriKind.RelativeOrAbsolute));
     //img.Source = new BitmapImage(new Uri("pack://application:,,,/cat1", UriKind.RelativeOrAbsolute));
     //BitmapImage b = new BitmapImage(new Uri(@"/cat1.png", UriKind.Relative));
     //img.Source = new BitmapImage(new Uri(String.Format("pack://application:,,,/pwsg6;component/Images/{0}/{1}.png", animations[i],j), UriKind.RelativeOrAbsolute));
     wynik = 0;
     zolte = 0;
     godziny = 0;
     minuty = 0;
     sekundy = 0;
     tiki = 0;
     rozmiary = new int[] { 8, 8, 7, 9, 5, 7 };
     SizeX = 10;
     SizeY = 10;
     ksztalty = new Border[SizeY, SizeX];
     timer = new DispatcherTimer();
     timer.Interval = new TimeSpan(150 * 10000);
     timer.Tick += timer_Tick;
     InitializeComponent();
     timerLabel.Content = "Czas: 0:0:0";
     wynikLabel.Content = "Wynik: 0";
     RobPlansze();
     timer.Start();
 }
Example #22
0
        //========================================================================================
        // Constructors
        //========================================================================================
        /// <summary>
        /// This constructor must be called by implementors or the fading functionality
        /// will not work.
        /// </summary>
        public FadingWindow()
            : base()
        {
            this.Opacity = 0.0;

            // by setting it hidden, this hides the window from the Alt-Tab program switcher
            this.Visibility = Visibility.Hidden;

            DoubleAnimation animation = new DoubleAnimation(
                HiddenOpacity, VisibleOpacity, new Duration(TimeSpan.FromMilliseconds(300)));
            animation.BeginTime = TimeSpan.FromMilliseconds(100);
            animation.AutoReverse = false;

            this.fadeInStoryboard = new Storyboard();
            this.fadeInStoryboard.Children.Add(animation);
            this.fadeInStoryboard.Completed += new EventHandler(ShowCompleted);

            animation = new DoubleAnimation(
                VisibleOpacity, HiddenOpacity, new Duration(TimeSpan.FromMilliseconds(500)));
            animation.BeginTime = TimeSpan.FromMilliseconds(100);
            animation.AutoReverse = false;

            this.fadeOutStoryboard = new Storyboard();
            this.fadeOutStoryboard.Children.Add(animation);
            this.fadeOutStoryboard.Completed += new EventHandler(HideCompleted);

            this.timer = new DispatcherTimer();
            this.timer.Tick += new EventHandler(InitiateFadeOut);
            this.timer.Interval = DefaultFadeOutDelay;
        }
Example #23
0
        /*
         * Initializes the GUI components, creates the cells 2d array, and sets up the board/tiles/characters, etc.
         */
        public MainWindow()
        {
            InitializeComponent();
            setupBoard("testmap.txt");
            selectedCharacterRow = 0;
            selectedCharacterCol = 0;

            //For attack animation
            dispatcherTimer = new DispatcherTimer();
            dispatcherTimer.Tick += onUpdate;
            dispatcherTimer.Interval = TimePerFrame;

            //For testing purposes, characters added in this way. When the game is at the point where the hero data is taken from the world map, or
            //is global to the whole program, and setUpBoard() can read positions to add the characters, then they will be added in setUpBoard() rather than here.
            boardspaces[5, 3].tileCharacter = new SoftwareEngineer(5,3);
           
            refreshBoardSpace(5, 3);
            boardspaces[1, 2].tileCharacter = new SystemsAnalyst(1,2);
            refreshBoardSpace(1, 2);
            boardspaces[2, 2].tileCharacter = new NetworkArchitect(2, 2);
            refreshBoardSpace(2, 2);
            boardspaces[5, 5].tileCharacter = new CampusPolice(5, 5);
            refreshBoardSpace(5, 5);
            boardspaces[6, 5].tileCharacter = new CampusPolice(6, 5);
            refreshBoardSpace(6, 5);
            boardspaces[5, 1].tileCharacter = new CampusPolice(5, 1);
            refreshBoardSpace(5, 1);
            boardspaces[11, 9].tileCharacter = new CampusPolice(11,9);
            refreshBoardSpace(11, 9);
            boardspaces[13, 8].tileCharacter = new FoodServer(13,8);
            refreshBoardSpace(13, 8);
            boardspaces[14, 3].tileCharacter = new Gardener(14,3);
            refreshBoardSpace(14, 3);
        }
	private GitViewModel()
	{
		timer = new DispatcherTimer();
		timer.Interval = TimeSpan.FromMilliseconds(100);
		timer.Tick += new EventHandler(timer_Tick);
		timer.Start();
	}
        // Constructor
        public MainPage()
        {
            InitializeComponent();

            // Sample code to localize the ApplicationBar
            //BuildLocalizedApplicationBar();

            timer = new DispatcherTimer();
            timer.Tick += timer_Tick;
            timer.Interval = TimeSpan.FromMilliseconds(66);

            if (Accelerometer.IsSupported)
            {
                accelSensor = new Accelerometer();
                accelSensor.TimeBetweenUpdates = TimeSpan.FromMilliseconds(66);
            }

            if (Compass.IsSupported)
            {
                compassSensor = new Compass();
                compassSensor.TimeBetweenUpdates = TimeSpan.FromMilliseconds(66);
                compassSensor.Calibrate += compassSensor_Calibrate;
            }

            if (Gyroscope.IsSupported)
            {
                gyroSensor = new Gyroscope();
                gyroSensor.TimeBetweenUpdates = TimeSpan.FromMilliseconds(66);
            }
        }
Example #26
0
 public PictureController()
 {
     slideShowTimer = new DispatcherTimer();
     Duration = new Duration(TimeSpan.FromSeconds(5));
     slideShowTimer.Interval = Duration.TimeSpan;
     slideShowTimer.Tick += new EventHandler(slideShowTimer_Tick);
 }
 public StopSelectionViewModel(IUnitOfWork unitOfWork, AppUse appUse, INavigationService navigationService)
     : base(appUse, ApplicationPage.StopSelection, unitOfWork, navigationService)
 {
     this.timerSearch = new DispatcherTimer();
     this.timerSearch.Interval = new TimeSpan(0, 0, 1);
     this.timerSearch.Tick += TimerTickSearch;
 }
Example #28
0
        public Paper()
        {
            // paper properties
            Background = new SolidColorBrush(Colors.White);
            Cursor = Cursors.IBeam;

            // setup caret
            caret = new Rectangle();
            caret.Fill = new SolidColorBrush(Colors.Black);
            caret.Height = 12;
            caret.Width = 1;
            caret.Margin = new Thickness(-1, 0, 0, 0);

            // setup caret timer
            caretTimer = new DispatcherTimer();
            caretTimer.Interval = TimeSpan.FromSeconds(0.5);
            caretTimer.Tick += delegate { caret.Visibility = (caret.Visibility == Visibility.Visible || !ShowCaret) ? Visibility.Collapsed : Visibility.Visible; };
            caretTimer.Start();

            // setup highlighting indicies
            HighlightedBlocks = new List<Character>();
            HighlightFromIndex = new Index(0, 0);
            HighlightToIndex = new Index(0, 0);

            // events
            MouseLeftButtonDown += Paper_MouseLeftButtonDown;
            MouseLeftButtonUp += Paper_MouseLeftButtonUp;
        }
Example #29
0
    public TestSuiteDialog(bool isCreate, TestSuiteVm baseTestSuite, Settings settings)
    {
      _baseTestSuite = baseTestSuite;

      _assembliesChangedTimer          = new DispatcherTimer();
      _assembliesChangedTimer.Interval = TimeSpan.FromSeconds(1.3);
      _assembliesChangedTimer.Tick    += _assembliesEdit_timer_Tick;

      _libsChangedTimer          = new DispatcherTimer();
      _libsChangedTimer.Interval = TimeSpan.FromSeconds(1.3);
      _libsChangedTimer.Tick    += _libsEdit_timer_Tick;

      DataContext = _model = new TestSuiteCreateOrEditModel(settings, isCreate, baseTestSuite?.DisableSemanticAnalysis ?? false);

      InitializeComponent();

      if (baseTestSuite != null)
      {
        _model.RootFolder           = baseTestSuite.Solution.RootFolder;
        _model.SuiteName            = baseTestSuite.Name;
        _model.NormalizedAssemblies = baseTestSuite.Assemblies;
        _model.NormalizedLibs       = baseTestSuite.Libs;

        if (baseTestSuite.Language != Nitra.Language.Instance)
          _model.SelectedLanguage = baseTestSuite.Language;
      }

      _assemblies.Text = _model.NormalizedAssembliesText;
      _assemblies.TextChanged += _assemblies_TextChanged;

      _libs.Text = _model.NormalizedLibsText;
      _libs.TextChanged += _libs_TextChanged;
    }
Example #30
0
 public ClockTimer()
 {
     this._dispatcherTimer = new DispatcherTimer();
       this._dispatcherTimer.Tick += dispatcherTimer_Tick;
       this._dispatcherTimer.Interval = new TimeSpan(0, 0, 1);
       this._dispatcherTimer.Start();
 }