Beispiel #1
0
        public static bool Try(AppPolicyId flag)
        {
            bool bAllowed = true;

            switch (flag)
            {
            case AppPolicyId.Plugins: bAllowed = m_apfCurrent.Plugins; break;

            case AppPolicyId.Export: bAllowed = m_apfCurrent.Export; break;

            case AppPolicyId.Import: bAllowed = m_apfCurrent.Import; break;

            case AppPolicyId.Print: bAllowed = m_apfCurrent.Print; break;

            case AppPolicyId.SaveFile: bAllowed = m_apfCurrent.SaveFile; break;

            case AppPolicyId.AutoType: bAllowed = m_apfCurrent.AutoType; break;

            case AppPolicyId.CopyToClipboard: bAllowed = m_apfCurrent.CopyToClipboard; break;

            case AppPolicyId.DragDrop: bAllowed = m_apfCurrent.DragDrop; break;

            default: Debug.Assert(false); break;
            }

            if (bAllowed == false)
            {
                string strMsg = RequiredPolicyMessage(flag);
                MessageService.ShowWarning(strMsg);
            }

            return(bAllowed);
        }
Beispiel #2
0
        public static string RequiredPolicyMessage(AppPolicyId flag)
        {
            string str = KPRes.PolicyDisallowed + MessageService.NewParagraph;

            str += KPRes.PolicyRequiredFlag + ":" + MessageService.NewLine;
            str += PolicyToString(flag, true);

            return(str);
        }
Beispiel #3
0
        public static bool Try(AppPolicyId flag)
        {
            bool bAllowed = true;

            switch (flag)
            {
            case AppPolicyId.Plugins: bAllowed = m_apfCurrent.Plugins; break;

            case AppPolicyId.Export: bAllowed = m_apfCurrent.Export; break;

            case AppPolicyId.ExportNoKey: bAllowed = m_apfCurrent.ExportNoKey; break;

            case AppPolicyId.Import: bAllowed = m_apfCurrent.Import; break;

            case AppPolicyId.Print: bAllowed = m_apfCurrent.Print; break;

            case AppPolicyId.PrintNoKey: bAllowed = m_apfCurrent.PrintNoKey; break;

            case AppPolicyId.NewFile: bAllowed = m_apfCurrent.NewFile; break;

            case AppPolicyId.SaveFile: bAllowed = m_apfCurrent.SaveFile; break;

            case AppPolicyId.AutoType: bAllowed = m_apfCurrent.AutoType; break;

            case AppPolicyId.AutoTypeWithoutContext: bAllowed = m_apfCurrent.AutoTypeWithoutContext; break;

            case AppPolicyId.CopyToClipboard: bAllowed = m_apfCurrent.CopyToClipboard; break;

            case AppPolicyId.CopyWholeEntries: bAllowed = m_apfCurrent.CopyWholeEntries; break;

            case AppPolicyId.DragDrop: bAllowed = m_apfCurrent.DragDrop; break;

            case AppPolicyId.UnhidePasswords: bAllowed = m_apfCurrent.UnhidePasswords; break;

            case AppPolicyId.ChangeMasterKey: bAllowed = m_apfCurrent.ChangeMasterKey; break;

            case AppPolicyId.ChangeMasterKeyNoKey: bAllowed = m_apfCurrent.ChangeMasterKeyNoKey; break;

            case AppPolicyId.EditTriggers: bAllowed = m_apfCurrent.EditTriggers; break;

            default: Debug.Assert(false); break;
            }

            if (!bAllowed)
            {
                string strMsg = RequiredPolicyMessage(flag);
                MessageService.ShowWarning(strMsg);
            }

            return(bAllowed);
        }
