Esempio n. 1
0
        private void UserControl_Loaded(object sender, RoutedEventArgs e)
        {
            if (ControlsHelper.IsDesignMode(this))
            {
                return;
            }
            // List which contains all issues.
            var scheduler = TaskScheduler.FromCurrentSynchronizationContext();

            IssueList = new BindingListInvoked <IssueItem>();
            UpdateIgnoreAllButton();
            // List which is bound to the grid and displays issues, which needs user attention.
            Warnings = new BindingListInvoked <IssueItem>();
            Warnings.SynchronizingObject = scheduler;
            MainDataGrid.ItemsSource     = Warnings;
            UpdateIgnoreButton();
            // Timer which checks for the issues.
            var ai    = new JocysCom.ClassLibrary.Configuration.AssemblyInfo();
            var title = ai.GetTitle(true, true, true, true, false) + " - Issues";

            TasksTimer                    = new QueueTimer <object>(0, 0);
            TasksTimer.DoWork            += queueTimer_DoWork;
            TasksTimer.Queue.ListChanged += Data_ListChanged;
            // Start monitoring tasks queue.
            QueueMonitorTimer       = new System.Windows.Forms.Timer();
            QueueMonitorTimer.Tick += QueueMonitorTimer_Tick;
            QueueMonitorTimer.Start();
        }
Esempio n. 2
0
        public MainWindow()
        {
            ControlsHelper.InitInvokeContext();
            // Make sure setting changes updates UI on the same thread as UI.
            var scheduler = ControlsHelper.MainTaskScheduler;

            SettingsManager.SetSynchronizingObject(scheduler);
            // Disable some functionality in Visual Studio Interface design mode.
            if (!ControlsHelper.IsDesignMode(this))
            {
                PreviewKeyDown += MainWindow_PreviewKeyDown;
                Closing        += MainWindow_Closing;
            }
            InitHelper.InitTimer(this, InitializeComponent);
            if (ControlsHelper.IsDesignMode(this))
            {
                return;
            }
            StartHelper.Initialize();
            InitiInterfaceUpdate();
            // Check if app version changed.
            var o          = SettingsManager.Options;
            var appVersion = new JocysCom.ClassLibrary.Configuration.AssemblyInfo().Version.ToString();

            AppVersionChanged = o.AppVersion != appVersion;
            o.AppVersion      = appVersion;
        }
Esempio n. 3
0
        public IssuesUserControl()
        {
            InitializeComponent();
            if (IsDesignMode)
            {
                return;
            }
            NoIssuesPanel.Visible       = false;
            LinePanel.Visible           = false;
            ExceptionInfoButton.Visible = false;
            // List which contains all issues.
            IssueList = new BindingListInvoked <IssueItem>();
            IssueList.SynchronizingObject = this;
            IssueList.ListChanged        += IssueList_ListChanged;
            UpdateIgnoreAllButton();
            // List which is bound to the grid and displays issues, which needs user attention.
            Warnings = new BindingListInvoked <IssueItem>();
            Warnings.SynchronizingObject = this;
            // Configure data grid.
            ControlsHelper.ApplyBorderStyle(WarningsDataGridView);
            WarningsDataGridView.AutoGenerateColumns = false;
            WarningsDataGridView.DataSource          = Warnings;
            UpdateIgnoreButton();
            // Timer which checks for the issues.
            var ai    = new JocysCom.ClassLibrary.Configuration.AssemblyInfo();
            var title = ai.GetTitle(true, true, true, true, false) + " - Issues";

            Text                          = title;
            TasksTimer                    = new JocysCom.ClassLibrary.Threading.QueueTimer <object>(0, 5000, this);
            TasksTimer.DoWork            += queueTimer_DoWork;
            TasksTimer.Queue.ListChanged += Data_ListChanged;
            // Start monitoring tasks queue.
            QueueMonitorTimer.Start();
        }
