예제 #1
0
        /// <summary>
        /// 切换语言。
        /// </summary>
        /// <param name="type">语言类型。</param>
        public void Switch(LanguageType type)
        {
            if (type == Type)
            {
                return;
            }
            Stream stream = null;

            try
            {
                if (IsEmpty)
                {
                    return;
                }
                stream = _xmlStreamCreator(type);
                if (stream == null)
                {
                    return;
                }
                XmlDocument doc = new XmlDocument();
                doc.Load(stream);
                _doc = doc;
            }
            catch (XmlException)
            {
                _doc = new XmlDocument();
            }
            finally
            {
                stream?.Close();
                Type = type;
                Switched?.Invoke(this, EventArgs.Empty);
            }
        }
예제 #2
0
        protected virtual void Clicked(object sender, EventArgs e)
        {
            var sw    = sender as Switch;
            var index = (int)sw.Tag;

            Status[index] = sw.Checked;
            Switched?.Invoke(this, e);
        }