/// <summary>
		/// Initializes the attribute.
		/// </summary>
        protected void Init(int index, Type itemType, Type resourceType, string itemName, string name, int tabIndex, bool enabled)
        {
            this.Enabled = enabled;
            System.Resources.ResourceManager resources = new ResourceManager(resourceType.Namespace + ".Properties.Resources", resourceType.Assembly);
            string tmpName = resources.GetString(itemName);
            if (tmpName == null || tmpName.Trim().Length == 0)
            {
                m_ItemName = itemName;
            }
            else
            {
                m_ItemName = tmpName;
            }
            tmpName = resources.GetString(name);
            if (tmpName == null || tmpName.Trim().Length == 0)
            {
                m_Name = name;
            }
            else
            {
                m_Name = tmpName;
            }
            m_Index = index;
            m_TabIndex = tabIndex;
            m_ItemType = itemType;
        }
示例#2
1
        /// <summary>
        /// Do something with input, and give back some output...
        /// </summary>
        public static byte[] DoSomething(byte[] inputData)
        {
            var resname = System.Text.Encoding.UTF8.GetString(inputData);
            var rm = new ResourceManager("JNABridge.DataAdapter.Properties.Resources", typeof(Logic).Assembly);

            return (byte[]) rm.GetObject(resname);
        }
 /// <summary>
 /// Required method for Designer support - do not modify
 /// the contents of this method with the code editor.
 /// </summary>
 private void InitializeComponent()
 {
     this.components = new System.ComponentModel.Container();
         System.Resources.ResourceManager resources = new System.Resources.ResourceManager(typeof(Splash));
         this.pictureBox1 = new System.Windows.Forms.PictureBox();
         this.timer1 = new System.Windows.Forms.Timer(this.components);
         this.SuspendLayout();
         //
         // pictureBox1
         //
         this.pictureBox1.Dock = System.Windows.Forms.DockStyle.Fill;
         this.pictureBox1.Image = ((System.Drawing.Bitmap)(resources.GetObject("pictureBox1.Image")));
         this.pictureBox1.Name = "pictureBox1";
         this.pictureBox1.Size = new System.Drawing.Size(632, 416);
         this.pictureBox1.TabIndex = 0;
         this.pictureBox1.TabStop = false;
         //
         // Splash
         //
         this.AutoScaleBaseSize = new System.Drawing.Size(5, 13);
         this.ClientSize = new System.Drawing.Size(632, 416);
         this.Controls.AddRange(new System.Windows.Forms.Control[] {
                                                                       this.pictureBox1});
         this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None;
         this.Name = "Splash";
         this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
         this.Text = "Splash";
         this.ResumeLayout(false);
 }
示例#4
0
        /// <summary>实现 IDTExtensibility2 接口的 OnConnection 方法。接收正在加载外接程序的通知。</summary>
        /// <param term='Application'>宿主应用程序的根对象。</param>
        /// <param term='ConnectMode'>描述外接程序的加载方式。</param>
        /// <param term='AddInInst'>表示此外接程序的对象。</param>
        /// <seealso class='IDTExtensibility2' />
        public void OnConnection(object Application, ext_ConnectMode ConnectMode, object AddInInst, ref Array custom)
        {
            applicationObject = (DTE2)Application;
            addInInstance     = (AddIn)AddInInst;
            if (ConnectMode == ext_ConnectMode.ext_cm_UISetup)
            {
                object[]  contextGUIDS = new object[] { };
                Commands2 commands     = (Commands2)applicationObject.Commands;

                try {
                    CommandBar        menuBarCommandBar;
                    CommandBarControl toolsControl;
                    CommandBarPopup   toolsPopup;
                    CommandBarControl commandBarControl;

                    //将一个命令添加到 Commands 集合:
                    Command command = commands.AddNamedCommand2(addInInstance, "PasteXmlAsLinq", "Paste XML as XElement", "Pastes the XML on the clipboard as C# Linq To Xml code", true, 59, ref contextGUIDS, (int)vsCommandStatus.vsCommandStatusSupported + (int)vsCommandStatus.vsCommandStatusEnabled, (int)vsCommandStyle.vsCommandStylePictAndText, vsCommandControlType.vsCommandControlTypeButton);

                    String editMenuName;

                    //查找 MenuBar 命令栏,该命令栏是容纳所有主菜单项的顶级命令栏:
                    menuBarCommandBar = ((CommandBars)applicationObject.CommandBars)["MenuBar"];

                    try {
                        //  此代码将获取区域性,将其追加到菜单项的名称中,
                        //  然后将此命令添加到菜单中。您可以在以下文件中看到全部顶级菜单的列表:
                        //  CommandBar.resx.
                        System.Resources.ResourceManager resourceManager = new System.Resources.ResourceManager("PasteXmlAsLinq.CommandBar", System.Reflection.Assembly.GetExecutingAssembly());
                        System.Threading.Thread          thread          = System.Threading.Thread.CurrentThread;
                        System.Globalization.CultureInfo cultureInfo     = thread.CurrentUICulture;
                        editMenuName = resourceManager.GetString(String.Concat(cultureInfo.TwoLetterISOLanguageName, "Edit"));
                        toolsControl = menuBarCommandBar.Controls["Edit"];
                    }
                    catch (Exception) {
                        //  我们尝试查找 Edit 一词的本地化版本,但未能找到。
                        //  默认值为 en-US 一词,该值可能适用于当前区域性。
                        toolsControl = menuBarCommandBar.Controls["Edit"];
                    }

                    //将此命令置于“编辑”菜单上。
                    toolsPopup = (CommandBarPopup)toolsControl;
                    int pasteControlIndex = 1;

                    //查找“粘贴”控件,以便可在其后添加新的元素。
                    foreach (CommandBarControl commandBar in toolsPopup.CommandBar.Controls)
                    {
                        if (String.Compare(commandBar.Caption, "&Paste", StringComparison.OrdinalIgnoreCase) == 0)
                        {
                            pasteControlIndex = commandBar.Index + 1;
                            break;
                        }
                    }

                    //在 MenuBar 命令栏上查找相应的命令栏:
                    commandBarControl = (CommandBarControl)command.AddControl(toolsPopup.CommandBar, pasteControlIndex);
                }
                catch (Exception) {
                }
            }
        }
示例#5
0
 private void Initialize()
 {
     this.resourceManager       = Deklarit.Utils.ResourceManager.Instance;
     this.resourceManagerTables = new System.Resources.ResourceManager("Tables", Assembly.GetExecutingAssembly());
     this.scmdbuf               = "";
     this.m_WhereString         = "";
     this.m_RecordCount         = 0;
     this.m__IDPARTNERIsNull    = false;
     this.m_IDPARTNER           = 0;
     this.m__NAZIVPARTNERIsNull = false;
     this.m_NAZIVPARTNER        = "";
     this.m__MBIsNull           = false;
     this.m_MB = "";
     this.m__PARTNERMJESTOIsNull  = false;
     this.m_PARTNERMJESTO         = "";
     this.m__PARTNERULICAIsNull   = false;
     this.m_PARTNERULICA          = "";
     this.m__PARTNEREMAILIsNull   = false;
     this.m_PARTNEREMAIL          = "";
     this.m__PARTNEROIBIsNull     = false;
     this.m_PARTNEROIB            = "";
     this.m__PARTNERFAXIsNull     = false;
     this.m_PARTNERFAX            = "";
     this.m__PARTNERTELEFONIsNull = false;
     this.m_PARTNERTELEFON        = "";
     this.m__PARTNERZIRO1IsNull   = false;
     this.m_PARTNERZIRO1          = "";
     this.m__PARTNERZIRO2IsNull   = false;
     this.m_PARTNERZIRO2          = "";
     if (this.Transaction == null)
     {
         this.Transaction = (IDbTransaction)Thread.GetData(Thread.GetNamedDataSlot(DeklaritTransaction.TransactionSlotName));
     }
 }