Esempio n. 4
0
        /// <summary>
        /// Requires no special permissions, because current used have full access to CurrentUser 'Run' registry key.
        /// </summary>
        /// <param name="enabled">Start with Windows after Sign-In.</param>
        /// <param name="startState">Start Mode.</param>
        public void UpdateWindowsStartRegistry(bool enabled, System.Windows.Forms.FormWindowState?startState = null)
        {
            var ai = new JocysCom.ClassLibrary.Configuration.AssemblyInfo();

            startState = startState ?? SettingsManager.Options.StartWithWindowsState;
            var runKey = Registry.CurrentUser.OpenSubKey("SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Run", true);

            if (enabled)
            {
                // Add the value in the registry so that the application runs at start-up
                string command = string.Format("\"{0}\" /{1}={2}", ai.AssemblyPath, Program.arg_WindowState, startState.ToString());
                var    value   = (string)runKey.GetValue(ai.Product);
                if (value != command)
                {
                    runKey.SetValue(ai.Product, command);
                }
            }
            else
            {
                // Remove the value from the registry so that the application doesn't start
                if (runKey.GetValueNames().Contains(ai.Product))
                {
                    runKey.DeleteValue(ai.Product, false);
                }
            }
            runKey.Close();
        }
Esempio n. 5
0
        /// <summary>
        /// Minimize the window and hide it from the TaskBar.
        /// </summary>
        public void MinimizeToTray(bool showBalloonTip, bool minimizeToTray)
        {
            var asm = new JocysCom.ClassLibrary.Configuration.AssemblyInfo();

            // Show only first time.
            if (showBalloonTip)
            {
                TrayNotifyIcon.BalloonTipText = asm.Product;
                // Show balloon tip for 2 seconds.
                TrayNotifyIcon.ShowBalloonTip(2, "X360CE", asm.Product, System.Windows.Forms.ToolTipIcon.Info);
            }
            // hold - program.
            // NOTE: also it would be possible to track which direction mouse will move in or move out on TrayIcon.
            // For example: open program if mouse moves in from left and moves out from top.
            TrayNotifyIcon.Text = "X360CE: Double click - program, click - menu.";
            if (minimizeToTray)
            {
                // Set window style as ToolWindow to avoid its icon in ALT+TAB.
                if (_Window.Owner != _hiddenForm)
                {
                    _Window.Owner = _hiddenForm;
                }
                // Hide form bar from the TarkBar.
                if (_Window.ShowInTaskbar)
                {
                    _Window.ShowInTaskbar = false;
                }
            }
            if (_Window.WindowState != WindowState.Minimized)
            {
                _Window.WindowState = WindowState.Minimized;
            }
        }
Esempio n. 6
0
        public IssuesUserControl()
        {
            InitializeComponent();
            if (IsDesignMode)
            {
                return;
            }
            // List which contains all issues.
            IssueList = new BindingListInvoked <IssueItem>();
            IssueList.SynchronizingObject = this;
            IssueList.ListChanged        += IssueList_ListChanged;
            // List which is bound to the grid and displays issues, which needs user attention.
            Warnings = new BindingListInvoked <IssueItem>();
            Warnings.SynchronizingObject = this;
            // Configure data grid.
            ControlsHelper.ApplyBorderStyle(IssuesDataGridView);
            IssuesDataGridView.AutoGenerateColumns = false;
            IssuesDataGridView.DataSource          = Warnings;
            // Timer which checks for the issues.
            CheckTimer                     = new System.Timers.Timer();
            CheckTimer.Interval            = 1000;
            CheckTimer.AutoReset           = false;
            CheckTimer.SynchronizingObject = this;
            CheckTimer.Elapsed            += CheckTimer_Elapsed;
            var ai    = new JocysCom.ClassLibrary.Configuration.AssemblyInfo();
            var title = ai.GetTitle(true, true, true, true, false) + " - Issues";

            Text = title;
        }
Esempio n. 7
0
        public string ExceptionInfo(Exception ex, string body)
        {
            //------------------------------------------------------
            // Body
            //------------------------------------------------------
            string s = string.Empty;

            if (!string.IsNullOrEmpty(body))
            {
                s += "<div>" + body + "</div>";
            }
            //------------------------------------------------------
            AddStyle(ref s);
            //------------------------------------------------------
            s += "<table border=\"0\" cellspacing=\"2\">";
            var rm = RunMode;

            if (!string.IsNullOrEmpty(rm))
            {
                rm = " (" + rm + ")";
            }
            var asm = System.Reflection.Assembly.GetEntryAssembly();

            if (asm == null)
            {
                Assembly.GetCallingAssembly();
            }
            if (asm == null)
            {
                Assembly.GetExecutingAssembly();
            }
            AddRow(ref s, "Product");
            if (asm != null)
            {
                var ai   = new JocysCom.ClassLibrary.Configuration.AssemblyInfo(asm);
                var name = ai.Company + " " + ai.Product + " " + ai.Version.ToString(4);
                ApplyRunModeSuffix(ref name);
                AddRow(ref s, "Name", name);
            }
            AddRow(ref s, "Machine", System.Environment.MachineName);
            AddRow(ref s, "Username", System.Environment.UserName);
            if (asm != null)
            {
                AddRow(ref s, "Executable", asm.Location);
                AddRow(ref s, "Build Date", Configuration.AssemblyInfo.GetBuildDateTime(asm.Location).ToString("yyyy-MM-dd HH:mm:ss"));
            }
            UserInfo(ref s);
            PageInfo(ref s);
            AddRow(ref s);
            s += "</table>";
            s += "<table border=\"0\" cellspacing=\"2\">";
            ExceptionInfoRecursive(ref s, ex);
            //------------------------------------------------------
            s += "</table>";
            return(s);
        }
