Ejemplo n.º 1
0
        private void UpdateIcon()
        {
            if (Clipboard.ContainsText())
            {
                var text = Clipboard.GetText();
                if (_lastText == text)
                {
                    return;
                }
                _lastText = text = Clipboard.GetText();

                var safe = SafeToStart(text);

                _startCurrent.Enabled = safe;

                if (text.IsProductionNumber())
                {
                    _productionService.Cache(text.ToCleanProductionNumber());
                    if (Settings.Default.ShowBallonTips)
                    {
                        _trayIcon.ShowBalloonTip(2000, "Produktionsnummer", text, ToolTipIcon.Info);
                    }
                    _trayIcon.Icon = text.IsWhatsOnProductionNumber() ?
                                     IconFactory.MakeOne('W', Brushes.DeepSkyBlue):
                                     IconFactory.MakeOne('P', Brushes.Red);
                    if (_productionForm != null && !_productionForm.IsDisposed)
                    {
                        StartOrUpdateProductionForm(text);
                    }
                    return;
                }
                if (safe)
                {
                    if (Settings.Default.ShowBallonTips)
                    {
                        _trayIcon.ShowBalloonTip(2000, "Startbar", text, ToolTipIcon.Info);
                    }
                    _trayIcon.Icon = IconFactory.MakeOne('S', Brushes.GreenYellow);
                    return;
                }
            }
            else
            {
                _startCurrent.Enabled = false;
            }
            _trayIcon.Icon = IconFactory.MakeOne('X', Brushes.AntiqueWhite);
        }