コード例 #1
0
ファイル: MainForm.cs プロジェクト: wangscript007/eibsuite
        private void LoadKnownGroupsToCache()
        {
            KnownGroupsList res = LoadKnownGroupsFile();

            lock (_sync)
            {
                _cache = res;
            }
        }
コード例 #2
0
ファイル: KnownGroupsForm.cs プロジェクト: wlcaption/eibsuite
 private void btnApply_Click(object sender, EventArgs e)
 {
     this.Groups = new KnownGroupsList();
     foreach (var item in lvGroups.Items)
     {
         GLItem i = (GLItem)item;
         KnownGroup kg = (KnownGroup)i.Tag;
         this.Groups.List.Add(kg);
     }
 }
コード例 #3
0
 private void btnApply_Click(object sender, EventArgs e)
 {
     this.Groups = new KnownGroupsList();
     foreach (var item in lvGroups.Items)
     {
         GLItem     i  = (GLItem)item;
         KnownGroup kg = (KnownGroup)i.Tag;
         this.Groups.List.Add(kg);
     }
 }
コード例 #4
0
ファイル: MainForm.cs プロジェクト: wangscript007/eibsuite
        private void SaveKnownGroupsToFile(KnownGroupsList list)
        {
            XmlWriterSettings settings = new XmlWriterSettings();

            settings.Indent = true;
            FileStream    fs     = new FileStream(KNOWN_GROUP_FILE, FileMode.OpenOrCreate);
            XmlWriter     writer = XmlWriter.Create(fs, settings);
            XmlSerializer ser    = new XmlSerializer(typeof(KnownGroupsList));

            ser.Serialize(writer, _cache);
            writer.Flush();
            fs.Close();
        }
コード例 #5
0
ファイル: MainForm.cs プロジェクト: wangscript007/eibsuite
        private void btnEditKnownGroups_Click(object sender, EventArgs e)
        {
            KnownGroupsList res = LoadKnownGroupsFile();
            KnownGroupsForm f   = new KnownGroupsForm();

            f.Groups = res;
            DialogResult dr = f.ShowDialog();

            if (dr == System.Windows.Forms.DialogResult.OK)
            {
                res = f.Groups;
                lock (_sync)
                {
                    _cache = res;
                }
                SaveKnownGroupsToFile(f.Groups);
            }
        }
コード例 #6
0
ファイル: MainForm.cs プロジェクト: wangscript007/eibsuite
        private KnownGroupsList LoadKnownGroupsFile()
        {
            FileStream    fs     = null;
            XmlTextReader reader = null;

            try
            {
                fs     = new FileStream(KNOWN_GROUP_FILE, FileMode.Open);
                reader = new XmlTextReader(fs);
                XmlSerializer   ser = new XmlSerializer(typeof(KnownGroupsList));
                KnownGroupsList res = (KnownGroupsList)ser.Deserialize(reader);
                reader.Close();
                return(res);
            }
            catch
            {
                return(null);
            }
        }
コード例 #7
0
ファイル: MainForm.cs プロジェクト: wlcaption/eibsuite
 private void SaveKnownGroupsToFile(KnownGroupsList list)
 {
     XmlWriterSettings settings = new XmlWriterSettings();
     settings.Indent = true;
     FileStream fs = new FileStream(KNOWN_GROUP_FILE, FileMode.OpenOrCreate);
     XmlWriter writer = XmlWriter.Create(fs, settings);
     XmlSerializer ser = new XmlSerializer(typeof(KnownGroupsList));
     ser.Serialize(writer, _cache);
     writer.Flush();
     fs.Close();
 }
コード例 #8
0
ファイル: MainForm.cs プロジェクト: wlcaption/eibsuite
 private void LoadKnownGroupsToCache()
 {
     KnownGroupsList res = LoadKnownGroupsFile();
     lock (_sync)
     {
         _cache = res;
     }
 }
コード例 #9
0
ファイル: MainForm.cs プロジェクト: wlcaption/eibsuite
        private void btnEditKnownGroups_Click(object sender, EventArgs e)
        {
            KnownGroupsList res = LoadKnownGroupsFile();
            KnownGroupsForm f = new KnownGroupsForm();
            f.Groups = res;
            DialogResult dr = f.ShowDialog();

            if (dr == System.Windows.Forms.DialogResult.OK)
            {
                res = f.Groups;
                lock (_sync)
                {
                    _cache = res;
                }
                SaveKnownGroupsToFile(f.Groups);
            }
        }