Esempio n. 8
0
        public static void Initialize()
        {
            var asm = new JocysCom.ClassLibrary.Configuration.AssemblyInfo();

            uid                    = asm.Product;
            _ResumeTimer           = new System.Timers.Timer();
            _ResumeTimer.AutoReset = false;
            _ResumeTimer.Interval  = 1000;
            _ResumeTimer.Elapsed  += _ResumeTimer_Elapsed;
        }
Esempio n. 9
0
        public static void WriteAppHeader(System.Reflection.Assembly assembly)
        {
            // Write title.
            // Microsoft (R) SQL Server Database Publishing Wizard 1.1.1.0
            // Copyright (C) Microsoft Corporation. All rights reserved.
            var a = new JocysCom.ClassLibrary.Configuration.AssemblyInfo(assembly);

            Console.WriteLine(a.Title + " " + a.Version.ToString());
            Console.WriteLine(a.Copyright);
            Console.WriteLine(a.Description);
        }
Esempio n. 10
0
        void Step1ChekOnline()
        {
            CurrentLogItem = LogPanel.Add("Check Online...");
            var message = new CloudMessage(Engine.CloudAction.CheckUpdates);
            var ai      = new JocysCom.ClassLibrary.Configuration.AssemblyInfo();

            message.Values.Add(CloudKey.ClientVersion, ai.Version);
            var item = new CloudItem()
            {
                Date    = DateTime.Now,
                Message = message,
                State   = CloudState.None,
                Retries = 4,
            };

            CheckUpateItem = item;
            Global.CloudClient.TasksTimer.DoActionNow(item);
        }
Esempio n. 11
0
        public IssuesUserControl()
        {
            InitializeComponent();
            if (IsDesignMode)
            {
                return;
            }
            // Set tool strip to the same font.
            Controls.OfType <ToolStrip>().ToList().ForEach(x => x.Font = this.Font);
            NoIssuesPanel.Visible       = false;
            LinePanel.Visible           = false;
            ExceptionInfoButton.Visible = false;
            // List which contains all issues.
            var scheduler = TaskScheduler.FromCurrentSynchronizationContext();

            IssueList = new BindingListInvoked <IssueItem>();
            IssueList.AsynchronousInvoke  = true;
            IssueList.SynchronizingObject = scheduler;
            IssueList.ListChanged        += IssueList_ListChanged;
            UpdateIgnoreAllButton();
            // List which is bound to the grid and displays issues, which needs user attention.
            Warnings = new BindingListInvoked <IssueItem>();
            Warnings.SynchronizingObject = scheduler;
            // Configure data grid.
            ControlsHelper.ApplyBorderStyle(WarningsDataGridView);
            WarningsDataGridView.AutoGenerateColumns = false;
            WarningsDataGridView.DataSource          = Warnings;
            UpdateIgnoreButton();
            // Timer which checks for the issues.
            var ai    = new JocysCom.ClassLibrary.Configuration.AssemblyInfo();
            var title = ai.GetTitle(true, true, true, true, false) + " - Issues";

            Text                          = title;
            TasksTimer                    = new QueueTimer <object>(0, 0);
            TasksTimer.DoWork            += queueTimer_DoWork;
            TasksTimer.Queue.ListChanged += Data_ListChanged;
            // Start monitoring tasks queue.
            QueueMonitorTimer.Start();
        }
