Start() public method

public Start ( ) : void
return void
        public MainWindow()
        {
            InitializeComponent();


            DispatcherTimer timer = new DispatcherTimer();
            Random rnd = new Random();
            timer.Interval = TimeSpan.FromSeconds(1.0);
            timer.Tick += (s, e) =>
                {
                    TestTimer++;

                    TestBackground = new SolidColorBrush(Color.FromRgb(
                        (byte)rnd.Next(0, 255), (byte)rnd.Next(0, 255), (byte)rnd.Next(0, 255)));

                    FocusedElement = Keyboard.FocusedElement == null ? string.Empty : Keyboard.FocusedElement.ToString();
                    //Debug.WriteLine(string.Format("ActiveContent = {0}", dockManager.ActiveContent));

                };
            timer.Start();

            this.DataContext = this;

            winFormsHost.Child = new UserControl1();

        }
Example #2
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 ();
        }
Example #3
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 #4
0
        private static void Subscribe(DataGrid dataGrid)
        {
            if (infoDict.ContainsKey(dataGrid))
                return;

            var timer = new DispatcherTimer(DispatcherPriority.Background);
            var handler = new NotifyCollectionChangedEventHandler((sender, eventArgs) => timer.Start());

            infoDict.Add(dataGrid, new DataGridInfo(handler, timer));

            timer.Tick += (sender, args) => ScrollToEnd(dataGrid);
            ((INotifyCollectionChanged)dataGrid.Items).CollectionChanged += handler;
            
            timer.Start();
        }
 private void InitializeTimer()
 {
     _timer = new DispatcherTimer();
     _timer.Tick += (sender, args) => this.Close();
     _timer.Interval = new TimeSpan(0, 0, 5);
     _timer.Start();
 }
Example #6
0
 void StartTimer()
 {
     timer = new DispatcherTimer();
     timer.Interval = TimeSpan.FromSeconds(5);
     timer.Tick += new EventHandler(timer_Elapsed);
     timer.Start();
 }
Example #7
0
 public  void startTimer()
  {
      timer = new DispatcherTimer();
      timer.Interval = TimeSpan.FromSeconds(1);
      timer.Tick += new EventHandler(timer_Tick);
      timer.Start();
  }
Example #8
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();
        }
 private void StartTimer()
 {
     DispatcherTimer dt = new DispatcherTimer();
     dt.Interval = new TimeSpan(0, 0, 1);
     dt.Tick += timer_Tick;
     dt.Start();
 }
Example #10
0
 private void setupTimer()
 {
     _timer = new DispatcherTimer(DispatcherPriority.Input);
     _timer.Interval = new TimeSpan(0, 0, 0, 0, 100);
     _timer.Tick += timerCallBack;
     _timer.Start();
 }
        public void Initialize()
        {
            HTTPConfigurationProvider configurationProvider = new HTTPConfigurationProvider();
            _community = new Community(IsolatedStorageStorageStrategy.Load())
                .AddAsynchronousCommunicationStrategy(new BinaryHTTPAsynchronousCommunicationStrategy(configurationProvider))
                .Register<CorrespondenceModel>();

            _domain = _community.AddFact(new Domain("Improving Enterprises"));
            _community.Subscribe(_domain);

            // Synchronize whenever the user has something to send.
            _community.FactAdded += delegate
            {
                _community.BeginSending();
            };

            // Periodically resume if there is an error.
            DispatcherTimer synchronizeTimer = new DispatcherTimer();
            synchronizeTimer.Tick += delegate
            {
                _community.BeginSending();
                _community.BeginReceiving();
            };
            synchronizeTimer.Interval = TimeSpan.FromSeconds(60.0);
            synchronizeTimer.Start();

            // And synchronize on startup.
            _community.BeginSending();
            _community.BeginReceiving();
        }
        public NotificationWindow(Stream stream, IEventAggregator eventAggregator)
        {
            _eventAggregator = eventAggregator;
            this.InitializeComponent();
            this.DataContext = stream;

            var point = CalculateTopAndLeft();

            this.Left = point.X;
            this.Top = point.Y;
            calculatedTop = Top;

            var numNotifications = AppLogic.NotificationWindows.Count;
            if (numNotifications > 0)
            {
                this.Top = AppLogic.NotificationWindows[numNotifications - 1].calculatedTop - this.Height;
                calculatedTop = Top;
            }
            AppLogic.NotificationWindows.Add(this);
            this.Opacity = 0.9;
            //            this.Topmost = false;
            this.Show();

            if (ConfigManager.Instance.NotificationTimeout > 0)
            {
                dispatcherTimer = new DispatcherTimer();

                //                Random a = new Random();
                //                dispatcherTimer.Interval = TimeSpan.FromSeconds(a.Next(15) + 5);

                dispatcherTimer.Interval = TimeSpan.FromSeconds(ConfigManager.Instance.NotificationTimeout);
                dispatcherTimer.Tick += DispatcherTimerOnTick;
                dispatcherTimer.Start();
            }
        }
		private GitViewModel()
		{
			timer = new DispatcherTimer();
			timer.Interval = TimeSpan.FromMilliseconds(100);
			timer.Tick += new EventHandler(timer_Tick);
			timer.Start();
		}
Example #14
0
        public HouseS()
        {
            InitializeComponent();

            initLabels();
            DataTable dt = new DataTable("MajmooeF");
            DataColumn[] dc = new DataColumn[]
            {
                new DataColumn("طبقه"),
                new DataColumn("نوع ملک"),
                new DataColumn("متراژ مفید"),
                new DataColumn("خوابها"),
                new DataColumn("آشپزخانه"),
                new DataColumn("کفپوش")
            };
            dt.Columns.AddRange(dc);
            gridView.DataSource = dt;
            //gridView.Parent = 
            
            textBox1.Focus();

            price = new DispatcherTimer();
            price.Tick += new EventHandler(price_Tick);
            price.Interval = TimeSpan.FromSeconds(1);
            price.Start();

            WndConfig.setConfiguration(this);
        }
