Ejemplo n.º 1
0
        public SynchronizationThread(IApplication application, Control invokeControl)
        {
            thread      = new Thread(Run);
            thread.Name = "SynchronizationThread";

            this.invokeControl = invokeControl;

            synchronizer = new VaultEagleSynchronizer(application.Connection);
        }
Ejemplo n.º 2
0
        private void ShowOnUIThread(string s)
        {
            lastShowed = DateTime.Now;

            Action action = () =>
            {
                if (notifyIcon == null)
                {
                    string  company, product;
                    Version version;
                    VaultEagleSynchronizer.GetVersion(System.Reflection.Assembly.GetExecutingAssembly(), out company, out product, out version);
                    string shortVersion = version.Major + "." + version.Minor;

                    string STR_MCAD_Vault_Eagle_1_0___Workspace_Sync = "{0} {1} {2} - Workspace Sync";
                    string title = string.Format(STR_MCAD_Vault_Eagle_1_0___Workspace_Sync, company, product, shortVersion);

                    notifyIcon = new NotifyIcon()
                    {
                        Text            = title,
                        Icon            = Properties.Resources.MCAD_,
                        BalloonTipIcon  = ToolTipIcon.Info,
                        BalloonTipTitle = title
                    };

                    // forward event
                    notifyIcon.BalloonTipClicked += (sender, e) => BalloonTipClicked(sender, e);

                    //notifyIcon.BalloonTipShown += (sender, e) => active = true;
                    EventHandler onClosed = (sender, e) =>
                    {
                        System.Diagnostics.Debug.WriteLine("notifyIcon.BalloonTipClosed");
                        uiThreadNumActive--;

                        if (disposed && uiThreadNumActive == 0)
                        {
                            notifyIcon.DisposeUnlessNull(ref notifyIcon);
                        }
                    };
                    notifyIcon.BalloonTipClosed  += onClosed;
                    notifyIcon.BalloonTipClicked += onClosed;
                    notifyIcon.Visible            = true;
                }

                notifyIcon.BalloonTipText = s;
                notifyIcon.ShowBalloonTip(10000);
            };

            invokeControl.BeginInvoke(action);
        }
Ejemplo n.º 3
0
        public void StartSyncThread(bool showProgressWindow)
        {
            if (thread != null)
            {
                thread.Stop();
            }
            thread = new SynchronizationThread(application, invokeControl);
            var log = new ProgressWindow(this, FilesAndFolders.GetLogPath());

            log.Initialize();

            VaultEagleSynchronizer.LogVersion(log, System.Reflection.Assembly.GetExecutingAssembly());

            if (showProgressWindow)
            {
                log.Show();
            }
            thread.logWindow = log;
            thread.Start();
        }