Пример #1
0
 public ErrorReportControl()
 {
     InitHelper.InitTimer(this, InitializeComponent);
     if (ControlsHelper.IsDesignMode(this))
     {
         return;
     }
     ErrorsFolderTextBox.Text   = LogHelper.Current.LogsFolder;
     MainBrowser.LoadCompleted += MainBrowser_LoadCompleted;
     RefreshErrorsComboBox();
     StatusLabel.Content = "";
 }
Пример #2
0
        public MessageBoxWindow()
        {
            InitHelper.InitTimer(this, InitializeComponent);
            LinkTextBlock.Visibility = Visibility.Collapsed;
            // Center owner.
            var owner = Application.Current?.MainWindow;

            if (owner != null)
            {
                Owner = owner;
                WindowStartupLocation = WindowStartupLocation.CenterOwner;
            }
            Loaded += MessageBoxWindow_Loaded;
        }
Пример #3
0
 public InfoControl()
 {
     InitHelper.InitTimer(this, InitializeComponent);
     if (!ControlsHelper.IsDesignMode(this))
     {
         var assembly    = Assembly.GetEntryAssembly();
         var product     = ((AssemblyProductAttribute)Attribute.GetCustomAttribute(assembly, typeof(AssemblyProductAttribute))).Product;
         var description = ((AssemblyDescriptionAttribute)Attribute.GetCustomAttribute(assembly, typeof(AssemblyDescriptionAttribute))).Description;
         DefaultHead = product;
         DefaultBody = description;
         SetHead(DefaultHead);
         SetBodyInfo(DefaultBody);
         InitRotation();
     }
 }
Пример #4
0
        private static void RestartTimer(object sender)
        {
            InitHelper ih = null;

            lock (TimersLock)
                ih = Timers.FirstOrDefault(x => Equals(x.Control, sender));
            if (ih == null)
            {
                return;
            }
            ih._PropertyChangedCount++;
            ih.EndDate = DateTime.Now;
            ih._Timer.Stop();
            ih._Timer.Start();
        }
Пример #5
0
        /// <summary>
        /// This function will trigger once, after 2000ms when control stops visible changing.
        /// </summary>
        private static void _Timer_Elapsed(object sender, System.Timers.ElapsedEventArgs e)
        {
            InitHelper ih = null;

            // Find InitHelper by timer.
            lock (TimersLock)
            {
                ih = Timers.FirstOrDefault(x => Equals(x._Timer, sender));
                if (ih == null)
                {
                    return;
                }
                Timers.Remove(ih);
                _InitEndCount++;
                ih.WriteLine("INIT END");
                // Disconnect all links.
                ih.Control.IsVisibleChanged -= Control_IsVisibleChanged;
                //ih.Control.PropertyChanged -= Control_PropertyChanged;
                ih.Control = null;
                ih._Timer.Dispose();
            }
        }
Пример #6
0
        /// <summary>
        /// In release mode invoke only, in debug mode use times and monitor object.
        /// </summary>
        public static void InitTimer(FrameworkElement control, Action InitializeComponent)
        {
            if (!IsDebug)
            {
                InitializeComponent.Invoke();
                return;
            }
            var ih = new InitHelper();

            ih.Control   = control;
            ih.StartDate = DateTime.Now;
            ih.WriteLine("INIT START");
            ih.EndDate = DateTime.Now;
            InitializeComponent.Invoke();
            ih.EndDate = DateTime.Now;
            ih.WriteLine("INIT CON  ");
            lock (TimersLock)
                Timers.Add(ih);
            ih.Control.Loaded           += Control_Loaded;
            ih.Control.Unloaded         += Control_Unloaded;
            ih.Control.IsVisibleChanged += Control_IsVisibleChanged;
            //ih.Control.PropertyChanged += Control_PropertyChanged;
            ih._Timer.Start();
        }
Пример #7
0
 public ProgressBarControl()
 {
     InitHelper.InitTimer(this, InitializeComponent);
     ControlsHelper.SetText(ProgressLevelTopBarTextBlock, "");
     ControlsHelper.SetText(ProgressLevelSubBarTextBlock, "");
 }
Пример #8
0
 public HardwareDeviceControl()
 {
     InitHelper.InitTimer(this, InitializeComponent);
 }