Example #15
0
 void MainWindow_Loaded(object sender, RoutedEventArgs e)
 {
     timer = new DispatcherTimer();
     timer.Interval = TimeSpan.FromMilliseconds(1);
     timer.Tick += new EventHandler(timer_Tick);
     timer.Start();
 }
Example #16
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();
     }
 }
        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();
        }
 private void startclock()
 {
     DispatcherTimer timer = new DispatcherTimer();
     timer.Interval = TimeSpan.FromSeconds(1);
     timer.Tick += tickevent;
     timer.Start();
 }
Example #19
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;
        }
 private void UserControl_Loaded(object sender, RoutedEventArgs e)
 {
     myTimer=new DispatcherTimer();
     myTimer.Tick += new EventHandler(myTimer_Tick);
     myTimer.Interval = new TimeSpan(0, 0, 0, 0, 500);
     myTimer.Start();
 }
		public void Start()
		{
			timer = new DispatcherTimer(DispatcherPriority.Background);
			timer.Interval = TimeSpan.FromSeconds(1.5);
			timer.Tick += TimerTick;
			timer.Start();
		}
 public MainWindow()
 {
     //img = new Image();
     //img.Source = new BitmapImage(new Uri(String.Format("pack://*****:*****@"/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();
 }
 public static void HealthCheck(Action healthyBehaviour)
 {
     var currentStack = new System.Diagnostics.StackTrace();
     Application.Current.Dispatcher.BeginInvoke((Action)delegate
     {
         try
         {
             foreach (var server in SERVERS)
                 server.ok = false;
             checkServers();
             int attempts = 0;
             const int MILIS_BETWEEN_TRIES = 500;
             var timer = new DispatcherTimer(TimeSpan.FromMilliseconds(MILIS_BETWEEN_TRIES), DispatcherPriority.Normal,
             (sender, args) =>
             {
                 var brokenServers = SERVERS.Where(s => !s.ok);
                 attempts++;
                 if (brokenServers.Count() == 0)
                 {
                     self.Visibility = Visibility.Collapsed;
                     ((DispatcherTimer)sender).Stop();
                     healthyBehaviour();
                 }
             }, Application.Current.Dispatcher);
             timer.Start();
         }
         catch (Exception e)
         {
             throw new Exception(currentStack.ToString(), e);
         }
     });
 }
Example #24
0
        // 构造函数
        public MainPage()
        {
            InitializeComponent();

            app.str_Uri = null;

            #region 计时
            txtb_Time = new TextBlock();
            Canvas.SetLeft(txtb_Time, 350);
            Canvas.SetTop(txtb_Time, 0);
            Carrier.Children.Add(txtb_Time);
            this.txtb_Time.Text = count.ToString();//开始时为00:00:00
            this.timer.Tick += Timer_Tick;//时间控件timer,事件Tick,类似线程
            this.timer.Interval = TimeSpan.FromMilliseconds(100);//每100毫秒变化一次
            StartTime = DateTime.UtcNow;
            this.timer.Start();//控件timer开始计时,类似线程开始
            #endregion

            #region 判断是否游戏结束
            dispatcherTimerChecked = new DispatcherTimer();
            dispatcherTimerChecked.Tick += new EventHandler(dispatcherTimerChecked_Tick);
            dispatcherTimerChecked.Interval = TimeSpan.FromMilliseconds(50);
            dispatcherTimerChecked.Start();
            #endregion
        }
		/// <summary>
		/// Создать <see cref="AdvertisePanel"/>.
		/// </summary>
		public AdvertisePanel()
		{
			InitializeComponent();

			if (DesignerProperties.GetIsInDesignMode(this))
				return;

			_client = ConfigManager.TryGetService<NotificationClient>() ?? new NotificationClient();
			_client.NewsReceived += OnNewsReceived;

			var sizes = new[] { 10, 20, 30, 40, 50, 60, 70, 110, 120 };

			_parser = new BBCodeParser(new[]
			{
				new BBTag("b", "<b>", "</b>"),
				new BBTag("i", "<span style=\"font-style:italic;\">", "</span>"),
				new BBTag("u", "<span style=\"text-decoration:underline;\">", "</span>"),
				new BBTag("center", "<div style=\"align:center;\">", "</div>"),
				new BBTag("size", "<span style=\"font-size:${fontSize}%;\">", "</div>", new BBAttribute("fontSize", "", c => sizes[c.AttributeValue.To<int>()].To<string>())),
				new BBTag("code", "<pre class=\"prettyprint\">", "</pre>"),
				new BBTag("img", "<img src=\"${content}\" />", "", false, true),
				new BBTag("quote", "<blockquote>", "</blockquote>"),
				new BBTag("list", "<ul>", "</ul>"),
				new BBTag("*", "<li>", "</li>", true, false),
				new BBTag("url", "<a href=\"${href}\">", "</a>", new BBAttribute("href", ""), new BBAttribute("href", "href")),
			});

			_timer = new DispatcherTimer();
			_timer.Tick += OnTick;
			_timer.Interval = new TimeSpan(0, 1, 0);
			_timer.Start();
		}
Example #26
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;
        }
 // Constructor.
 public ClockTicker()
 {
     DispatcherTimer timer = new DispatcherTimer();
     timer.Tick += TimerOnTick;
     timer.Interval = TimeSpan.FromSeconds(0.10);
     timer.Start();
 }