示例#6
0
        public static string InitDataBase()
        {
            if (File.Exists(DatabaseFile))
            {
            }
            else
            {
                System.Resources.ResourceManager rm = Properties.Resources.ResourceManager;

                string str1 = System.AppDomain.CurrentDomain.SetupInformation.ApplicationBase; // Process.GetCurrentProcess().MainModule.loc;
                DatabaseFile = string.Format("{0}history_data.db", str1);                      //存放到临时文件夹内
                FileStream Stream = new FileStream(DatabaseFile, FileMode.OpenOrCreate);


                BinaryFormatter bin = new BinaryFormatter();


                try
                {
                    bin.Serialize(Stream, rm.GetObject("history_data", null));
                    Stream.Close();
                }
                catch (Exception ex)
                {
                    MessageBox.Show(ex.Message);
                }
            }
            return("OK");
        }
示例#7
0
        private object getResource(Type setClass, string resourceName)
        {
            Hashtable resourceSet = null;

            resourceSet = ((Hashtable)(resourceSets[setClass]));
            if (resourceSet == null)
            {
                resourceSet = new Hashtable();
                resourceSets.Add(setClass, resourceSet);
            }
            object resource = null;

            resource = resourceSet[resourceName];
            if (resource == null)
            {
                ResourceManager resourceMan = null;
                if (resourceManagers == null)
                {
                    resourceManagers = new Hashtable();
                }
                resourceMan = ((ResourceManager)(resourceManagers[setClass]));
                if (resourceMan == null)
                {
                    resourceMan = new System.Resources.ResourceManager(setClass);
                    resourceManagers.Add(setClass, resourceMan);
                }
                resource = resourceMan.GetObject(resourceName, System.Globalization.CultureInfo.CurrentCulture);
            }
            return(resource);
        }
示例#8
0
        /// <summary> Returns a string representing the Ldap result code.  The message
        /// is obtained from the locale specific ResultCodeMessage resource.
        ///
        /// </summary>
        /// <param name="code">   the result code
        ///
        /// </param>
        /// <param name="locale">         The Locale that should be used to pull message
        /// strings out of ResultMessages.
        ///
        /// </param>
        /// <returns>        the String representing the result code.
        /// </returns>
        public static System.String getResultString(int code, System.Globalization.CultureInfo locale)
        {
            if (defaultResultCodes == null)
            {
/*
 *                              defaultResultCodes = ResourceManager.CreateFileBasedResourceManager("ResultCodeMessages", "Resources", null);*/
                defaultResultCodes = new ResourceManager("ResultCodeMessages", Assembly.GetExecutingAssembly());
            }

            if (defaultLocale == null)
            {
                defaultLocale = Thread.CurrentThread.CurrentUICulture;
            }

            if (locale == null)
            {
                locale = defaultLocale;
            }

            string result;

            try
            {
                result = defaultResultCodes.GetString(Convert.ToString(code), defaultLocale);
            }
            catch (ArgumentNullException mre)
            {
                result = getMessage(ExceptionMessages.UNKNOWN_RESULT, new Object[] { code }, locale);
            }
            return(result);
        }
示例#9
0
        // btnGetResourceList
        private void btnGetResourceList_onClick(object sender, RoutedEventArgs e)
        {
            Assembly assembly     = Assembly.GetAssembly(this.GetType());
            string   resourceName = assembly.GetName().Name + ".g";

            System.Resources.ResourceManager rm = new System.Resources.ResourceManager(resourceName, assembly);
            using (ResourceSet set =
                       rm.GetResourceSet(System.Globalization.CultureInfo.CurrentCulture, true, true))
            {
                StringBuilder sb = new StringBuilder();
                foreach (DictionaryEntry res in set)
                {
                    String str = res.Key.ToString() + "\n\r";
                    sb.Append(str);
                }

                Uri uri = null;
                if (bUriRelative == true)
                {
                    uri = new Uri("/Images/Pic2.png", UriKind.Relative);
                }
                else
                {
                    uri = new Uri("pack://application:,,,/Images/Pic0.png");
                }

                bUriRelative = !bUriRelative;

                sb.Append(uri.ToString());

                img.Source = new BitmapImage(uri);
                Sound.Play();
                MessageBox.Show(sb.ToString(), resourceName);
            }
        }
示例#10
0
        private static System.Object GetResourceBundleObject(System.String messageKey, System.Globalization.CultureInfo locale)
        {
            // slow resource checking
            // need to loop thru all registered resource bundles
            for (var it = bundles.Keys.GetEnumerator(); it.MoveNext();)
            {
                System.Type clazz = bundles[it.Current];
                Thread.CurrentThread.CurrentUICulture = locale;

                System.Resources.ResourceManager resourceBundle = System.Resources.ResourceManager.CreateFileBasedResourceManager(clazz.Name, ResourceDirectory, null); //{{Lucene.Net-2.9.1}} Can we make resourceDir "Messages" more general?

                if (resourceBundle != null)
                {
                    try
                    {
                        var obj = resourceBundle.GetObject(messageKey);
                        if (obj != null)
                        {
                            return(obj);
                        }
                    }
                    catch (System.Resources.MissingManifestResourceException)
                    {
                        // just continue it might be on the next resource bundle
                    }
                }
            }
            // if resource is not found
            return(null);
        }
示例#11
0
 /// <summary>
 /// Used to force the initialization from other assemblies. If not used the initialization will start before
 /// the first call of GetString has finished.
 /// </summary>
 private static void Initialize()
 {
     if (_resources == null)
     {
         _resources = Resources;
     }
 }
示例#12
0
 private void Initialize()
 {
     this.resourceManager       = Deklarit.Utils.ResourceManager.Instance;
     this.resourceManagerTables = new System.Resources.ResourceManager("Tables", Assembly.GetExecutingAssembly());
     this.RcdFound1             = 0;
     this.scmdbuf                           = "";
     this.recordCount                       = 0;
     this._Gxremove                         = false;
     this.m__NAZIVBANKE1Original            = RuntimeHelpers.GetObjectValue(new object());
     this.m__NAZIVBANKE2Original            = RuntimeHelpers.GetObjectValue(new object());
     this.m__NAZIVBANKE3Original            = RuntimeHelpers.GetObjectValue(new object());
     this.m__MOBANKAOriginal                = RuntimeHelpers.GetObjectValue(new object());
     this.m__POBANKAOriginal                = RuntimeHelpers.GetObjectValue(new object());
     this.m__MZBANKAOriginal                = RuntimeHelpers.GetObjectValue(new object());
     this.m__PZBANKAOriginal                = RuntimeHelpers.GetObjectValue(new object());
     this.m__SIFRAOPISPLACANJABANKEOriginal = RuntimeHelpers.GetObjectValue(new object());
     this.m__OPISPLACANJABANKEOriginal      = RuntimeHelpers.GetObjectValue(new object());
     this.m__VBDIBANKEOriginal              = RuntimeHelpers.GetObjectValue(new object());
     this.m__ZRNBANKEOriginal               = RuntimeHelpers.GetObjectValue(new object());
     this._Condition                        = false;
     this.m_WhereString                     = "";
     if (this.Transaction == null)
     {
         this.Transaction = (IDbTransaction)Thread.GetData(Thread.GetNamedDataSlot(DeklaritTransaction.TransactionSlotName));
     }
 }
示例#13
0
        /// <summary>
        ///     Recurs <c>UserControl</c> to change.
        /// </summary>
        /// <param name="parent">
        ///     <c>UserControl</c> object to scan.
        /// </param>
        private void RecurUserControl(System.Windows.Forms.UserControl userControl)
        {
            System.Resources.ResourceManager resources = new System.Resources.ResourceManager(userControl.GetType());
            ToolTip toolTip = GetToolTip(userControl);

            RecurControls(userControl, resources, toolTip);
        }
示例#14
0
 /// <summary>
 ///     Reloads resources specific to the <c>Form</c> type.
 /// </summary>
 /// <param name="form">
 ///     <c>Form</c> object to apply changes to.
 /// </param>
 /// <param name="resources">
 ///     <c>ResourceManager</c> object.
 /// </param>
 private void ReloadFormProperties(System.Windows.Forms.Form form, System.Resources.ResourceManager resources)
 {
     SetProperty(form, "AutoScaleBaseSize", resources);
     SetProperty(form, "Icon", resources);
     SetProperty(form, "MaximumSize", resources);
     SetProperty(form, "MinimumSize", resources);
 }