Beispiel #4
0
        /* public static AppPolicyFlags New
         * {
         *      get { return m_apfNew; }
         *      set
         *      {
         *              if(value == null) throw new ArgumentNullException("value");
         *              m_apfNew = value;
         *      }
         * } */

        private static string PolicyToString(AppPolicyId flag, bool bPrefix)
        {
            string str = (bPrefix ? "* " : string.Empty);

            str += KPRes.Feature + ": ";

            switch (flag)
            {
            case AppPolicyId.Plugins:
                str += KPRes.Plugins;
                break;

            case AppPolicyId.Export:
                str += KPRes.Export;
                break;

            case AppPolicyId.ExportNoKey:
                str += KPRes.Export + " - " + KPRes.NoKeyRepeat;
                break;

            case AppPolicyId.Import:
                str += KPRes.Import;
                break;

            case AppPolicyId.Print:
                str += KPRes.Print;
                break;

            case AppPolicyId.PrintNoKey:
                str += KPRes.Print + " - " + KPRes.NoKeyRepeat;
                break;

            case AppPolicyId.NewFile:
                str += KPRes.NewDatabase;
                break;

            case AppPolicyId.SaveFile:
                str += KPRes.SaveDatabase;
                break;

            case AppPolicyId.AutoType:
                str += KPRes.AutoType;
                break;

            case AppPolicyId.AutoTypeWithoutContext:
                str += KPRes.AutoType + " - " + KPRes.WithoutContext;
                break;

            case AppPolicyId.CopyToClipboard:
                str += KPRes.Clipboard;
                break;

            case AppPolicyId.CopyWholeEntries:
                str += KPRes.CopyWholeEntries;
                break;

            case AppPolicyId.DragDrop:
                str += KPRes.DragDrop;
                break;

            case AppPolicyId.UnhidePasswords:
                str += KPRes.UnhidePasswords;
                break;

            case AppPolicyId.ChangeMasterKey:
                str += KPRes.ChangeMasterKey;
                break;

            case AppPolicyId.ChangeMasterKeyNoKey:
                str += KPRes.ChangeMasterKey + " - " + KPRes.NoKeyRepeat;
                break;

            case AppPolicyId.EditTriggers:
                str += KPRes.TriggersEdit;
                break;

            default:
                Debug.Assert(false);
                str += KPRes.Unknown + ".";
                break;
            }

            str += MessageService.NewLine;
            if (bPrefix)
            {
                str += "* ";
            }
            str += KPRes.Description + ": ";

            switch (flag)
            {
            case AppPolicyId.Plugins:
                str += KPRes.PolicyPluginsDesc;
                break;

            case AppPolicyId.Export:
                str += KPRes.PolicyExportDesc2;
                break;

            case AppPolicyId.ExportNoKey:
                str += KPRes.PolicyExportNoKeyDesc;
                break;

            case AppPolicyId.Import:
                str += KPRes.PolicyImportDesc;
                break;

            case AppPolicyId.Print:
                str += KPRes.PolicyPrintDesc;
                break;

            case AppPolicyId.PrintNoKey:
                str += KPRes.PolicyPrintNoKeyDesc;
                break;

            case AppPolicyId.NewFile:
                str += KPRes.PolicyNewDatabaseDesc;
                break;

            case AppPolicyId.SaveFile:
                str += KPRes.PolicySaveDatabaseDesc;
                break;

            case AppPolicyId.AutoType:
                str += KPRes.PolicyAutoTypeDesc;
                break;

            case AppPolicyId.AutoTypeWithoutContext:
                str += KPRes.PolicyAutoTypeWithoutContextDesc;
                break;

            case AppPolicyId.CopyToClipboard:
                str += KPRes.PolicyClipboardDesc;
                break;

            case AppPolicyId.CopyWholeEntries:
                str += KPRes.PolicyCopyWholeEntriesDesc;
                break;

            case AppPolicyId.DragDrop:
                str += KPRes.PolicyDragDropDesc;
                break;

            case AppPolicyId.UnhidePasswords:
                str += KPRes.UnhidePasswordsDesc;
                break;

            case AppPolicyId.ChangeMasterKey:
                str += KPRes.PolicyChangeMasterKey;
                break;

            case AppPolicyId.ChangeMasterKeyNoKey:
                str += KPRes.PolicyChangeMasterKeyNoKeyDesc;
                break;

            case AppPolicyId.EditTriggers:
                str += KPRes.PolicyTriggersEditDesc;
                break;

            default:
                Debug.Assert(false);
                str += KPRes.Unknown + ".";
                break;
            }

            return(str);
        }
Beispiel #5
0
        public static string RequiredPolicyMessage(AppPolicyId flag)
        {
            string str = KPRes.PolicyDisallowed + MessageService.NewParagraph;
            str += KPRes.PolicyRequiredFlag + ":" + MessageService.NewLine;
            str += PolicyToString(flag, true);

            return str;
        }
