/// ------------------------------------------------------------------------------------ /// <summary> /// /// </summary> /// ------------------------------------------------------------------------------------ public PaAddOnManager() { try { Assembly assembly = Assembly.GetExecutingAssembly(); if (!VerifyAddOnMediatorExists(assembly)) { return; } string settingName = Path.GetFileNameWithoutExtension(assembly.Location); if (PaApp.SettingsHandler.GetBoolSettingsValue(settingName, "Enabled", true)) { PaApp.AddMediatorColleague(this); // Register to receive notification after data sources have been loaded. // Use the add-on mediator (as opposed to just responding to the // OnAfterDataSourcesLoaded message) because we want to make sure that // all other add-ons who want to have processed the message. That's // because if some other add-on changes the data in the cache // (i.e. PaSADataSourceAddOn), it may influence what records are // filtered out. AddOnMediator.RegisterForDataSourcesLoadedMsg(1000, this); m_startupFilterName = PaApp.SettingsHandler.GetStringSettingsValue("PaFiltersAddOn", "currfilter", null); } } catch { } }
/// ------------------------------------------------------------------------------------ /// <summary> /// /// </summary> /// ------------------------------------------------------------------------------------ public AddOnMediator() { try { PaApp.AddMediatorColleague(this); } catch { } }
/// ------------------------------------------------------------------------------------ /// <summary> /// /// </summary> /// ------------------------------------------------------------------------------------ public PaAddOnManager() { try { PaApp.AddMediatorColleague(this); } catch { } }
/// ------------------------------------------------------------------------------------ /// <summary> /// Restores the filtered out words (i.e. puts them back into the application's /// word cache). /// </summary> /// ------------------------------------------------------------------------------------ public static void Restore() { if (s_unusedWordsCache.Count > 0 && PaApp.WordCache != null) { PaApp.WordCache.AddRange(s_unusedWordsCache); PaApp.BuildPhoneCache(); s_unusedWordsCache.Clear(); } }
/// ------------------------------------------------------------------------------------ /// <summary> /// /// </summary> /// ------------------------------------------------------------------------------------ public PaAddOnManager() { try { Assembly assembly = Assembly.GetExecutingAssembly(); string settingName = Path.GetFileNameWithoutExtension(assembly.CodeBase); if (PaApp.SettingsHandler.GetBoolSettingsValue(settingName, "Enabled", true)) { PaApp.AddMediatorColleague(this); } } catch { } }
/// ------------------------------------------------------------------------------------ /// <summary> /// /// </summary> /// ------------------------------------------------------------------------------------ private string GetBackupZipFile() { string fileName = string.Format(Properties.Resources.kstidBackupFilenameFmt, PaApp.Project.ProjectName, DateTime.Now.ToShortDateString()); // Slashes are invalid in a file name. fileName = fileName.Replace("/", "-"); int filterIndex = 0; return(PaApp.SaveFileDialog("zip", Properties.Resources.kstidFileTypesForOFD, ref filterIndex, Properties.Resources.kstidBackupOFDCaption, fileName, PaApp.Project.ProjectPath)); }
/// ------------------------------------------------------------------------------------ /// <summary> /// /// </summary> /// ------------------------------------------------------------------------------------ public static void ApplyFilter(PaFilter filter) { Restore(); s_currFilter = filter; if (filter != null) { filter.Apply(); PaApp.BuildPhoneCache(); } PaApp.MsgMediator.SendMessage("DataSourcesModified", PaApp.Project.ProjectFileName); UpdateFilterGuiComponents(); PaApp.SettingsHandler.SaveSettingsValue("PaFiltersAddOn", "currfilter", (filter != null ? filter.Name : string.Empty)); }
/// ------------------------------------------------------------------------------------ /// <summary> /// /// </summary> /// ------------------------------------------------------------------------------------ public static SearchEngine CheckSearchQuery(SearchQuery query, bool showErrMsg) { query.ErrorMessages.Clear(); SearchQuery modifiedQuery; if (!PaApp.ConvertClassesToPatterns(query, out modifiedQuery, showErrMsg)) { return(null); } if (PaApp.Project != null) { SearchEngine.IgnoreUndefinedCharacters = PaApp.Project.IgnoreUndefinedCharsInSearches; } SearchEngine.ConvertPatternWithExperimentalTrans = PaApp.SettingsHandler.GetBoolSettingsValue("searchengine", "convertpatternswithexperimentaltrans", false); SearchEngine engine = new SearchEngine(modifiedQuery, PaApp.PhoneCache); string[] errors = modifiedQuery.ErrorMessages.ToArray(); string msg = ReflectionHelper.GetStrResult(typeof(PaApp), "CombineErrorMessages", errors); if (!string.IsNullOrEmpty(msg)) { if (showErrMsg) { Utils.MsgBox(msg); } query.ErrorMessages.AddRange(modifiedQuery.ErrorMessages); return(null); } if (!ReflectionHelper.GetBoolResult(typeof(PaApp), "VerifyMiscPatternConditions", new object[] { engine, showErrMsg })) { query.ErrorMessages.AddRange(modifiedQuery.ErrorMessages); return(null); } return(engine); }
/// ------------------------------------------------------------------------------------ /// <summary> /// /// </summary> /// ------------------------------------------------------------------------------------ public static void Restore() { string zipFile = PaApp.OpenFileDialog("zip", Properties.Resources.kstidFileTypesForOFD, Properties.Resources.kstidRestoreOFDCaption); if (string.IsNullOrEmpty(zipFile) || !File.Exists(zipFile)) { return; } try { using (RestoreDlg dlg = new RestoreDlg(zipFile)) dlg.ShowDialog(PaApp.MainForm); } catch { } }
/// ------------------------------------------------------------------------------------ /// <summary> /// /// </summary> /// ------------------------------------------------------------------------------------ public PaAddOnManager() { try { Assembly assembly = Assembly.GetExecutingAssembly(); string settingName = Path.GetFileNameWithoutExtension(assembly.CodeBase); if (!PaApp.SettingsHandler.GetBoolSettingsValue(settingName, "Enabled", true)) { return; } PaApp.AddMediatorColleague(this); m_dropDown = new CustomDropDown(); m_numPhonesCtrl = new NumberOfPhonesToMatchCtrl(); m_numPhonesCtrl.lnkApply.Click += lnkApply_Click; m_dropDown.AddControl(m_numPhonesCtrl); m_fntGlyph = new Font("Marlett", 9); } catch { } }
/// ------------------------------------------------------------------------------------ /// <summary> /// /// </summary> /// ------------------------------------------------------------------------------------ public PaAddOnManager() { try { Assembly assembly = Assembly.GetExecutingAssembly(); if (!VerifyAddOnMediatorExists(assembly)) { return; } string settingName = Path.GetFileNameWithoutExtension(assembly.CodeBase); if (PaApp.SettingsHandler.GetBoolSettingsValue(settingName, "Enabled", true)) { PaApp.AddMediatorColleague(this); // Register to receive notification after data sources have been loaded. // Use the add-on mediator (as opposed to just responding to the // OnAfterDataSourcesLoaded message) because we want to make sure that // all other add-ons who want to have processed the message. AddOnMediator.RegisterForDataSourcesLoadedMsg(100, this); } } catch { } }
/// ------------------------------------------------------------------------------------ /// <summary> /// /// </summary> /// ------------------------------------------------------------------------------------ public PaAddOnManager() { PaApp.AddMediatorColleague(this); }