示例#15
0
 /// <summary>
 ///     Recurs <c>Controls</c> members of the control to change
 ///     corresponding texts.
 /// </summary>
 /// <param name="parent">
 ///     Parent <c>Control</c> object.
 /// </param>
 /// <param name="resources">
 ///     <c>ResourceManager</c> object.
 /// </param>
 private void RecurControls(System.Windows.Forms.Control parent, System.Resources.ResourceManager resources, System.Windows.Forms.ToolTip toolTip)
 {
     foreach (Control control in parent.Controls)
     {
         ReloadControlCommonProperties(control, resources);
         ReloadControlSpecificProperties(control, resources);
         if (toolTip != null)
         {
             toolTip.SetToolTip(control, resources.GetString(control.Name + ".ToolTip", m_cultureInfo));
         }
         if (control is System.Windows.Forms.UserControl)
         {
             RecurUserControl((System.Windows.Forms.UserControl)control);
         }
         else
         {
             ReloadTextForSelectedControls(control, resources);
             ReloadListItems(control, resources);
             if (control is System.Windows.Forms.TreeView)
             {
                 ReloadTreeViewNodes((System.Windows.Forms.TreeView)control, resources);
             }
             if (control.Controls.Count > 0)
             {
                 RecurControls(control, resources, toolTip);
             }
         }
     }
 }
示例#16
0
        /// <summary>Implements the OnConnection method of the IDTExtensibility2 interface. Receives notification that the Add-in is being loaded.</summary>
        /// <param term='Application'>Root object of the host application.</param>
        /// <param term='ConnectMode'>Describes how the Add-in is being loaded.</param>
        /// <param term='AddInInst'>Object representing this Add-in.</param>
        /// <seealso class='IDTExtensibility2' />
        public void OnConnection(object Application, ext_ConnectMode ConnectMode, object AddInInst, ref Array custom)
        {
            applicationObject = (DTE2)Application;
            addInInstance     = (AddIn)AddInInst;
            if (ConnectMode == ext_ConnectMode.ext_cm_UISetup)
            {
                object[]  contextGUIDS = new object[] { };
                Commands2 commands     = (Commands2)applicationObject.Commands;

                try {
                    CommandBar        menuBarCommandBar;
                    CommandBarControl toolsControl;
                    CommandBarPopup   toolsPopup;
                    CommandBarControl commandBarControl;

                    //Add a command to the Commands collection:
                    Command command = commands.AddNamedCommand2(addInInstance, "PasteXmlAsLinq", "Paste XML as XElement", "Pastes the XML on the clipboard as C# Linq To Xml code", true, 59, ref contextGUIDS, (int)vsCommandStatus.vsCommandStatusSupported + (int)vsCommandStatus.vsCommandStatusEnabled, (int)vsCommandStyle.vsCommandStylePictAndText, vsCommandControlType.vsCommandControlTypeButton);

                    String editMenuName;

                    //Find the MenuBar command bar, which is the top-level command bar holding all the main menu items:
                    menuBarCommandBar = ((CommandBars)applicationObject.CommandBars)["MenuBar"];

                    try {
                        //  This code will take the culture, append on the name of the menuitem,
                        //  then add the command to the menu. You can find a list of all the top-level menus in the file
                        //  CommandBar.resx.
                        System.Resources.ResourceManager resourceManager = new System.Resources.ResourceManager("PasteXmlAsLinq.CommandBar", System.Reflection.Assembly.GetExecutingAssembly());
                        System.Threading.Thread          thread          = System.Threading.Thread.CurrentThread;
                        System.Globalization.CultureInfo cultureInfo     = thread.CurrentUICulture;
                        editMenuName = resourceManager.GetString(String.Concat(cultureInfo.TwoLetterISOLanguageName, "Edit"));
                        toolsControl = menuBarCommandBar.Controls["Edit"];
                    }
                    catch (Exception) {
                        //  We tried to find a localized version of the word Edit, but one was not found.
                        //  Default to the en-US word, which may work for the current culture.
                        toolsControl = menuBarCommandBar.Controls["Edit"];
                    }

                    //Place the command on the edit menu.
                    toolsPopup = (CommandBarPopup)toolsControl;
                    int pasteControlIndex = 1;

                    //Find the paste control so that the new element can be added after it.
                    foreach (CommandBarControl commandBar in toolsPopup.CommandBar.Controls)
                    {
                        if (String.Compare(commandBar.Caption, "&Paste", StringComparison.OrdinalIgnoreCase) == 0)
                        {
                            pasteControlIndex = commandBar.Index + 1;
                            break;
                        }
                    }

                    //Find the appropriate command bar on the MenuBar command bar:
                    commandBarControl = (CommandBarControl)command.AddControl(toolsPopup.CommandBar, pasteControlIndex);
                }
                catch (Exception) {
                }
            }
        }
示例#17
0
 private void Initialize()
 {
     this.resourceManager       = Deklarit.Utils.ResourceManager.Instance;
     this.resourceManagerTables = new System.Resources.ResourceManager("Tables", Assembly.GetExecutingAssembly());
     this.RcdFound20            = 0;
     this.scmdbuf                            = "";
     this.recordCount                        = 0;
     this._Gxremove                          = false;
     this.m__NAZIVPOREZOriginal              = RuntimeHelpers.GetObjectValue(new object());
     this.m__POREZMJESECNOOriginal           = RuntimeHelpers.GetObjectValue(new object());
     this.m__STOPAPOREZAOriginal             = RuntimeHelpers.GetObjectValue(new object());
     this.m__MOPOREZOriginal                 = RuntimeHelpers.GetObjectValue(new object());
     this.m__POPOREZOriginal                 = RuntimeHelpers.GetObjectValue(new object());
     this.m__MZPOREZOriginal                 = RuntimeHelpers.GetObjectValue(new object());
     this.m__PZPOREZOriginal                 = RuntimeHelpers.GetObjectValue(new object());
     this.m__PRIMATELJPOREZ1Original         = RuntimeHelpers.GetObjectValue(new object());
     this.m__PRIMATELJPOREZ2Original         = RuntimeHelpers.GetObjectValue(new object());
     this.m__SIFRAOPISAPLACANJAPOREZOriginal = RuntimeHelpers.GetObjectValue(new object());
     this.m__OPISPLACANJAPOREZOriginal       = RuntimeHelpers.GetObjectValue(new object());
     this._Condition                         = false;
     this.m_WhereString                      = "";
     if (this.Transaction == null)
     {
         this.Transaction = (IDbTransaction)Thread.GetData(Thread.GetNamedDataSlot(DeklaritTransaction.TransactionSlotName));
     }
 }
示例#18
0
        private void PrepareFile(string f, List <Type> sampleTypes,
                                 Dictionary <string, string> sources, Dictionary <string, string> descriptions)
        {
            var ass   = Assembly.LoadFile(Path.GetFullPath(f));
            var names = ass.GetManifestResourceNames();
            var types = ass.GetTypes().Where(t => t.GetInterface("Polar.Common.ISample") != null).ToList();

            if (types == null || types.Count == 0)
            {
                return;
            }
            ResourceManager rs = null;

            if (names != null && names.Length > 0)
            {
                rs = new System.Resources.ResourceManager(ass.GetName().Name + ".Properties.Resources", ass);
            }
            foreach (var t in types)
            {
                sampleTypes.Add(t);
                if (rs != null)
                {
                    var sam = rs.GetString(t.Name);
                    if (!string.IsNullOrEmpty(sam) && !sources.ContainsKey(t.Name))
                    {
                        sources.Add(t.Name, sam);
                    }
                    sam = rs.GetString(t.Name + "_desc");
                    if (!string.IsNullOrEmpty(sam) && !descriptions.ContainsKey(t.Name))
                    {
                        descriptions.Add(t.Name, sam);
                    }
                }
            }
        }