Beispiel #6
0
        /* public static AppPolicyFlags New
        {
            get { return m_apfNew; }
            set
            {
                if(value == null) throw new ArgumentNullException("value");
                m_apfNew = value;
            }
        } */
        private static string PolicyToString(AppPolicyId flag, bool bPrefix)
        {
            string str = (bPrefix ? "* " : string.Empty);
            str += KPRes.Feature + ": ";

            switch(flag)
            {
                case AppPolicyId.Plugins:
                    str += KPRes.Plugins;
                    break;
                case AppPolicyId.Export:
                    str += KPRes.Export;
                    break;
                case AppPolicyId.ExportNoKey:
                    str += KPRes.Export + " - " + KPRes.NoKeyRepeat;
                    break;
                case AppPolicyId.Import:
                    str += KPRes.Import;
                    break;
                case AppPolicyId.Print:
                    str += KPRes.Print;
                    break;
                case AppPolicyId.PrintNoKey:
                    str += KPRes.Print + " - " + KPRes.NoKeyRepeat;
                    break;
                case AppPolicyId.NewFile:
                    str += KPRes.NewDatabase;
                    break;
                case AppPolicyId.SaveFile:
                    str += KPRes.SaveDatabase;
                    break;
                case AppPolicyId.AutoType:
                    str += KPRes.AutoType;
                    break;
                case AppPolicyId.AutoTypeWithoutContext:
                    str += KPRes.AutoType + " - " + KPRes.WithoutContext;
                    break;
                case AppPolicyId.CopyToClipboard:
                    str += KPRes.Clipboard;
                    break;
                case AppPolicyId.CopyWholeEntries:
                    str += KPRes.CopyWholeEntries;
                    break;
                case AppPolicyId.DragDrop:
                    str += KPRes.DragDrop;
                    break;
                case AppPolicyId.UnhidePasswords:
                    str += KPRes.UnhidePasswords;
                    break;
                case AppPolicyId.ChangeMasterKey:
                    str += KPRes.ChangeMasterKey;
                    break;
                case AppPolicyId.ChangeMasterKeyNoKey:
                    str += KPRes.ChangeMasterKey + " - " + KPRes.NoKeyRepeat;
                    break;
                case AppPolicyId.EditTriggers:
                    str += KPRes.TriggersEdit;
                    break;
                default:
                    Debug.Assert(false);
                    str += KPRes.Unknown + ".";
                    break;
            }

            str += MessageService.NewLine;
            if(bPrefix) str += "* ";
            str += KPRes.Description + ": ";

            switch(flag)
            {
                case AppPolicyId.Plugins:
                    str += KPRes.PolicyPluginsDesc;
                    break;
                case AppPolicyId.Export:
                    str += KPRes.PolicyExportDesc;
                    break;
                case AppPolicyId.ExportNoKey:
                    str += KPRes.PolicyExportNoKeyDesc;
                    break;
                case AppPolicyId.Import:
                    str += KPRes.PolicyImportDesc;
                    break;
                case AppPolicyId.Print:
                    str += KPRes.PolicyPrintDesc;
                    break;
                case AppPolicyId.PrintNoKey:
                    str += KPRes.PolicyPrintNoKeyDesc;
                    break;
                case AppPolicyId.NewFile:
                    str += KPRes.PolicyNewDatabaseDesc;
                    break;
                case AppPolicyId.SaveFile:
                    str += KPRes.PolicySaveDatabaseDesc;
                    break;
                case AppPolicyId.AutoType:
                    str += KPRes.PolicyAutoTypeDesc;
                    break;
                case AppPolicyId.AutoTypeWithoutContext:
                    str += KPRes.PolicyAutoTypeWithoutContextDesc;
                    break;
                case AppPolicyId.CopyToClipboard:
                    str += KPRes.PolicyClipboardDesc;
                    break;
                case AppPolicyId.CopyWholeEntries:
                    str += KPRes.PolicyCopyWholeEntriesDesc;
                    break;
                case AppPolicyId.DragDrop:
                    str += KPRes.PolicyDragDropDesc;
                    break;
                case AppPolicyId.UnhidePasswords:
                    str += KPRes.UnhidePasswordsDesc;
                    break;
                case AppPolicyId.ChangeMasterKey:
                    str += KPRes.PolicyChangeMasterKey;
                    break;
                case AppPolicyId.ChangeMasterKeyNoKey:
                    str += KPRes.PolicyChangeMasterKeyNoKeyDesc;
                    break;
                case AppPolicyId.EditTriggers:
                    str += KPRes.PolicyTriggersEditDesc;
                    break;
                default:
                    Debug.Assert(false);
                    str += KPRes.Unknown + ".";
                    break;
            }

            return str;
        }