Example #28
0
        private void UserControl_Loaded(object sender, RoutedEventArgs e)
        {
            if (!m_LoadedOnce)
            {
                try
                {
                    _Schiphol_ACXS_ScriptDataSet = ((_Schiphol_ACXS_ScriptDataSet)(this.FindResource("_Schiphol_ACXS_ScriptDataSet")));
                    // Load data into the table Container. You can modify this code as needed.
                    _Schiphol_ACXS_ScriptDataSetContainerTableAdapter = new _Schiphol_ACXS_ScriptDataSetTableAdapters.ContainerTableAdapter();

                    _Schiphol_ACXS_ScriptDataSetContainerTableAdapter.Connection.ConnectionString = m_sysConfig.ContainerDBConnectionString;
                    _Schiphol_ACXS_ScriptDataSetContainerTableAdapter.ClearBeforeFill = true;
                    _Schiphol_ACXS_ScriptDataSetContainerTableAdapter.Fill(_Schiphol_ACXS_ScriptDataSet.Container);
                    System.Windows.Data.CollectionViewSource containerViewSource = ((System.Windows.Data.CollectionViewSource)(this.FindResource("containerViewSource")));
                    containerViewSource.View.MoveCurrentToFirst();

                    updateDataGrid1Timer = new DispatcherTimer();
                    updateDataGrid1Timer.Interval = new TimeSpan(0, 0, 0, 0, m_sysConfig.ContainerRefreshPeriodmsecs);
                    updateDataGrid1Timer.Tick += new EventHandler(updateDataGrid1Timer_Tick);
                    updateDataGrid1Timer.Start();
                    m_LoadedOnce = true;
                }
                catch { }
            }
        }
Example #29
0
        // Constructor
        public MainPage()
        {
            InitializeComponent();

            DispatcherTimer timer = new DispatcherTimer();
            // Run it a little faster than our buffer updates
            timer.Interval = TimeSpan.FromMilliseconds(80);
            timer.Tick += OnTimerTick;
            timer.Start();
            FrameworkDispatcher.Update();

            // Add in the event handler for when a new buffer of audio is available
            audioIn.BufferReady += new EventHandler<EventArgs>(Microphone_BufferReady);

            // XNA is limited to 100ms latency. :(
            audioIn.BufferDuration = TimeSpan.FromMilliseconds(100);

            // Create a buffer of the appropriate length
            int bufferLen = audioIn.GetSampleSizeInBytes(audioIn.BufferDuration);
            audioBuffer = new byte[bufferLen];

            // Create our audio out interface with the same samplerate and channels of the audio input
            // We couldn't create this above because we needed to get audioIn.SampleRate
            audioOut = new DynamicSoundEffectInstance(audioIn.SampleRate, AudioChannels.Mono);

            // Start recording and playing
            audioIn.Start();
            audioOut.Play();
        }
Example #30
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);
                });
        }
        /// <summary>
        /// 开始
        /// </summary>
        /// <param name="totalHours">总共多少小时</param>
        /// <param name="minuteSpeed">分针多少秒钟一圈</param>
        public void Start(double totalHours, double minuteSpeed = 1.0)
        {
            Dispatcher.Invoke((Action) delegate()
            {
                this.TotalHours  = totalHours;
                this.MinuteSpeed = minuteSpeed;
                this.MinuteAngle = -90;
            });

            timer       = new DispatcherTimer();
            timer.Tick += timer_Tick;

            //获得分针运动的速度:秒数和毫秒数
            double minute = minuteSpeed / 8.0;

            timer.Interval = new TimeSpan(0, 0, 0, (int)Math.Truncate(minute), ((int)Math.Truncate(minute * 1000) % 1000));
            startTime      = DateTime.Now;
            timer.Start();
        }
Example #32
0
        public MainWindow()
        {
            InitializeComponent();
            x.DispatcherTimer dispatcherTimer = new System.Windows.Threading.DispatcherTimer();
            dispatcherTimer.Tick += dispatcherTimer_Tick;
            //dispatcherTimer.Interval = TimeSpan.FromSeconds(1);
            dispatcherTimer.Interval = TimeSpan.FromMilliseconds(500);
            dispatcherTimer.Start();

            size = canvas.Width / 2;

            hipotenusaHora    = size * 0.81;
            hipotenusaMinuto  = size * 0.61;
            hipotenusaSegundo = size * 0.45;

            for (int i = 0; i < 24; i++)
            {
                mostrahoras(i);
            }

            for (int i = 0; i < 60; i++)
            {
                mostraminutos(i);
            }

            for (int i = 0; i < 60; i++)
            {
                mostrasegundos(i);
            }

            PonteiroHoras.X1 = size;    //centro x horas
            PonteiroHoras.Y1 = size;    //centro y horas

            PonteiroMinutos.X1 = size;  //centro x minutos
            PonteiroMinutos.Y1 = size;  //centro y minutos

            PonteiroSegundos.X1 = size; //centro segundos
            PonteiroSegundos.Y1 = size; // centro segundos

            //setTime(0, 0, 0);
            setNow();
        }
Example #33
0
        private void OnStartButtonCommandExecuted(object obj)
        {
            var customer = obj as Customer;

            if (customer != null)
            {
                customer.IsDispacherTimerRunning = true;
                customer.IsStartButtonEnabled    = false;
                //customer.ElapsedTime.Start();

                System.Windows.Threading.DispatcherTimer myDispatcherTimer =
                    new System.Windows.Threading.DispatcherTimer();
                myDispatcherTimer.Interval = new TimeSpan(0, 0, 0, 0, 1); // 1 second
                myDispatcherTimer.Tick    -= (s, args) => Each_Tick(customer, myDispatcherTimer);
                myDispatcherTimer.Tick    += (s, args) => Each_Tick(customer, myDispatcherTimer);
                myDispatcherTimer.Start();

                //customer.Counter = counter;
            }
        }