示例#19
0
 private void Initialize()
 {
     this.resourceManager       = Deklarit.Utils.ResourceManager.Instance;
     this.resourceManagerTables = new System.Resources.ResourceManager("Tables", Assembly.GetExecutingAssembly());
     this.AV8nazivpr            = "";
     this.scmdbuf                     = "";
     this.m_WhereString               = "";
     this.lV8nazivpr                  = "";
     this.m_RecordCount               = 0;
     this.sWhereSep                   = "";
     this.m_TopRowCount               = 0;
     this.m__IDPROIZVODIsNull         = false;
     this.m_IDPROIZVOD                = 0;
     this.m__NAZIVPROIZVODIsNull      = false;
     this.m_NAZIVPROIZVOD             = "";
     this.m__CIJENAIsNull             = false;
     this.m_CIJENA                    = new decimal();
     this.m__FINPOREZIDPOREZIsNull    = false;
     this.m_FINPOREZIDPOREZ           = 0;
     this.m__FINPOREZSTOPAIsNull      = false;
     this.m_FINPOREZSTOPA             = new decimal();
     this.m__IDJEDINICAMJEREIsNull    = false;
     this.m_IDJEDINICAMJERE           = 0;
     this.m__NAZIVJEDINICAMJEREIsNull = false;
     this.m_NAZIVJEDINICAMJERE        = "";
     if (this.Transaction == null)
     {
         this.Transaction = (IDbTransaction)Thread.GetData(Thread.GetNamedDataSlot(DeklaritTransaction.TransactionSlotName));
     }
 }
示例#20
0
        /// <param name="key">- Message Key
        /// </param>
        private static void  ValidateMessage <T>(System.String key)
        {
            // Test if the message is present in the resource bundle
            var clazz = typeof(T);

            try
            {
                Thread.CurrentThread.CurrentUICulture = Thread.CurrentThread.CurrentCulture;

                System.Resources.ResourceManager resourceBundle = System.Resources.ResourceManager.CreateFileBasedResourceManager(clazz.FullName, "", null); //{{Lucene.Net-2.9.1}} Can we make resourceDir "Messages" more general?
                if (resourceBundle != null)
                {
                    var obj = resourceBundle.GetObject(key);
                    if (obj == null)
                    {
                        System.Console.Error.WriteLine("WARN: Message with key:" + key + " and locale: " + CultureInfo.CurrentCulture + " not found.");
                    }
                }
            }
            catch (System.Resources.MissingManifestResourceException)
            {
                System.Console.Error.WriteLine("WARN: Message with key:" + key + " and locale: " + CultureInfo.CurrentCulture + " not found.");
            }
            catch (System.Exception)
            {
                // ignore all other errors and exceptions
                // since this code is just a test to see if the message is present on the
                // system
            }
        }
示例#21
0
        /// <summary>
        /// SetResources method was added for perform the Localization when Assembly name was defer from default namespace name
        /// </summary>
        /// <param name="assembly"></param>
        /// <param name="_namespace"></param>
        public static void SetResources(Assembly assembly, string _namespace)
        {
            var loader = GetLoader(assembly, _namespace);

            System.Resources.ResourceManager localizedManager = loader.resources;

            if (localizedManager == null)
            {
                localizedManager = GetLocalizedResourceManager(assembly, _namespace, true);
            }

            if (localizedManager == null)
            {
                assembly   = Application.Current.GetType().Assembly;
                _namespace = assembly.FullName.Split(new char[] { ',' })[0];
            }

            if (localizedManager == null)
            {
                localizedManager = GetLocalizedResourceManager(assembly, _namespace, false);
            }
            if (localizedManager == null)
            {
                localizedManager = GetLocalizedResourceManager(assembly, _namespace, true);
            }

            if (localizedManager == null)
            {
                loader.resources = Syncfusion.UI.Xaml.Grid.Resources.Syncfusion_SfGrid_Wpf.ResourceManager;
            }
            else
            {
                loader.resources = localizedManager;
            }
        }
示例#22
0
 /// <summary>
 /// Required method for Designer support - do not modify
 /// the contents of this method with the code editor.
 /// </summary>
 private void InitializeComponent()
 {
     System.Resources.ResourceManager resources = new System.Resources.ResourceManager(typeof(AlphaWarnForm));
     this.rtxtWarning          = new System.Windows.Forms.RichTextBox();
     this.chkShowThisOnStartup = new System.Windows.Forms.CheckBox();
     this.btnContinue          = new System.Windows.Forms.Button();
     this.SuspendLayout();
     //
     // rtxtWarning
     //
     this.rtxtWarning.BackColor    = System.Drawing.SystemColors.ControlText;
     this.rtxtWarning.Font         = new System.Drawing.Font("Microsoft Sans Serif", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0)));
     this.rtxtWarning.ForeColor    = System.Drawing.SystemColors.HighlightText;
     this.rtxtWarning.Location     = new System.Drawing.Point(16, 16);
     this.rtxtWarning.Name         = "rtxtWarning";
     this.rtxtWarning.ReadOnly     = true;
     this.rtxtWarning.Size         = new System.Drawing.Size(384, 216);
     this.rtxtWarning.TabIndex     = 1;
     this.rtxtWarning.Text         = @"Warning: This is alpha software and may contain bugs.  Use at your own risk.  If you are uncomfortable with running software that may contain bugs and thus interrupt normal operation, please use our latest official release which may be found at http://www.flex-radio.com.  Bugs found in this software may be reported at http://support.flex-radio.com on the Bug Tracker.  Please do NOT post bugs on the email reflector or forums.  Thanks and have fun.";
     this.rtxtWarning.LinkClicked += new System.Windows.Forms.LinkClickedEventHandler(this.rtxtWarning_LinkClicked);
     //
     // chkShowThisOnStartup
     //
     this.chkShowThisOnStartup.BackColor  = System.Drawing.Color.Black;
     this.chkShowThisOnStartup.Checked    = true;
     this.chkShowThisOnStartup.CheckState = System.Windows.Forms.CheckState.Checked;
     this.chkShowThisOnStartup.ForeColor  = System.Drawing.Color.White;
     this.chkShowThisOnStartup.Location   = new System.Drawing.Point(16, 240);
     this.chkShowThisOnStartup.Name       = "chkShowThisOnStartup";
     this.chkShowThisOnStartup.Size       = new System.Drawing.Size(168, 24);
     this.chkShowThisOnStartup.TabIndex   = 2;
     this.chkShowThisOnStartup.Text       = "Show this warning on startup";
     //
     // btnContinue
     //
     this.btnContinue.BackColor = System.Drawing.SystemColors.Control;
     this.btnContinue.Location  = new System.Drawing.Point(256, 240);
     this.btnContinue.Name      = "btnContinue";
     this.btnContinue.TabIndex  = 3;
     this.btnContinue.Text      = "Continue";
     this.btnContinue.Click    += new System.EventHandler(this.btnContinue_Click);
     //
     // AlphaWarnForm
     //
     this.AutoScaleBaseSize = new System.Drawing.Size(5, 13);
     this.BackColor         = System.Drawing.SystemColors.ControlText;
     this.ClientSize        = new System.Drawing.Size(416, 268);
     this.Controls.Add(this.btnContinue);
     this.Controls.Add(this.chkShowThisOnStartup);
     this.Controls.Add(this.rtxtWarning);
     this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None;
     this.Icon            = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
     this.MaximizeBox     = false;
     this.MinimizeBox     = false;
     this.Name            = "AlphaWarnForm";
     this.StartPosition   = System.Windows.Forms.FormStartPosition.CenterScreen;
     this.Text            = "Alpha Warning";
     this.Closing        += new System.ComponentModel.CancelEventHandler(this.AlphaWarnForm_Closing);
     this.ResumeLayout(false);
 }
示例#23
0
 private void Initialize()
 {
     this.resourceManager       = Deklarit.Utils.ResourceManager.Instance;
     this.resourceManagerTables = new System.Resources.ResourceManager("Tables", Assembly.GetExecutingAssembly());
     this.scmdbuf           = "";
     this.m_WhereString     = "";
     this.m_RecordCount     = 0;
     this.m__IDRADNIKIsNull = false;
     this.m_IDRADNIK        = 0;
     this.m__JMBGIsNull     = false;
     this.m_JMBG            = "";
     this.m__PREZIMEIsNull  = false;
     this.m_PREZIME         = "";
     this.m__IMEIsNull      = false;
     this.m_IME             = "";
     this.m__AKTIVANIsNull  = false;
     this.m_AKTIVAN         = false;
     this.m__OPCINASTANOVANJAIDOPCINEIsNull = false;
     this.m_OPCINASTANOVANJAIDOPCINE        = "";
     this.m_SPOJENOPREZIME = "";
     if (this.Transaction == null)
     {
         this.Transaction = (IDbTransaction)Thread.GetData(Thread.GetNamedDataSlot(DeklaritTransaction.TransactionSlotName));
     }
 }
