Exemplo n.º 1
0
        private void WriteWhenLastSaveHappened(object sender, EventArgs e)
        {
            Form             mainWindowForm         = (sender as IPluginContext)?.MainForm as Form;
            XmlNodeEventArgs args                   = e as XmlNodeEventArgs;
            bool             updatingMainWindowText = false;

            if (mainWindowForm == null || args == null)
            {
                return;
            }

            settings = args.XmlNode != null?PluginSettings.CreateSettings(args.XmlNode) : new PluginSettings();

            mainWindowForm.TextChanged += (s, a) =>
            {
                if (!updatingMainWindowText && !string.IsNullOrWhiteSpace(settings.LastSave))
                {
                    try
                    {
                        updatingMainWindowText = true;
                        mainWindowForm.Text   += $" (Settings last saved {settings.LastSave})";
                    }
                    finally
                    {
                        updatingMainWindowText = false;
                    }
                }
            };
            mainWindowForm.Text = string.Empty;
        }