Example #34
0
 private void Start_game()
 {
     timer.Start();
     foreach (Enemy_box E in enemies)
     {
         E.Hp         = 100;
         E.X          = E.Margin.Left; //rnd.Next(0, Convert.ToInt32(game_background.ActualWidth));
         E.Y          = E.Margin.Top;  //rnd.Next(0, Convert.ToInt32(game_background.ActualHeight));
         E.Margin     = new Thickness(E.X, E.Y, 0, 0);
         E.Speed      = rnd.Next(1, 15);
         E.Visibility = Visibility.Visible;
     }
     scope.Visibility           = Visibility.Visible;
     score                      = 0;
     time                       = 0;
     shooted                    = 0;
     time_info.Visibility       = Visibility.Visible;
     score_box.Visibility       = Visibility.Visible;
     gamestatus_text.Visibility = Visibility.Hidden;
 }
        /// <summary>
        /// Konstruktor realizuje wyświetlenie danych z bazy i wywołuje zmianę
        /// obrazu.
        /// </summary>
        /// <remarks>
        /// <para>Konstruktor realizuje wyświetlenie danych z bazy, wywołuje
        /// zmianę obrazu i inicjalizuje klienta API.</para>
        /// </remarks>
        public DispatcherTimersetup()
        {
            InitializeComponent();
            Trip_planerDBEntities db = new Trip_planerDBEntities();
            // wyswietlenie danych z bazy
            var ulubione = from ulub in db.Ulubione_tabela select ulub;

            grid_ulubione.ItemsSource = ulubione.ToList();
            var ostatnie = from ost in db.Ostatnie_tabela select ost;

            grid_ostatnie.ItemsSource = ostatnie.ToList();
            API.Initialize_Client();

            // wykonwyanie co 15 sekund - zmiana obrazka
            DispatcherTimer dispatcherTimer = new System.Windows.Threading.DispatcherTimer();

            dispatcherTimer.Tick    += new EventHandler(dispatcherTimer_Tick);
            dispatcherTimer.Interval = new TimeSpan(0, 0, 15);
            dispatcherTimer.Start();
        }
Example #36
0
        public MainWindow()
        {
            InitializeComponent();
            //initialize scoreDisplay as zero
            scoreDisplay.Text = "Score: " + score;

            //DispatcherTimer setup
            DispatcherTimer dispatcherTimer = new System.Windows.Threading.DispatcherTimer();

            dispatcherTimer.Tick    += new EventHandler(dispatcherTimer_Tick);
            dispatcherTimer.Interval = new TimeSpan(0, 0, 0, 0, 1);
            dispatcherTimer.Start();

            //move catcher
            catcher.KeyDown  += new KeyEventHandler(catcher_KeyDown);
            catcher.Focusable = true;
            catcher.IsEnabled = true;
            catcher.Focus();
            Canvas.SetZIndex(catcher, 10000);
        }
Example #37
0
        private void snapshotBtn_Click(object sender, RoutedEventArgs e)
        {
            if (null == this.sensor)
            {
                //this.statusBarText.Text = Properties.Resources.ConnectDeviceFirst;
                return;
            }


            snapshotBtn.Visibility             = Visibility.Hidden;
            countDownFrame.Content             = new Timers.Timer();
            countDownFrame.Visibility          = Visibility.Visible;
            countDownFrame.HorizontalAlignment = HorizontalAlignment.Center;

            DispatcherTimer dispatcherTimer = new System.Windows.Threading.DispatcherTimer();

            dispatcherTimer.Tick    += new EventHandler(dispatcherTimer_Tick);
            dispatcherTimer.Interval = new TimeSpan(0, 0, 10);
            dispatcherTimer.Start();
        }
Example #38
0
        public MainWindow()
        {
            InitializeComponent();

            Volume = Properties.Settings.Default.VOLUME;

            MemoryStream ms = new MemoryStream();

            (Properties.Resources.rss_circle_color).Save(ms);
            BitmapImage image = new BitmapImage();

            image.BeginInit();
            ms.Seek(0, SeekOrigin.Begin);
            image.StreamSource = ms;
            image.EndInit();


            Icon = image;

            notifyIcon         = new SimpleTrayIcon(this, Properties.Resources.rss_circle_color);
            notifyIcon.Visible = true;

            WindowState = WindowState.Minimized;
            Visibility  = Visibility.Hidden;
            try
            {
                string    olddata = File.ReadAllText(OLD_DATA_FILE_NAME);
                XDocument doc     = XDocument.Parse(olddata);
                oldCourseList = XDocToILIASCourseList(doc);
            }
            catch (Exception)
            {
            }
            getDataAndCompareWithOld();

            DispatcherTimer dispatcherTimer = new System.Windows.Threading.DispatcherTimer();

            dispatcherTimer.Tick    += new EventHandler(dispatcherTimer_Tick);
            dispatcherTimer.Interval = new TimeSpan(0, 0, 1, 0);
            dispatcherTimer.Start();
        }