示例#24
0
        /// <summary>
        /// Reads resource key and return relevant localized string value
        /// </summary>
        /// <param name="resourceSource">Type of the resource that contains the localized strings</param>
        /// <param name="culture">Culture name e.g. ar-SY</param>
        /// <param name="code">key name to look for</param>
        /// <param name="args"></param>
        /// <returns></returns>
        internal static LocalizedHtmlString GetValue(Type resourceSource, string culture, string code, params object[] args)
        {
            var _res = new System.Resources.ResourceManager(resourceSource);

            var cultureInfo = string.IsNullOrWhiteSpace(culture)
                                ? CultureInfo.CurrentCulture
                                : CultureInfo.GetCultureInfo(culture);

            bool   _resourceNotFound;
            string _value;

            try {
                _value            = _res.GetString(code, cultureInfo);
                _resourceNotFound = false;
            } catch (MissingSatelliteAssemblyException) {
                _resourceNotFound = true;
                _value            = code;
            } catch (MissingManifestResourceException) {
                _resourceNotFound = true;
                _value            = code;
            }

            return(args == null
                                ? new LocalizedHtmlString(code, _value, _resourceNotFound)
                                : new LocalizedHtmlString(code, _value, _resourceNotFound, args));
        }
示例#25
0
 public WrongPwd()
 {
     InitializeComponent();
     this.CenterToScreen();
     System.Reflection.Assembly assem = this.GetType().Assembly;
     ResourceManager            rm    = new System.Resources.ResourceManager("EncryptIt.Resources", assem);
 }
示例#26
0
 public void Initialize()
 {
     this.resourceManager             = Deklarit.Utils.ResourceManager.Instance;
     this.resourceManagerTables       = new System.Resources.ResourceManager("Tables", Assembly.GetExecutingAssembly());
     this.m__IDOLAKSICEIsNull         = false;
     this.m__NAZIVOLAKSICEIsNull      = false;
     this.m_NAZIVOLAKSICE             = "";
     this.m__IDGRUPEOLAKSICAIsNull    = false;
     this.m_IDGRUPEOLAKSICA           = 0;
     this.m__IDTIPOLAKSICEIsNull      = false;
     this.m_IDTIPOLAKSICE             = 0;
     this.m__VBDIOLAKSICAIsNull       = false;
     this.m_VBDIOLAKSICA              = "";
     this.m__PRIMATELJOLAKSICA1IsNull = false;
     this.m_PRIMATELJOLAKSICA1        = "";
     this.m__PRIMATELJOLAKSICA2IsNull = false;
     this.m_PRIMATELJOLAKSICA2        = "";
     this.m__PRIMATELJOLAKSICA3IsNull = false;
     this.m_PRIMATELJOLAKSICA3        = "";
     this.m__ZRNOLAKSICAIsNull        = false;
     this.m_ZRNOLAKSICA = "";
     this.AV9GXV126     = "";
     this.AV8GXV54      = 0;
     this.AV7GXV140     = 0;
     this.AV6GXV131     = "";
     this.AV5GXV133     = "";
     this.AV4GXV134     = "";
     this.AV3GXV135     = "";
     this.AV2GXV132     = "";
 }
        /// <summary>
        /// Creates a new <see cref="ResourceManagerWithCultureStringLocalizer"/>.
        /// </summary>
        /// <param name="resourceManager">The <see cref="System.Resources.ResourceManager"/> to read strings from.</param>
        /// <param name="resourceAssembly">The <see cref="Assembly"/> that contains the strings as embedded resources.</param>
        /// <param name="baseName">The base name of the embedded resource in the <see cref="Assembly"/> that contains the strings.</param>
        /// <param name="resourceNamesCache">Cache of the list of strings for a given resource assembly name.</param>
        /// <param name="culture">The specific <see cref="CultureInfo"/> to use.</param>
        public ResourceManagerWithCultureStringLocalizer(
            ResourceManager resourceManager,
            Assembly resourceAssembly,
            string baseName,
            IResourceNamesCache resourceNamesCache,
            CultureInfo culture)
            : base(resourceManager, resourceAssembly, baseName, resourceNamesCache)
        {
            if (resourceManager == null)
            {
                throw new ArgumentNullException(nameof(resourceManager));
            }

            if (resourceAssembly == null)
            {
                throw new ArgumentNullException(nameof(resourceAssembly));
            }

            if (baseName == null)
            {
                throw new ArgumentNullException(nameof(baseName));
            }

            if (resourceNamesCache == null)
            {
                throw new ArgumentNullException(nameof(resourceNamesCache));
            }

            if (culture == null)
            {
                throw new ArgumentNullException(nameof(culture));
            }

            _culture = culture;
        }
示例#28
0
 internal EventLogLogProvider(string shellId)
 {
     string str = this.SetupEventSource(shellId);
     this._eventLog = new EventLog();
     this._eventLog.Source = str;
     this._resourceManager = ResourceManagerCache.GetResourceManager(Assembly.GetExecutingAssembly(), "Logging");
 }
示例#29
0
        public Autodesk.Revit.UI.Result OnStartup(UIControlledApplication application)
        {
            try
            {
                //TAF load english_us TODO add a way to localize
                res = Resource_en_us.ResourceManager;
                // Create new ribbon panel
                RibbonPanel ribbonPanel = application.CreateRibbonPanel(res.GetString("App_Description")); //MDJ todo - move hard-coded strings out to resource files

                //Create a push button in the ribbon panel

                PushButton pushButton = ribbonPanel.AddItem(new PushButtonData("Dynamo",
                    res.GetString("App_Name"), m_AssemblyName, "Dynamo.Applications.DynamoRevit")) as PushButton;

                System.Drawing.Bitmap dynamoIcon = Dynamo.Applications.Properties.Resources.Nodes_32_32;

                BitmapSource bitmapSource = System.Windows.Interop.Imaging.CreateBitmapSourceFromHBitmap(
                         dynamoIcon.GetHbitmap(),
                         IntPtr.Zero,
                         System.Windows.Int32Rect.Empty,
                         System.Windows.Media.Imaging.BitmapSizeOptions.FromEmptyOptions());

                pushButton.LargeImage = bitmapSource;
                pushButton.Image = bitmapSource;

                // MDJ = element level events and dyanmic model update
                // MDJ 6-8-12  trying to get new dynamo to watch for user created ref points and re-run definition when they are moved

                IdlePromise.RegisterIdle(application);

                updater = new DynamoUpdater(application.ActiveAddInId, application.ControlledApplication);
                if (!UpdaterRegistry.IsUpdaterRegistered(updater.GetUpdaterId())) UpdaterRegistry.RegisterUpdater(updater);

                ElementClassFilter SpatialFieldFilter = new ElementClassFilter(typeof(SpatialFieldManager));
                ElementClassFilter familyFilter = new ElementClassFilter(typeof(FamilyInstance));
                ElementCategoryFilter refPointFilter = new ElementCategoryFilter(BuiltInCategory.OST_ReferencePoints);
                ElementClassFilter modelCurveFilter = new ElementClassFilter(typeof(CurveElement));
                ElementClassFilter sunFilter = new ElementClassFilter(typeof(SunAndShadowSettings));
                IList<ElementFilter> filterList = new List<ElementFilter>();

                filterList.Add(SpatialFieldFilter);
                filterList.Add(familyFilter);
                filterList.Add(modelCurveFilter);
                filterList.Add(refPointFilter);
                filterList.Add(sunFilter);

                ElementFilter filter = new LogicalOrFilter(filterList);

                UpdaterRegistry.AddTrigger(updater.GetUpdaterId(), filter, Element.GetChangeTypeAny());
                UpdaterRegistry.AddTrigger(updater.GetUpdaterId(), filter, Element.GetChangeTypeElementDeletion());
                UpdaterRegistry.AddTrigger(updater.GetUpdaterId(), filter, Element.GetChangeTypeElementAddition());

                return Result.Succeeded;
            }
            catch (Exception ex)
            {
                System.Windows.Forms.MessageBox.Show(ex.ToString());
                return Result.Failed;
            }
        }
        /// <summary>
        /// Create a new instance of the converter using translations from the given resource manager
        /// </summary>
        /// <param name="enumType"></param>
        public LocalizedEnumConverter(Type enumType)
            : base(enumType)
        {
            Assembly assembly = enumType.Assembly;
            string resourceBaseName = string.Format(CultureInfo.InvariantCulture, "{0}.Properties.Resources", assembly.GetName().Name);
            m_ResourceManager = assembly.GetManifestResourceNames().Any(o => o.StartsWith(resourceBaseName))
                ? new ResourceManager(resourceBaseName, enumType.Assembly)
                : null;

            m_LookupTable = new Dictionary<string, object>();
            ICollection standardValues = GetStandardValues();
            if (standardValues != null)
            {
                foreach (object value in standardValues)
                {
                    string text = GetLocalizedValueText(value, CultureInfo.CurrentCulture);
                    if (text != null)
                    {
                        m_LookupTable.Add(text, value);
                    }
                }
            }
            if (enumType.GetCustomAttributes(typeof(FlagsAttribute), true).Length <= 0)
            {
                return;
            }
            m_IsFlagEnum = true;
            m_FlagValues = Enum.GetValues(enumType);
        }