Beispiel #7
0
        public static bool Try(AppPolicyId flag)
        {
            bool bAllowed = true;

            switch(flag)
            {
                case AppPolicyId.Plugins: bAllowed = m_apfCurrent.Plugins; break;
                case AppPolicyId.Export: bAllowed = m_apfCurrent.Export; break;
                case AppPolicyId.ExportNoKey: bAllowed = m_apfCurrent.ExportNoKey; break;
                case AppPolicyId.Import: bAllowed = m_apfCurrent.Import; break;
                case AppPolicyId.Print: bAllowed = m_apfCurrent.Print; break;
                case AppPolicyId.PrintNoKey: bAllowed = m_apfCurrent.PrintNoKey; break;
                case AppPolicyId.NewFile: bAllowed = m_apfCurrent.NewFile; break;
                case AppPolicyId.SaveFile: bAllowed = m_apfCurrent.SaveFile; break;
                case AppPolicyId.AutoType: bAllowed = m_apfCurrent.AutoType; break;
                case AppPolicyId.AutoTypeWithoutContext: bAllowed = m_apfCurrent.AutoTypeWithoutContext; break;
                case AppPolicyId.CopyToClipboard: bAllowed = m_apfCurrent.CopyToClipboard; break;
                case AppPolicyId.CopyWholeEntries: bAllowed = m_apfCurrent.CopyWholeEntries; break;
                case AppPolicyId.DragDrop: bAllowed = m_apfCurrent.DragDrop; break;
                case AppPolicyId.UnhidePasswords: bAllowed = m_apfCurrent.UnhidePasswords; break;
                case AppPolicyId.ChangeMasterKey: bAllowed = m_apfCurrent.ChangeMasterKey; break;
                case AppPolicyId.ChangeMasterKeyNoKey: bAllowed = m_apfCurrent.ChangeMasterKeyNoKey; break;
                case AppPolicyId.EditTriggers: bAllowed = m_apfCurrent.EditTriggers; break;
                default: Debug.Assert(false); break;
            }

            if(bAllowed == false)
            {
                string strMsg = RequiredPolicyMessage(flag);
                MessageService.ShowWarning(strMsg);
            }

            return bAllowed;
        }
Beispiel #8
0
 public static string RequiredPolicyMessage(AppPolicyId p)
 {
     return(KPRes.PolicyDisallowed + MessageService.NewParagraph +
            KPRes.PolicyRequiredFlag + ":" + MessageService.NewLine +
            AppPolicy.GetName(p) + ".");
 }
Beispiel #9
0
        internal static string GetDesc(AppPolicyId p)
        {
            string str;

            switch (p)
            {
            case AppPolicyId.Plugins:
                str = KPRes.PolicyPluginsDesc;
                break;

            case AppPolicyId.Export:
                str = KPRes.PolicyExportDesc2;
                break;

            case AppPolicyId.ExportNoKey:
                str = KPRes.PolicyExportNoKeyDesc;
                break;

            case AppPolicyId.Import:
                str = KPRes.PolicyImportDesc;
                break;

            case AppPolicyId.Print:
                str = KPRes.PolicyPrintDesc;
                break;

            case AppPolicyId.PrintNoKey:
                str = KPRes.PolicyPrintNoKeyDesc;
                break;

            case AppPolicyId.NewFile:
                str = KPRes.PolicyNewDatabaseDesc;
                break;

            case AppPolicyId.SaveFile:
                str = KPRes.PolicySaveDatabaseDesc;
                break;

            case AppPolicyId.AutoType:
                str = KPRes.PolicyAutoTypeDesc;
                break;

            case AppPolicyId.AutoTypeWithoutContext:
                str = KPRes.PolicyAutoTypeWithoutContextDesc;
                break;

            case AppPolicyId.CopyToClipboard:
                str = KPRes.PolicyClipboardDesc;
                break;

            case AppPolicyId.CopyWholeEntries:
                str = KPRes.PolicyCopyWholeEntriesDesc;
                break;

            case AppPolicyId.DragDrop:
                str = KPRes.PolicyDragDropDesc;
                break;

            case AppPolicyId.UnhidePasswords:
                str = KPRes.UnhidePasswordsDesc;
                break;

            case AppPolicyId.ChangeMasterKey:
                str = KPRes.PolicyChangeMasterKey;
                break;

            case AppPolicyId.ChangeMasterKeyNoKey:
                str = KPRes.PolicyChangeMasterKeyNoKeyDesc;
                break;

            case AppPolicyId.EditTriggers:
                str = KPRes.PolicyTriggersEditDesc;
                break;

            default:
                Debug.Assert(false);
                str = KPRes.Unknown + ".";
                break;
            }

            return(str);
        }