Example #39
0
        void countDown(int count, TimeSpan interval, Action <int> ts, string file, string destiFile)
        {
            var dt = new System.Windows.Threading.DispatcherTimer();

            dt.Interval = interval;
            dt.Tick    += (_, a) =>
            {
                if (count-- == 0)
                {
                    dt.Stop();
                    File.Move(file, destiFile);
                }
                else
                {
                    ts(count);
                    lb_time.Text = count.ToString();
                }
            };
            ts(count);
            dt.Start();
        }
        void Countdown(int count, TimeSpan interval, Action <int> ts)
        {
            var dt = new System.Windows.Threading.DispatcherTimer();

            dt.Interval = interval;
            dt.Tick    += (_, a) =>
            {
                if (count-- == 0 && quitted == false)
                {
                    dt.Stop();
                    endgame();
                }

                else
                {
                    ts(count);
                }
            };
            ts(count);
            dt.Start();
        }
Example #41
0
        public TrainerInfoViewer()
        {
            InitializeComponent();

            DispatcherTimer dispatcherTimer = new System.Windows.Threading.DispatcherTimer();

            dispatcherTimer.Tick    += OnTick;
            dispatcherTimer.Interval = new TimeSpan(0, 0, 1);
            dispatcherTimer.Start();

            CreateContextMenu();

            buttonMoney.ContextMenu     = contextMenu;
            buttonCoins.ContextMenu     = contextMenu;
            buttonBattlePts.ContextMenu = contextMenu;
            buttonCoupons.ContextMenu   = contextMenu;
            buttonSoot.ContextMenu      = contextMenu;

            gridBadges.Visibility   = Visibility.Hidden;
            gridSettings.Visibility = Visibility.Hidden;
        }
Example #42
0
        private void Check_internet_connetion(string url)
        {
            //Check Internet Connection Is Present Or Not
            DispatcherTimer DispatcherTimer1 = new System.Windows.Threading.DispatcherTimer();

            try
            {
                System.Net.WebRequest  myRequest  = System.Net.WebRequest.Create(url);
                System.Net.WebResponse myResponse = myRequest.GetResponse();
                Net_Connection.Fill = new SolidColorBrush(Colors.Green);
                //Connection is ok time stop
                DispatcherTimer1.Stop();
            }
            catch (System.Net.WebException)
            {
                Net_Connection.Fill       = new SolidColorBrush(Colors.Red);
                DispatcherTimer1.Tick    += new EventHandler(dispatcherTimer_Tick);
                DispatcherTimer1.Interval = new TimeSpan(0, 0, 10);
                DispatcherTimer1.Start();
            }
        }
Example #43
0
        /// <summary>
        /// Se inicializan Componentes de la vista.
        /// </summary>
        public Page1()
        {
            InitializeComponent();
            try
            {
                if (HayConexiónInternet())
                {
                    WS = new WSSemanticSearchSoapClient();
                }


                DispatcherTimer timerConexionInternet;
                timerConexionInternet          = new System.Windows.Threading.DispatcherTimer();
                timerConexionInternet.Tick    += new EventHandler(ConexionInternet_TimerTick); //Se establece a quien se va a estar invocando
                timerConexionInternet.Interval = new TimeSpan(0, 0, tSegundosHayInternet);     //Se establece intervalos de tiempo (t = 4)
                timerConexionInternet.Start();
            }
            finally
            {
            }
        }
Example #44
0
        public MainWindow()
        {
            InitializeComponent();

            // Creating Timer for Changing Background
            DispatcherTimer ColorTimer = new System.Windows.Threading.DispatcherTimer();

            ColorTimer.Tick += new EventHandler(ChangeColor);
            DispatcherTimer MenuTimer = new System.Windows.Threading.DispatcherTimer();

            MenuTimer.Tick += new EventHandler(MenuText);

            // Setting Intervals of Timers
            MenuTimer.Interval = new TimeSpan(0, 0, 1);

            // Creating Timers
            MenuTimer.Start();
            ColorTimer.Start();

            GradientStop.Offset = 0.0;
        }
Example #45
0
        //public void AddUrl(string temp, string folder = "", string title = "")
        //{


        //    var list = temp.Split('\n');

        //    foreach (var item in list)
        //    {
        //        Uri uriResult;


        //        var list2 = item.Split('\t');
        //        string url = list2[0];

        //        bool result = Uri.TryCreate(url, UriKind.Absolute, out uriResult);
        //        if (result == false)
        //        {
        //            continue;
        //        }

        //        if (uriResult.Scheme == Uri.UriSchemeHttp || uriResult.Scheme == Uri.UriSchemeHttps)
        //        {
        //            //string ext = Util.GetExtension(url);
        //            //if (Util.IsMovie(ext) || Util.IsPicture(ext))
        //            {
        //                //Console.WriteLine(temp);
        //                _dispatcher.BeginInvoke(new Action(() =>
        //                {
        //                    string protocol = "HTTP";
        //                    string ext = Util.GetExtension(url);
        //                    if(Util.IsLive(ext))
        //                    {
        //                        protocol = "LIVE";
        //                    }
        //                    DownloadData data = new DownloadData
        //                    {
        //                        URL = url,
        //                        Folder = folder,
        //                        Title = title,
        //                        Protocol = protocol

        //                    };


        //                    viewmodel.AddFile(data);

        //                }), (DispatcherPriority)10);
        //            }
        //        }


        //    }

        //}

        public MainWindow()
        {
            InitializeComponent();
            this.Closing    += MainWindow_Closing;
            viewmodel        = DownloadFileViewModel.SharedViewModel();;
            this.DataContext = viewmodel;

            viewmodel.DownloadFolder = Directory.GetCurrentDirectory() + "\\Download";

            IPCTestServer.IPCTestServer.SetWindow(this);


            new Thread(() =>
            {
                var server = new MyServer();
            }).Start();

            //if (false)
            //{
            //    cbw = new ClipBoardWatcher();
            //    cbw.DrawClipBoard += (sender, e) =>
            //    {



            //        if (Clipboard.ContainsText())
            //        {
            //            string temp = Clipboard.GetText();
            //            AddUrl(temp);


            //        }
            //    };
            //}

            System.Windows.Threading.DispatcherTimer dispatcherTimer = new System.Windows.Threading.DispatcherTimer();
            dispatcherTimer.Tick    += dispatcherTimer_Tick;
            dispatcherTimer.Interval = new TimeSpan(0, 0, 1);
            dispatcherTimer.Start();
        }