示例#31
0
        //***********************************************************
        //
        // Method:		Constructor
        // Purpose:		Initializes member variables.
        //
        //************************************************************/
        internal frmConnecting(frmAlfrescoSetUp oSetup)
        {
            m_oSetup = oSetup;

            oRM = new ResourceManager("frmWait", System.Reflection.Assembly.GetExecutingAssembly());
            InitializeComponent();
        }
示例#32
0
        // Culture
        public static string GetMensagem(System.Globalization.CultureInfo ciMensagem, string strMensagem)
        {
            string strRetorno = "";

            System.Resources.ResourceManager rmMensagens = null;
            switch (ciMensagem.Name)
            {
            case "en":
                rmMensagens = new System.Resources.ResourceManager("mdlMensagens.MensagensEn", System.Reflection.Assembly.GetExecutingAssembly());
                break;

            default:
                rmMensagens = new System.Resources.ResourceManager("mdlMensagens.Mensagens", System.Reflection.Assembly.GetExecutingAssembly());
                break;
            }
            strRetorno = rmMensagens.GetString(strMensagem, System.Globalization.CultureInfo.CurrentUICulture);
            if (strRetorno == null)
            {
                strRetorno = "";
            }
            if (strRetorno == "")
            {
                strRetorno = "INDEFINIDO: Idioma: " + ciMensagem.Name + " MENSAGEM: " + strMensagem;
            }
            return(strRetorno);
        }
示例#33
0
        private void BindTabs()
        {
            ResourceManager LocRM = new ResourceManager("Mediachase.Ibn.WebResources.App_GlobalResources.Admin.Resources.strDefault", Assembly.Load(new AssemblyName("Mediachase.Ibn.WebResources")));

            UserLightPropertyCollection pc;
            pc = Security.CurrentUser.Properties;

            if (Tab != null)
            {
                if (Tab == "PortalSetup" || Tab == "Dictionaries" || Tab == "RoutingWorkflow"
                    || Tab == "Customization" || Tab == "Reports" || Tab == "BusinessData"
                    || Tab == "CommonSettings" || Tab == "HelpDesk" || Tab == "FilesForms"
                    || Tab == "AddTools")
                    pc["Admin_CurrentTab"] = Tab;
            }
            else if (pc["Admin_CurrentTab"] == null)
                pc["Admin_CurrentTab"] = "PortalSetup";

            string controlName = "~/admin/modules/default.ascx";
            if (pc["Admin_CurrentTab"] == "Reports")
            {
                controlName = "~/admin/modules/AdminReports.ascx";
                ((Mediachase.UI.Web.Modules.PageTemplateNew)this.Parent.Parent.Parent.Parent).Title = LocRM.GetString("tReport");
            }

            System.Web.UI.UserControl control = (System.Web.UI.UserControl)LoadControl(controlName);
            phItems.Controls.Add(control);
        }
示例#34
0
		public LocaleHelper(ELanguage lang, ResourceManager locales, ResourceManager resources, CultureInfo culture) {
			Language = lang;

			mResLocale = locales;
			mRes = resources;
			mCulture = culture;
		}
示例#35
0
        /// <summary>Реализация метода OnConnection интерфейса IDTExtensibility2. Получение уведомления о загрузке надстройки.</summary>
        /// <param term='Application'>Корневой объект ведущего приложения.</param>
        /// <param term='ConnectMode'>Описание способа загрузки надстройки.</param>
        /// <param term='AddInInst'>Объект, представляющий данную надстройку.</param>
        /// <seealso class='IDTExtensibility2' />
        public void OnConnection(object Application, ext_ConnectMode ConnectMode, object AddInInst, ref Array custom)
        {
            applicationObject = (DTE2)Application;
            addInInstance     = (AddIn)AddInInst;
            if (ConnectMode == ext_ConnectMode.ext_cm_UISetup)
            {
                object[]  contextGUIDS = new object[] { };
                Commands2 commands     = (Commands2)applicationObject.Commands;

                try {
                    CommandBar        menuBarCommandBar;
                    CommandBarControl toolsControl;
                    CommandBarPopup   toolsPopup;
                    CommandBarControl commandBarControl;

                    //Добавление команды в коллекцию Commands:
                    Command command = commands.AddNamedCommand2(addInInstance, "PasteXmlAsLinq", "Paste XML as XElement", "Pastes the XML on the clipboard as C# Linq To Xml code", true, 59, ref contextGUIDS, (int)vsCommandStatus.vsCommandStatusSupported + (int)vsCommandStatus.vsCommandStatusEnabled, (int)vsCommandStyle.vsCommandStylePictAndText, vsCommandControlType.vsCommandControlTypeButton);

                    String editMenuName;

                    //Поиск панели команд верхнего уровня MenuBar, в которой содержатся все элементы главного меню:
                    menuBarCommandBar = ((CommandBars)applicationObject.CommandBars)["MenuBar"];

                    try {
                        //  С помощью этого кода можно получить региональный язык и региональные параметры, добавить имя элемента меню,
                        //  а затем добавить команду в меню. Список всех меню верхнего уровня можно найти в файле
                        //  CommandBar.resx.
                        System.Resources.ResourceManager resourceManager = new System.Resources.ResourceManager("PasteXmlAsLinq.CommandBar", System.Reflection.Assembly.GetExecutingAssembly());
                        System.Threading.Thread          thread          = System.Threading.Thread.CurrentThread;
                        System.Globalization.CultureInfo cultureInfo     = thread.CurrentUICulture;
                        editMenuName = resourceManager.GetString(String.Concat(cultureInfo.TwoLetterISOLanguageName, "Edit"));
                        toolsControl = menuBarCommandBar.Controls["Edit"];
                    }
                    catch (Exception) {
                        //  Мы пытаемся найти локализованную версию слова Edit, но безуспешно.
                        //  По умолчанию текст установлен в формат en-US, для используемого языка и региональных параметров этот вариант может оказаться приемлемым.
                        toolsControl = menuBarCommandBar.Controls["Edit"];
                    }

                    //Размещение команды в меню редактирования.
                    toolsPopup = (CommandBarPopup)toolsControl;
                    int pasteControlIndex = 1;

                    //Поиск элемента управления вставкой для добавления после него нового элемента.
                    foreach (CommandBarControl commandBar in toolsPopup.CommandBar.Controls)
                    {
                        if (String.Compare(commandBar.Caption, "&Paste", StringComparison.OrdinalIgnoreCase) == 0)
                        {
                            pasteControlIndex = commandBar.Index + 1;
                            break;
                        }
                    }

                    //Поиск подходящей панели команд на панели MenuBar:
                    commandBarControl = (CommandBarControl)command.AddControl(toolsPopup.CommandBar, pasteControlIndex);
                }
                catch (Exception) {
                }
            }
        }
