示例#1
0
        public NotificationIcon()
        {
            notifyIcon       = new NotifyIcon();
            notificationMenu = new ContextMenu(InitializeMenu());

            notifyIcon.DoubleClick += IconDoubleClick;
            System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(NotificationIcon));
            notifyIcon.Icon        = (Icon)resources.GetObject("$this.Icon");
            notifyIcon.ContextMenu = notificationMenu;


            Dictionary <Type, IFrontEndConfig> oConfigs = new Dictionary <Type, IFrontEndConfig>();
            IFrontEndConfig oAwkConfig  = AwkConfig.GetInstance();
            IFrontEndConfig oDiffConfig = DiffConfig.GetInstance();

            oConfigs.Add(typeof(AwkScriptXml), oAwkConfig);
            oConfigs.Add(typeof(DiffScript), oDiffConfig);

            IFrontEnd oAwkFrontEnd  = new AwkFrontEnd(oAwkConfig);
            IFrontEnd oDiffFrontEnd = new DiffFrontEnd();

            Dictionary <Type, IFrontEnd> oFrontEnds = new Dictionary <Type, IFrontEnd>();

            oFrontEnds.Add(typeof(AwkScriptXml), oAwkFrontEnd);
            oFrontEnds.Add(typeof(DiffScript), oDiffFrontEnd);

            moMain              = new AwkEverywhere.Forms.AwkEverywhereMainForm(oConfigs, oFrontEnds);
            moMain.CopyFromNpp += new EventHandler(oMain_CopyFromNpp);
            moMain.CopyToNpp   += new EventHandler(oMain_CopyToNpp);

            SystemEvents.SessionEnding += SystemEvents_SessionEnding;
        }
示例#2
0
        public static AwkConfig GetInstance()
        {
            AwkConfig instance = null;

            string sConfigFilePath = Path.Combine(StaticWorkingDirectory, STATIC_CONFIG_FILE_NAME);

            if (!File.Exists(sConfigFilePath))
            {
                instance = new AwkConfig();
                if (!string.IsNullOrEmpty(ConfigurationManager.AppSettings[AppSettingsKey.AWK_PATH_KEY]))
                {
                    instance.ProgramPath = ConfigurationManager.AppSettings[AppSettingsKey.AWK_PATH_KEY];
                }
                else
                {
                    instance.ProgramPath = "gawk.exe";
                }
                instance.Version = System.Reflection.Assembly.GetExecutingAssembly().GetName().Version.ToString();
                instance.WriteConfig();
            }
            else
            {
                XmlSerializer oSerializer = new XmlSerializer(typeof(AwkConfig));
                using (XmlTextReader oReader = new XmlTextReader(sConfigFilePath))
                {
                    instance = (AwkConfig)oSerializer.Deserialize(oReader);
                    if (!string.IsNullOrEmpty(ConfigurationManager.AppSettings[AppSettingsKey.AWK_PATH_KEY]))
                    {
                        instance.ProgramPath = ConfigurationManager.AppSettings[AppSettingsKey.AWK_PATH_KEY];
                    }
                }
            }
            return(instance);
        }
示例#3
0
 private void menuWSClick(object sender, EventArgs e)
 {
     if (moWSForm == null)
     {
         IFrontEndConfig oConfig = AwkConfig.GetInstance();
         moWSForm = new AwkEverywhere.Forms.WSForms.WSBrowser(oConfig);
     }
     moWSForm.Show();
 }