Example #46
0
        protected override void OnInitialized(EventArgs e)
        {
            base.OnInitialized(e);

            for (int i = 0; i < numberDots; i++)
            {
                lines[i] = new Line()
                {
                    Stroke = new SolidColorBrush(Color.FromArgb((byte)((155f / numberDots * i) + 50), 225, 94, 255)), StrokeThickness = 2
                };
                Board.Children.Add(lines[i]);

                dots[i] = new Ellipse()
                {
                    Fill = new SolidColorBrush(Color.FromArgb((byte)((155f / numberDots * i) + 100), (byte)(180f / numberDots * i), (byte)(i / numberDots * 150f), 255)), Width = 15, Height = 15
                };
                Board.Children.Add(dots[i]);
            }

            KeyDown += (o, e) =>
            {
                if (_timer.IsEnabled)
                {
                    _timer.Stop();
                }
                else
                {
                    _timer.Start();
                }
            };

            Size             = 1.8f;
            SizeSlider.Value = Size;

            _timer          = new System.Windows.Threading.DispatcherTimer(DispatcherPriority.Normal);
            _timer.Interval = new TimeSpan(0, 0, 0, 0, 5);
            _timer.Tick    += _timer_Tick;
            _timer.Start();
        }
Example #47
0
        protected override void OnContentRendered(EventArgs e)
        {
            // Adds the picture
            _pct         = new Picture(Plane.XY, 100, 100, new Bitmap("../../../../../../dataset/Assets/Pictures/AnimPic1.png"));
            _pct.Lighted = false;
            model1.Entities.Add(_pct);

            // Adds the custom circle
            MyCircle c1 = new MyCircle(68, 11, 0, 46);

            model1.Entities.Add(c1, System.Drawing.Color.Red);

            // Adds the custom lines
            MyLine myLn1 = new MyLine(c1.Center.X - c1.Radius * 1.1, c1.Center.Y, c1.Center.X + c1.Radius * 1.1, c1.Center.Y);

            myLn1.LineTypeMethod = colorMethodType.byEntity;
            myLn1.LineTypeName   = "DashDot";
            model1.Entities.Add(myLn1, System.Drawing.Color.Green);

            MyLine myLn2 = new MyLine(c1.Center.X, c1.Center.Y - c1.Radius * 1.1, c1.Center.X, c1.Center.Y + c1.Radius * 1.1);

            myLn2.LineTypeMethod = colorMethodType.byEntity;
            myLn2.LineTypeName   = "DashDot";
            model1.Entities.Add(myLn2, System.Drawing.Color.Green);

            // Sets top view and fits the model in the viewport
            model1.SetView(viewType.Top, true, false);

            // Refreshes the model control
            model1.Invalidate();

            // Starts the timer to update the picture
            _timer          = new DispatcherTimer(DispatcherPriority.Normal);
            _timer.Tick    += Timer_Tick1;
            _timer.Interval = TimeSpan.FromMilliseconds(120);
            _timer.Start();

            base.OnContentRendered(e);
        }
Example #48
0
        private void SetUpdateTimer()
        {
            var timer = new System.Windows.Threading.DispatcherTimer();

            timer.Interval = TimeSpan.FromMilliseconds(250);
            timer.Tick    += (e, s) =>
            {
                if (audioplayer.Status != PlayerStatus.Play)
                {
                    return;
                }

                var pos    = audioplayer.Position;
                var length = audioplayer.Duration;

                CurrentTime = pos.ToString(@"hh\:mm\:ss");
                double proc = pos.TotalMilliseconds / length.TotalMilliseconds * 100d;

                CurrentPosition = proc;
            };
            timer.Start();
        }
Example #49
0
        protected override void OnBackKeyPress(System.ComponentModel.CancelEventArgs e)
        {
            ContentPanel.Visibility = System.Windows.Visibility.Collapsed;
            Quit.Visibility         = System.Windows.Visibility.Visible;
            BackTimerCounter        = 3;

            if (BonusTimerCounter <= 0)
            {
                MainTimer.Stop();
            }
            else
            {
                BonusTimer.Stop();
            }

            BackKeyTimer.Start();

            if (BackTimerCounter == 3)
            {
                e.Cancel = true;
            }
        }