Esempio n. 12
0
        public MainWindow()
        {
            ControlsHelper.InitInvokeContext();
            // Disable some functionality in Visual Studio Interface design mode.
            if (!ControlsHelper.IsDesignMode(this))
            {
                PreviewKeyDown += MainWindow_PreviewKeyDown;
                Closing        += MainWindow_Closing;
            }
            InitializeComponent();
            if (ControlsHelper.IsDesignMode(this))
            {
                return;
            }
            StartHelper.Initialize();
            InitiInterfaceUpdate();
            // Check if app version changed.
            var o          = SettingsManager.Options;
            var appVersion = new JocysCom.ClassLibrary.Configuration.AssemblyInfo().Version.ToString();

            AppVersionChanged = o.AppVersion != appVersion;
            o.AppVersion      = appVersion;
        }
Esempio n. 13
0
        public string ExceptionInfo(Exception ex, string body)
        {
            //------------------------------------------------------
            // Body
            //------------------------------------------------------
            string s = string.Empty;

            if (!string.IsNullOrEmpty(body))
            {
                s += "<div>" + body + "</div>";
            }
            //------------------------------------------------------
            AddStyle(ref s);
            //------------------------------------------------------
            s += "<table border=\"0\" cellspacing=\"2\">";
            var rm = RunMode;

            if (!string.IsNullOrEmpty(rm))
            {
                rm = " (" + rm + ")";
            }
            var asm = System.Reflection.Assembly.GetEntryAssembly();

            if (asm == null)
            {
                Assembly.GetCallingAssembly();
            }
            if (asm == null)
            {
                Assembly.GetExecutingAssembly();
            }
            AddRow(ref s, "Product");
            if (asm != null)
            {
                var ai   = new JocysCom.ClassLibrary.Configuration.AssemblyInfo(asm);
                var name = ai.Company + " " + ai.Product + " " + ai.Version.ToString(4);
                ApplyRunModeSuffix(ref name);
                AddRow(ref s, "Name", name);
            }
            AddRow(ref s, "Machine", System.Environment.MachineName);
            AddRow(ref s, "Username", System.Environment.UserName);
            if (asm != null)
            {
                var bd = Configuration.AssemblyInfo.GetBuildDateTime(asm.Location);
                AddRow(ref s, "Executable", asm.Location);
                AddRow(ref s, "Build Date", bd.ToString("yyyy-MM-dd HH:mm:ss"));
                //AddRow(ref s, "SVN LastCheckIn", "svn log -q \"%file%\" -r {"+ bd.ToString("yyyy-MM-ddTHH:mm:ss") + "}:{1970-01-01} -l 1");
                //AddRow(ref s, "SVN GetCodeFile", "svn cat -r %rev% \"%file%\" > \"%TEMP%\\code.cs\" && \"%TEMP%\\code.cs\"");

                /* Look for source code in SVN.
                 *
                 * :: Set build date.
                 * set date=2016-10-24T14:12:53
                 * :: Set file name to investigate.
                 * set file=C:\Projects\Volante\Dispatch\Engine\Messages\ClientStateMessage.cs
                 * :: Show last check-in before build (biggest chance of version we are looking for).
                 * svn log -q "%file%" -r {%date%}:{1970-01-01} -l 1
                 * :: Show first check-in after build.
                 * svn log -q "%file%" -r {%date%}:{9999-01-01} -l 1
                 *
                 * :: Save file revision to disk.
                 * svn cat -r r18594 "%file%" > "%TEMP%\svn.cs"
                 * :: Open file with Visual Studio.
                 * "%TEMP%\svn.cs"
                 *
                 */
            }
            UserInfo(ref s);
            PageInfo(ref s);
            AddRow(ref s);
            s += "</table>";
            s += "<table border=\"0\" cellspacing=\"2\">";
            ExceptionInfoRecursive(ref s, ex);
            //------------------------------------------------------
            s += "</table>";
            return(s);
        }
Esempio n. 14
0
        public static string GetProductFullName()
        {
            var ai = new JocysCom.ClassLibrary.Configuration.AssemblyInfo();

            return(ai.GetTitle(true, true, true, true, false, 4));
        }
Esempio n. 15
0
 public MainWindow()
 {
     InitializeComponent();
     Title = new JocysCom.ClassLibrary.Configuration.AssemblyInfo().GetTitle();
 }
Esempio n. 16
0
 public HostWindow()
 {
     InitializeComponent();
     Title = new JocysCom.ClassLibrary.Configuration.AssemblyInfo().GetTitle(false, false, false, false, false, 0) + "- Options";
     LoadSettings();
 }