Beispiel #10
0
        /* public static AppPolicyFlags New
         * {
         *      get { return m_apfNew; }
         *      set
         *      {
         *              if(value == null) throw new ArgumentNullException("value");
         *              m_apfNew = value;
         *      }
         * } */

        internal static string GetName(AppPolicyId p)
        {
            string str;

            switch (p)
            {
            case AppPolicyId.Plugins:
                str = KPRes.Plugins;
                break;

            case AppPolicyId.Export:
                str = KPRes.Export;
                break;

            case AppPolicyId.ExportNoKey:
                str = KPRes.Export + " - " + KPRes.NoKeyRepeat;
                break;

            case AppPolicyId.Import:
                str = KPRes.Import;
                break;

            case AppPolicyId.Print:
                str = KPRes.Print;
                break;

            case AppPolicyId.PrintNoKey:
                str = KPRes.Print + " - " + KPRes.NoKeyRepeat;
                break;

            case AppPolicyId.NewFile:
                str = KPRes.NewDatabase;
                break;

            case AppPolicyId.SaveFile:
                str = KPRes.SaveDatabase;
                break;

            case AppPolicyId.AutoType:
                str = KPRes.AutoType;
                break;

            case AppPolicyId.AutoTypeWithoutContext:
                str = KPRes.AutoType + " - " + KPRes.WithoutContext;
                break;

            case AppPolicyId.CopyToClipboard:
                str = KPRes.Copy;
                break;

            case AppPolicyId.CopyWholeEntries:
                str = KPRes.CopyWholeEntries;
                break;

            case AppPolicyId.DragDrop:
                str = KPRes.DragDrop;
                break;

            case AppPolicyId.UnhidePasswords:
                str = KPRes.UnhidePasswords;
                break;

            case AppPolicyId.ChangeMasterKey:
                str = KPRes.ChangeMasterKey;
                break;

            case AppPolicyId.ChangeMasterKeyNoKey:
                str = KPRes.ChangeMasterKey + " - " + KPRes.NoKeyRepeat;
                break;

            case AppPolicyId.EditTriggers:
                str = KPRes.TriggersEdit;
                break;

            default:
                Debug.Assert(false);
                str = KPRes.Unknown;
                break;
            }

            return(str);
        }
Beispiel #11
0
        /* public static AppPolicyFlags New
         * {
         *      get { return m_apfNew; }
         *      set
         *      {
         *              if(value == null) throw new ArgumentNullException("value");
         *              m_apfNew = value;
         *      }
         * } */

        private static string PolicyToString(AppPolicyId flag, bool bPrefix)
        {
            string str = (bPrefix ? "* " : string.Empty);

            str += KPRes.Feature + @": ";

            switch (flag)
            {
            case AppPolicyId.Plugins:
                str += KPRes.Plugins;
                break;

            case AppPolicyId.Export:
                str += KPRes.Export;
                break;

            case AppPolicyId.Import:
                str += KPRes.Import;
                break;

            case AppPolicyId.Print:
                str += KPRes.Print;
                break;

            case AppPolicyId.SaveFile:
                str += KPRes.SaveDatabase;
                break;

            case AppPolicyId.AutoType:
                str += KPRes.AutoType;
                break;

            case AppPolicyId.CopyToClipboard:
                str += KPRes.Clipboard;
                break;

            case AppPolicyId.DragDrop:
                str += KPRes.DragDrop;
                break;

            default:
                Debug.Assert(false);
                str += KPRes.Unknown + ".";
                break;
            }

            str += MessageService.NewLine;
            if (bPrefix)
            {
                str += "* ";
            }
            str += KPRes.Description + @": ";

            switch (flag)
            {
            case AppPolicyId.Plugins:
                str += KPRes.PolicyPluginsDesc;
                break;

            case AppPolicyId.Export:
                str += KPRes.PolicyExportDesc;
                break;

            case AppPolicyId.Import:
                str += KPRes.PolicyImportDesc;
                break;

            case AppPolicyId.Print:
                str += KPRes.PolicyPrintDesc;
                break;

            case AppPolicyId.SaveFile:
                str += KPRes.PolicySaveDatabaseDesc;
                break;

            case AppPolicyId.AutoType:
                str += KPRes.PolicyAutoTypeDesc;
                break;

            case AppPolicyId.CopyToClipboard:
                str += KPRes.PolicyClipboardDesc;
                break;

            case AppPolicyId.DragDrop:
                str += KPRes.PolicyDragDropDesc;
                break;

            default:
                Debug.Assert(false);
                str += KPRes.Unknown + ".";
                break;
            }

            return(str);
        }