Example #50
0
        private void Window_Loaded(object sender, RoutedEventArgs e)
        {
            System.Windows.Threading.DispatcherTimer timer = new System.Windows.Threading.DispatcherTimer();

            timer.Tick    += new EventHandler(timerTick);
            timer.Interval = new TimeSpan(0, 0, 0, 1);
            timer.Start();
            GridFaier.Visibility = Visibility.Hidden;
            GridDedus.Visibility = Visibility.Hidden;

            ExitImage.Visibility      = Visibility.Hidden;
            ChetForm.Visibility       = Visibility.Hidden;
            PrimerLabel.Visibility    = Visibility.Hidden;
            OtvetTextBox.Visibility   = Visibility.Hidden;
            TimeLabel.Visibility      = Visibility.Hidden;
            CancelImage.Visibility    = Visibility.Hidden;
            SkipImage.Visibility      = Visibility.Hidden;
            label3.Visibility         = Visibility.Hidden;
            label4.Visibility         = Visibility.Hidden;
            label4_Copy.Visibility    = Visibility.Hidden;
            skiplabel.Visibility      = Visibility.Hidden;
            falselabel.Visibility     = Visibility.Hidden;
            truelabel.Visibility      = Visibility.Hidden;
            HelpFaierImage.Visibility = Visibility.Hidden;
            Settingimage.Visibility   = Visibility.Hidden;
            MagImage.Visibility       = Visibility.Hidden;
            StatImage.Visibility      = Visibility.Hidden;

            checkBoxTimeSetting.Checked += checkBoxTimeSetting_Checked;

            GridGameFinish.Visibility = Visibility.Hidden;
            GridMagic.Visibility      = Visibility.Hidden;
            GridPassword.Visibility   = Visibility.Hidden;
            GridSetting.Visibility    = Visibility.Hidden;
            GridRecord.Visibility     = Visibility.Hidden;

            ExpressionRadioButton.IsChecked = true;
        }
        private void StartButtonClicked(object sender, RoutedEventArgs e)
        {
            // Create new process start info
            var myProcessStartInfo = new ProcessStartInfo();

            myProcessStartInfo.FileName  = @"C:\Python27\python.exe ";
            myProcessStartInfo.Arguments = @"C:\Chords_master\chords.py";

            // make sure we can read the output from stdout
            myProcessStartInfo.UseShellExecute        = false;
            myProcessStartInfo.RedirectStandardOutput = true;
            myProcessStartInfo.RedirectStandardError  = true;
            myProcessStartInfo.CreateNoWindow         = true;

            var process = new Process();

            process.StartInfo           = myProcessStartInfo;
            process.OutputDataReceived += proc_OutputDataReceived;
            process.ErrorDataReceived  += proc_ErrorDataReceived;
            process.Start();
            process.BeginOutputReadLine();
            process.BeginErrorReadLine();

            if (!isStartd)
            {
                StartButtonText.Text = "Stop!";
                isStartd             = true;
                chordsTimer.Start();
            }
            else
            {
                StartButtonText.Text = "Start!";
                isStartd             = false;
                chordsTimer.Stop();
                currentChordIndex = 0;
                moveToNextChord();
            }
        }
Example #52
0
        private void nextLayer(object sender, EventArgs e)
        {
            if (dt2 != null)
            {
                dt2.Stop();
            }
            if (currentLayer < totalLayers)
            {
                int time = (currentLayer < bottomLayers) ? bottomLayerTime : layerTime;
                currentLayer++;
                this.Invoke((MethodInvoker) delegate {
                    progressBar1.Value = (int)(((float)currentLayer / (float)totalLayers) * 1000);
                    label19.Text       = currentLayer + " of " + totalLayers;
                });
                frm.nextFrame();

                dt = new System.Windows.Threading.DispatcherTimer();
                dt.Stop();
                dt.Interval = TimeSpan.FromMilliseconds(time);
                dt.Tick    += new EventHandler(clearNextScreen);
                dt.Start();
            }
        }
Example #53
0
        private void Model1_MouseLeftButtonDown(object sender, MouseButtonEventArgs e)
        {
            if (model1.ActionMode != actionType.SelectVisibleByPick)
            {
                return;
            }

            _mouseLocation = devDept.Graphics.RenderContextUtility.ConvertPoint(model1.GetMousePosition(e));

            if (model1.GetMouseClicks(e) == 2)
            {
                StopTimer();
                Debug.WriteLine("Double click");
                // Sets the BlockReference as current (so I can select its entities with one click).
                Selection(MouseClickType.LeftDoubleClick);
            }
            else
            {
                _singleClick = true;
                _clickTimer.Start();
                Selection(MouseClickType.LeftClick);
            }
        }
        private void goBtn_Click(object sender, RoutedEventArgs e)
        {
            if (communicator_ == null)
            {
                Ice.InitializationData initData = new Ice.InitializationData();
                initData.properties = Ice.Util.createProperties();
                initData.dispatcher = delegate(System.Action action, Ice.Connection connection)
                {
                    Dispatcher.BeginInvoke(DispatcherPriority.Normal, action);
                };
                communicator_ = Ice.Util.initialize(initData);
            }
            if (bitmapProvider_ == null)
            {
                string        connection = "IceStreamer:tcp -h " + tbIpAddress.Text + " -p 10000 -z";
                Ice.ObjectPrx prx        = communicator_.stringToProxy(connection);
                prx             = prx.ice_timeout(1000);
                bitmapProvider_ = Streamer.BitmapProviderPrxHelper.uncheckedCast(prx);
            }

            timer.Interval = new TimeSpan(1000);                  // Timer will tick event/second
            timer.Start();                                        // Start the timer
        }
        private void btnFolder1_Click(object sender, RoutedEventArgs e)
        {
            OpenFileDialog ofd;

            ofd = new OpenFileDialog();
            ofd.AddExtension = true;
            ofd.DefaultExt   = "*.*";
            ofd.Filter       = "Media Files (*.*)|*.*";
            ofd.ShowDialog();
            string fullPath      = ofd.FileName;
            string directoryPath = System.IO.Path.GetDirectoryName(fullPath);

            DirectoryPathTextBox.Text = directoryPath;


            try { mediaPlayer.Source = new Uri(ofd.FileName); }
            catch { new NullReferenceException("error"); }

            System.Windows.Threading.DispatcherTimer dispatchertimer = new System.Windows.Threading.DispatcherTimer();
            dispatchertimer.Tick    += new EventHandler(timer_Tick);
            dispatchertimer.Interval = new TimeSpan(0, 0, 1);
            dispatchertimer.Start();
        }