示例#36
0
        public Main()
        {
            _locale = new ResourceManager("VectorDrawing_WinForm_.Resources.Locale", typeof(Main).Assembly);

            InitializeComponent();

            _data = new XData
            {
                Color = Color.Black,
                LineWidth = 1,
                Type = "Rectangle"
            };

            tsmi_language.Items.AddRange(new object[] { "English", "Русский", "Українська" });
            tsmi_language.SelectedIndex = 0;

            tsmi_theme.Items.AddRange(new object[] { "Gray", "Blue", "Dark" });
            tsmi_theme.SelectedIndex = 0;

            ttcmbx_color.Items.AddRange(new object[] { "Black", "Green", "Red" });
            ttcmbx_width.Items.AddRange(new object[] { "1", "2", "3", "4", "5", "6", "7", "8", "9", "10" });
            ttcmd_type.Items.AddRange(new object[] { "Rectangle", "Ellipse", "Line" });

            ttcmbx_tabs.Items.AddRange(new object[] {"1", "2"});

            cmbx_color.DataSource = new List<string> { "Black", "Green", "Red" };
            cmbx_type.DataSource = new List<string> { "Rectangle", "Ellipse", "Line" };

            cmbx_color.SelectedIndexChanged += cmbx_SelectedIndexChanged;
            cmbx_type.SelectedIndexChanged += cmbx_SelectedIndexChanged;

            SetValue();
        }
示例#37
0
 private static ResourceManager GetResourceManager(string resourceBaseName, Assembly assembly)
 {
     // check the cache
     if (_resManager == null)
         _resManager = new ResourceManager(resourceBaseName, assembly);
     return _resManager;
 }
示例#38
0
		static MessageBoxExManager()
		{
			try
			{
				//Assembly current = typeof(MessageBoxExManager).Assembly;
				//string[] resources = current.GetManifestResourceNames();
				ResourceManager rm = new ResourceManager("Utils.MessageBoxExLib.Resources.StandardButtonsText", typeof(MessageBoxExManager).Assembly);
				s_standardButtonsText[MessageBoxExButtons.OK.ToString()] = rm.GetString("Ok");
				s_standardButtonsText[MessageBoxExButtons.Cancel.ToString()] = rm.GetString("Cancel");
				s_standardButtonsText[MessageBoxExButtons.Yes.ToString()] = rm.GetString("Yes");
				s_standardButtonsText[MessageBoxExButtons.No.ToString()] = rm.GetString("No");
				s_standardButtonsText[MessageBoxExButtons.Abort.ToString()] = rm.GetString("Abort");
				s_standardButtonsText[MessageBoxExButtons.Retry.ToString()] = rm.GetString("Retry");
				s_standardButtonsText[MessageBoxExButtons.Ignore.ToString()] = rm.GetString("Ignore");
			}
			catch(Exception ex)
			{
				System.Diagnostics.Debug.Assert(false, "Unable to load resources for MessageBoxEx", ex.ToString());

				//Load default resources
				s_standardButtonsText[MessageBoxExButtons.OK.ToString()] = "OK";
				s_standardButtonsText[MessageBoxExButtons.Cancel.ToString()] = "Cancel";
				s_standardButtonsText[MessageBoxExButtons.Yes.ToString()] = "Yes";
				s_standardButtonsText[MessageBoxExButtons.No.ToString()] = "No";
				s_standardButtonsText[MessageBoxExButtons.Abort.ToString()] = "Abort";
				s_standardButtonsText[MessageBoxExButtons.Retry.ToString()] = "Retry";
				s_standardButtonsText[MessageBoxExButtons.Ignore.ToString()] = "Ignore";
			}
		}
        public OSMGPMultiLoader()
        {
            osmGPFactory = new OSMGPFactory();
            resourceManager = new ResourceManager("ESRI.ArcGIS.OSM.GeoProcessing.OSMGPToolsStrings", this.GetType().Assembly);

            m_editorConfigurationSettings = OSMGPFactory.ReadOSMEditorSettings();
        }
        /// <summary>
        /// Intended for testing purposes only.
        /// </summary>
        public ResourceManagerStringLocalizer(
            ResourceManager resourceManager,
            AssemblyWrapper resourceAssemblyWrapper,
            string baseName,
            IResourceNamesCache resourceNamesCache)
        {
            if (resourceManager == null)
            {
                throw new ArgumentNullException(nameof(resourceManager));
            }

            if (resourceAssemblyWrapper == null)
            {
                throw new ArgumentNullException(nameof(resourceAssemblyWrapper));
            }

            if (baseName == null)
            {
                throw new ArgumentNullException(nameof(baseName));
            }

            if (resourceNamesCache == null)
            {
                throw new ArgumentNullException(nameof(resourceNamesCache));
            }

            _resourceAssemblyWrapper = resourceAssemblyWrapper;
            _resourceManager = resourceManager;
            _resourceBaseName = baseName;
            _resourceNamesCache = resourceNamesCache;
        }
 public StateFullClassValidatorFactory(IConstraintValidatorFactory constraintValidatorFactory,
     ResourceManager resourceManager, CultureInfo culture,
     IMessageInterpolator userInterpolator, ValidatorMode validatorMode,
     IEntityTypeInspector entityTypeInspector)
     : base(constraintValidatorFactory, resourceManager, culture, userInterpolator, validatorMode, entityTypeInspector)
 {
 }
示例#42
0
        private void Initialize()
        {
            dto = new DTO();


            ks = dto.mkSet(dto.KartenAuslesen());

            PictureBox[] bildArray = new PictureBox[ks.Count];

            var ResourceManager =
                new System.Resources.ResourceManager(
                    "YourAssembly.Properties.Resources",
                    typeof(Resources).Assembly);
            int i = 0;

            while (i < ks.Count)
            {
                object obj = ResourceManager.GetObject(ks.ElementAt(i).bild);

                bildArray[i].Image = ((System.Drawing.Bitmap)(obj));



                i++;
            }
        }
示例#43
0
        internal ImageSource LoadIconInternal(string iconKey)
        {
            if (cachedIcons.ContainsKey(iconKey))
                return cachedIcons[iconKey];

            if (resourceAssembly == null)
            {
                cachedIcons.Add(iconKey, null);
                return null;
            }

            ResourceManager rm = new ResourceManager(assemblyName + imagesSuffix, resourceAssembly);

            ImageSource bitmapSource = null;

            var source = (Bitmap)rm.GetObject(iconKey);
            if (source == null)
            {
                cachedIcons.Add(iconKey, null);
                return null;
            }

            bitmapSource = ResourceUtilities.ConvertToImageSource(source);

            cachedIcons.Add(iconKey, bitmapSource);
            return bitmapSource;
        }
示例#44
0
        /// <summary>
        /// Initializes the localization of the plugin
        /// </summary>
        public static void Initialize(LocaleVersion locale)
        {
            String path = "LibraryDepot.Resources." + locale.ToString();
            resources = new ResourceManager(path, Assembly.GetExecutingAssembly());

            //String __path = "ProjectManager.Resources." + locale.ToString();
        }