Example #56
0
        //public bool IsDisposed { get; private set; }

        public MainWindow()
        {
            InitializeComponent();

            SystemPub.ADRcp = new PassiveRcp();
            SystemPub.ADRcp.RcpLogEventReceived += RcpLogEventReceived;
            SystemPub.ADRcp.RxRspParsed         += RxRspEventReceived;
            System.Windows.Threading.DispatcherTimer dispatcherTimer = new System.Windows.Threading.DispatcherTimer();
            dispatcherTimer.Tick    += new EventHandler(dispatcherTimer_Tick);
            dispatcherTimer.Interval = new TimeSpan(0, 0, 0, 0, 20);
            dispatcherTimer.Start();

            InitCommunication();
            BtnStartRead.IsEnabled = false;
            //Vehicle1.Stroke = Brushes.Red;
            //Vehicle1.Fill = Brushes.Red;



            // dispatcherTimer.Tick += new EventHandler(dispatcherTimer_Tick);
            // dispatcherTimer.Interval = new TimeSpan(0,5,0);
            //  dispatcherTimer.Start();
        }
Example #57
0
        public emergency(Window callingwindow)
        {
            timmer          = new System.Windows.Threading.DispatcherTimer();
            timmer.Tick    += new EventHandler(dispatcherTimer_Tick);
            timmer.Interval = new TimeSpan(0, 1, 0);
            timmer.Start();

            mainWindow = callingwindow as MainWindow;
            InitializeComponent();
            police.Opacity              = 0;
            fire.Opacity                = 0;
            hosp.Opacity                = 0;
            close.Opacity               = 0;
            close.IsEnabled             = false;
            police.IsEnabled            = false;
            fire.IsEnabled              = false;
            hosp.IsEnabled              = false;
            textBox.IsReadOnly          = true;
            mediaElement.LoadedBehavior = MediaState.Manual;
            mediaElement.Source         = new Uri("../sounds/alarm.mp3", UriKind.Relative);
            mediaElement.Play();
            mediaElement.MediaEnded += media_MediaEnded;
        }
        public MainWindow()
        {
            InitializeComponent();

            Button btn = new Button();

            btn.Name   = "btn1";
            btn.Click += btn1_Click;



            // timer = new DispatcherTimer();
            //timer.Tick += Timer_Tick;
            //timer.Interval = System.TimeSpan.FromMilliseconds(1000);
            //timer.Start();


            DispatcherTimer dispatcherTimer = new System.Windows.Threading.DispatcherTimer();

            dispatcherTimer.Tick    += new EventHandler(dispatcherTimer_Tick);
            dispatcherTimer.Interval = new TimeSpan(0, 0, 1);
            dispatcherTimer.Start();
        }
Example #59
0
        /**************/
        /* MainWindow */
        /**************/
        public MainWindow()
        {
            InitializeComponent();

            preferences = new IDEPreferences();

            String currentDirectory = preferences.GetCurrentDirectory();

            if (Directory.Exists(currentDirectory))
            {
                this.SetCurrentDirectory(currentDirectory);
            }
            else
            {
                this.SetCurrentDirectory(Directory.GetCurrentDirectory());
            }

            agendaBrowserManager   = new AgendaBrowserManager(this);
            factBrowserManager     = new FactBrowserManager(this);
            instanceBrowserManager = new InstanceBrowserManager(this);

            IDEPeriodicCallback theCB = new IDEPeriodicCallback(this);

            this.dialog.GetEnvironment().AddPeriodicCallback("IDECallback", 0, theCB);
            this.dialog.GetEnvironment().EnablePeriodicFunctions(true);
            this.dialog.GetEnvironment().AddUserFunction("clear-window", "v", 0, 0, null, new ClearWindowFunction(this));

            this.dialog.StartCommandEvent  += new StartCommandDelegate(StartExecutionEventOccurred);
            this.dialog.FinishCommandEvent += new FinishCommandDelegate(FinishExecutionEventOccurred);

            System.Windows.Threading.DispatcherTimer dispatcherTimer = new System.Windows.Threading.DispatcherTimer();

            dispatcherTimer.Tick    += IDEPeriodicTimer;
            dispatcherTimer.Interval = TimeSpan.FromMilliseconds(500);

            dispatcherTimer.Start();
        }
Example #60
0
        public MainViewModel(IDataService dataService, IEnumerable <INotifyService> notifyService, System.Windows.Forms.NotifyIcon notifyIcon, ILogViewModel logVM = null)
        {
            _Startup = true;
            Dispatcher.CurrentDispatcher.ShutdownStarted += Dispatcher_ShutdownStarted;
            LoadSettings();
            SetNotifyIcon(notifyIcon);

            DataService = dataService;
            NotifyService.AddRange(notifyService);
            _LogViewModel = logVM;

            IsAutoStart = GetStartWithSystem();
            AddSortingByDate();

            LoadData();

            View.Closing += View_Closing;

            NotifyTimer          = new DispatcherTimer();
            NotifyTimer.Interval = FirstTick;
            NotifyTimer.Tick    += NotifyTimer_Tick;
            NotifyTimer.Start();

            if (IsAutoStart)
            {
                View.Hide();
                _NotifyIcon.ShowBalloonTip(Properties.Settings.Default.BaloonBasicTipTime,
                                           Properties.Settings.Default.AppName,
                                           Properties.Resources.Started,
                                           System.Windows.Forms.ToolTipIcon.None);
            }
            else
            {
                View.Show();
            }
            _Startup = false;
        }