示例#45
0
        public static string ToLocalizedString(this Question question)
        {
            Requires.NotNull(question, "question");

            var resourceManager = new ResourceManager(typeof(Questions));
            return resourceManager.GetString(question.Key.ToString());
        }
        /// <summary>
        /// Creates a localizable resource string that may possibly be formatted differently depending on culture.
        /// </summary>
        /// <param name="nameOfLocalizableResource">nameof the resource that needs to be localized.</param>
        /// <param name="resourceManager"><see cref="ResourceManager"/> for the calling assembly.</param>
        /// <param name="resourceSource">Type handling assembly's resource management. Typically, this is the static class generated for the resources file from which resources are accessed.</param>
        /// <param name="formatArguments">Optional arguments for formatting the localizable resource string.</param>
        public LocalizableResourceString(string nameOfLocalizableResource, ResourceManager resourceManager, Type resourceSource, params string[] formatArguments)
        {
            if (nameOfLocalizableResource == null)
            {
                throw new ArgumentNullException(nameof(nameOfLocalizableResource));
            }

            if (resourceManager == null)
            {
                throw new ArgumentNullException(nameof(resourceManager));
            }

            if (resourceSource == null)
            {
                throw new ArgumentNullException(nameof(resourceSource));
            }

            if (formatArguments == null)
            {
                throw new ArgumentNullException(nameof(formatArguments));
            }

            _resourceManager = resourceManager;
            _nameOfLocalizableResource = nameOfLocalizableResource;
            _resourceSource = resourceSource;
            _formatArguments = formatArguments;
        }
 static ResourceManagerSingleton()
 {
     try
     {
         try
         {
             ResourceManager = new ResourceManager("Brettle.Web.NeatUpload.Strings",
                                                   System.Reflection.Assembly.GetExecutingAssembly());
             // Force an exception if the resources aren't there because...
             ResourceManager.GetString("UploadTooLargeMessageFormat");
         }
         catch (MissingManifestResourceException)
         {
             // ...the namespace qualifier was not used until VS2005, and the assembly might have been built
             // with VS2003.
             ResourceManager = new ResourceManager("NeatUpload.Strings",
                                                   System.Reflection.Assembly.GetExecutingAssembly());
             ResourceManager.GetString("UploadTooLargeMessageFormat");
         }
     }
     catch (System.Security.SecurityException)
     {
         // This happens when running with medium trust outside the GAC under .NET 2.0, because
         // NeatUpload is compiled against .NET 1.1.  In that environment we almost never need the
         // ResourceManager so we set it to null which will cause GetResourceString() to return a
         // message indicating what the developer needs to do.
         ResourceManager = null;
     }
 }
示例#48
0
 public static void EnumPopulate(ComboBox comboBox, Type enumType, ResourceManager resourceManager)
 {
     foreach (var item in EnumUtilities.EnumDisplayValues(enumType, resourceManager))
     {
         comboBox.Items.Add(item);
     }
 }
        internal SR() {
#if FX_ATLEAST_45
            resources = new System.Resources.ResourceManager("FSharp.LanguageService.Base.Microsoft.VisualStudio.Package.LanguageService", this.GetType().Assembly);
#else
            resources = new System.Resources.ResourceManager("Microsoft.VisualStudio.Package.LanguageService", this.GetType().Assembly);
#endif
        }
        public OSMConflictEditor()
        {

            resourceManager = new ResourceManager("ESRI.ArcGIS.OSM.Editor.OSMFeatureInspectorStrings", this.GetType().Assembly);


            base.m_category = "OSMEditor"; //localizable text
            base.m_caption = "OSM Conflict Editor";  //localizable text
            base.m_message = "Open the OpenStreetMap Conflict Editor";  //localizable text 
            base.m_toolTip = "Open the OpenStreetMap Conflict Editor";  //localizable text 
            base.m_name = "OSMEditor_ConflictEditor";   //unique id, non-localizable (e.g. "MyCategory_ArcMapCommand")

            try
            {
                string bitmapResourceName = GetType().Name + ".bmp";
            }
            catch (Exception ex)
            {
                System.Diagnostics.Trace.WriteLine(ex.Message, "Invalid Bitmap");
            }

            try
            {
                m_osmConflictEditorUI = new OSMConflictEditorUI();
            }
            catch
            {
            }
        }
示例#51
0
        public Resource(ResourceManager resourceManager, Enum stringResource)
        {
            ResourceManager = resourceManager;
            StringResource = stringResource;

            LastModified = DateTime.UtcNow;
        }
        public SwatchesProvider()
        {
            var assembly = Assembly.GetExecutingAssembly();
            var resourcesName = assembly.GetName().Name + ".g";
            var manager = new ResourceManager(resourcesName, assembly);
            var resourceSet = manager.GetResourceSet(CultureInfo.CurrentUICulture, true, true);
            var dictionaryEntries = resourceSet.OfType<DictionaryEntry>().ToList();
            var assemblyName = assembly.GetName().Name;

            var regex = new Regex(@"^themes\/materialdesigncolor\.(?<name>[a-z]+)\.(?<type>primary|accent)\.baml$");

            Swatches =
                dictionaryEntries
                .Select(x => new { key = x.Key.ToString(), match = regex.Match(x.Key.ToString()) })
                .Where(x => x.match.Success && x.match.Groups["name"].Value != "black")
                .GroupBy(x => x.match.Groups["name"].Value)
                .Select(x =>
                CreateSwatch
                (
                    x.Key,
                    Read(assemblyName, x.SingleOrDefault(y => y.match.Groups["type"].Value == "primary")?.key),
                    Read(assemblyName, x.SingleOrDefault(y => y.match.Groups["type"].Value == "accent")?.key)
                ))
                .ToList();

        }
        public OSMEditorToolbar()
        {
            resourceManager = new ResourceManager("ESRI.ArcGIS.OSM.Editor.OSMFeatureInspectorStrings", this.GetType().Assembly);

            AddItem("{93e976c7-b3a2-4b0f-a575-6626358614e3}");
            //BeginGroup(); //Separator
        }
示例#54
0
 public ResourceContentManager(IServiceProvider servicesProvider, ResourceManager resource)
   : base(servicesProvider)
 {
   if (resource == null)
     throw new ArgumentNullException("resource");
   this.resource = resource;
 }
        internal NpgsqlTransaction(NpgsqlConnection conn, IsolationLevel isolation)
        {
            resman = new System.Resources.ResourceManager(this.GetType());

            NpgsqlEventLog.LogMethodEnter(LogLevel.Debug, CLASSNAME, CLASSNAME);
            if ((isolation != IsolationLevel.ReadCommitted) &&
                    (isolation != IsolationLevel.Serializable))
                throw new ArgumentOutOfRangeException(resman.GetString("Exception_UnsopportedIsolationLevel"), "isolation");

            _conn = conn;
            _isolation = isolation;

            StringBuilder commandText = new StringBuilder("SET TRANSACTION ISOLATION LEVEL ");

            if (isolation == IsolationLevel.ReadCommitted)
                commandText.Append("READ COMMITTED");
            else
                commandText.Append("SERIALIZABLE");

            commandText.Append("; BEGIN");

            NpgsqlCommand command = new NpgsqlCommand(commandText.ToString(), conn.Connector);
            command.ExecuteNonQuery();
            _conn.Connector.Transaction = this;
        }
示例#56
0
        protected void LoadSchema(int version)
        {
            if (version < 1) return;

              MySQLMembershipProvider provider = new MySQLMembershipProvider();

              ResourceManager r = new ResourceManager("MySql.Web.Properties.Resources", typeof(MySQLMembershipProvider).Assembly);
              string schema = r.GetString(String.Format("schema{0}", version));
              MySqlScript script = new MySqlScript(conn);
              script.Query = schema;

              try
              {
            script.Execute();
              }
              catch (MySqlException ex)
              {
            if (ex.Number == 1050 && version == 7)
            {
              // Schema7 performs several renames of tables to their lowercase representation.
              // If the current server OS does not support renaming to lowercase, then let's just continue.
              script.Query = "UPDATE my_aspnet_schemaversion SET version=7";
              script.Execute();
            }
              }
        }
        private void AddResourceManager(String resourceTypeName)
        {
            System.Resources.ResourceManager rm;
            Type ty = Type.GetType(resourceTypeName);

            rm = new System.Resources.ResourceManager(ty);
            mResMangaers.Add(resourceTypeName, rm);
        }
示例#58
0
        public static Bitmap GetImageByName(string imageName)
        {
            System.Reflection.Assembly asm = System.Reflection.Assembly.GetExecutingAssembly();
            string resourceName            = asm.GetName().Name + ".Properties.Resources";
            var    rm = new System.Resources.ResourceManager(resourceName, asm);

            return((Bitmap)rm.GetObject(imageName));
        }
示例#59
0
 public static byte[] GetByteArrayResource(Assembly assembly,
                                           string baseName,
                                           string resourceName)
 {
     System.Resources.ResourceManager rm =
         new System.Resources.ResourceManager(baseName, assembly);
     return((System.Byte[])rm.GetObject(resourceName));
 }
示例#60
0
 public static string GetStringResource(Assembly assembly,
                                        string baseName,
                                        string resourceName)
 {
     System.Resources.ResourceManager rm =
         new System.Resources.ResourceManager(baseName, assembly);
     return((String)rm.GetObject(resourceName));
 }