Пример #1
0
        void ResetListBox()
        {
            ReadData();

            var AllLayers = CADUtil.GetAllLayerNames();

            var L1  = Properties.Settings.Default.layers01.Cast <object>().Where(a => AllLayers.Contains(a.ToString()));
            var L2  = Properties.Settings.Default.layers02.Cast <object>().Where(a => AllLayers.Contains(a.ToString()));
            var L3  = Properties.Settings.Default.layers03.Cast <object>().Where(a => AllLayers.Contains(a.ToString()));
            var L4  = Properties.Settings.Default.layers04.Cast <object>().Where(a => AllLayers.Contains(a.ToString()));
            var L5  = Properties.Settings.Default.layers05.Cast <object>().Where(a => AllLayers.Contains(a.ToString()));
            var L6  = Properties.Settings.Default.layers05.Cast <object>().Where(a => AllLayers.Contains(a.ToString()));
            var L7  = Properties.Settings.Default.layers05.Cast <object>().Where(a => AllLayers.Contains(a.ToString()));
            var L8  = Properties.Settings.Default.layers05.Cast <object>().Where(a => AllLayers.Contains(a.ToString()));
            var L9  = Properties.Settings.Default.layers05.Cast <object>().Where(a => AllLayers.Contains(a.ToString()));
            var L10 = Properties.Settings.Default.layers05.Cast <object>().Where(a => AllLayers.Contains(a.ToString()));

            var L = (from a in AllLayers
                     where !L1.Contains(a)
                     where !L2.Contains(a)
                     where !L3.Contains(a)
                     where !L4.Contains(a)
                     where !L5.Contains(a)
                     where !L6.Contains(a)
                     where !L7.Contains(a)
                     where !L8.Contains(a)
                     where !L9.Contains(a)
                     where !L10.Contains(a)
                     let b = a as object
                             orderby b
                             select b);

            lst_L.Items.Clear();
            lst_L1.Items.Clear();
            lst_L2.Items.Clear();
            lst_L3.Items.Clear();
            lst_L4.Items.Clear();
            lst_L5.Items.Clear();
            lst_L6.Items.Clear();
            lst_L7.Items.Clear();
            lst_L8.Items.Clear();
            lst_L9.Items.Clear();
            lst_L10.Items.Clear();

            lst_L.Items.AddRange(L.ToArray());
            lst_L1.Items.AddRange(L1.ToArray());
            lst_L2.Items.AddRange(L2.ToArray());
            lst_L3.Items.AddRange(L3.ToArray());
            lst_L4.Items.AddRange(L4.ToArray());
            lst_L5.Items.AddRange(L5.ToArray());
            lst_L6.Items.AddRange(L6.ToArray());
            lst_L7.Items.AddRange(L7.ToArray());
            lst_L8.Items.AddRange(L8.ToArray());
            lst_L9.Items.AddRange(L9.ToArray());
            lst_L10.Items.AddRange(L10.ToArray());
        }
Пример #2
0
        // 초기화
        void Initialization()
        {
            #region 초기화
            ISOLayers = new List <string>();

            lst_L1.Items.Clear();
            lst_L2.Items.Clear();
            lst_L3.Items.Clear();
            lst_L4.Items.Clear();
            lst_L5.Items.Clear();
            lst_L6.Items.Clear();
            lst_L7.Items.Clear();
            lst_L8.Items.Clear();
            lst_L9.Items.Clear();
            lst_L10.Items.Clear();

            if (Properties.Settings.Default.layers01 == null || Properties.Settings.Default.layers02 == null ||
                Properties.Settings.Default.layers03 == null || Properties.Settings.Default.layers04 == null ||
                Properties.Settings.Default.layers05 == null || Properties.Settings.Default.layers06 == null ||
                Properties.Settings.Default.layers07 == null || Properties.Settings.Default.layers08 == null ||
                Properties.Settings.Default.layers09 == null || Properties.Settings.Default.layers10 == null)
            {
                Properties.Settings.Default.layers01 = new StringCollection();
                Properties.Settings.Default.layers02 = new StringCollection();
                Properties.Settings.Default.layers03 = new StringCollection();
                Properties.Settings.Default.layers04 = new StringCollection();
                Properties.Settings.Default.layers05 = new StringCollection();
                Properties.Settings.Default.layers06 = new StringCollection();
                Properties.Settings.Default.layers07 = new StringCollection();
                Properties.Settings.Default.layers08 = new StringCollection();
                Properties.Settings.Default.layers09 = new StringCollection();
                Properties.Settings.Default.layers10 = new StringCollection();
            }
            if (Properties.Settings.Default.saveNames == null || Properties.Settings.Default.saveData1 == null ||
                Properties.Settings.Default.saveData2 == null || Properties.Settings.Default.saveData3 == null ||
                Properties.Settings.Default.saveData4 == null || Properties.Settings.Default.saveData5 == null ||
                Properties.Settings.Default.saveData6 == null || Properties.Settings.Default.saveData7 == null ||
                Properties.Settings.Default.saveData8 == null || Properties.Settings.Default.saveData9 == null ||
                Properties.Settings.Default.saveData10 == null)
            {
                Properties.Settings.Default.saveNames = new StringCollection();
                Properties.Settings.Default.saveNames.Add("Default");
                Properties.Settings.Default.saveData1  = new StringCollection();
                Properties.Settings.Default.saveData2  = new StringCollection();
                Properties.Settings.Default.saveData3  = new StringCollection();
                Properties.Settings.Default.saveData4  = new StringCollection();
                Properties.Settings.Default.saveData5  = new StringCollection();
                Properties.Settings.Default.saveData6  = new StringCollection();
                Properties.Settings.Default.saveData7  = new StringCollection();
                Properties.Settings.Default.saveData8  = new StringCollection();
                Properties.Settings.Default.saveData9  = new StringCollection();
                Properties.Settings.Default.saveData10 = new StringCollection();
            }
            #endregion

            #region 콩보상자
            cbo_SaveName.Properties.Items.Clear();
            cbo_SaveName.Properties.Items.AddRange(Properties.Settings.Default.saveNames);
            cbo_SaveName.Properties.Sorted = true;
            cbo_SaveName.Text = "Default";
            #endregion

            #region 리스트 상자
            var AllLayers = CADUtil.GetAllLayerNames();

            var L1  = Properties.Settings.Default.layers01.Cast <object>();
            var L2  = Properties.Settings.Default.layers02.Cast <object>();
            var L3  = Properties.Settings.Default.layers03.Cast <object>();
            var L4  = Properties.Settings.Default.layers04.Cast <object>();
            var L5  = Properties.Settings.Default.layers05.Cast <object>();
            var L6  = Properties.Settings.Default.layers06.Cast <object>();
            var L7  = Properties.Settings.Default.layers07.Cast <object>();
            var L8  = Properties.Settings.Default.layers08.Cast <object>();
            var L9  = Properties.Settings.Default.layers09.Cast <object>();
            var L10 = Properties.Settings.Default.layers10.Cast <object>();

            var L = (from a in AllLayers
                     where !L1.Contains(a)
                     where !L2.Contains(a)
                     where !L3.Contains(a)
                     where !L4.Contains(a)
                     where !L5.Contains(a)
                     where !L6.Contains(a)
                     where !L7.Contains(a)
                     where !L8.Contains(a)
                     where !L9.Contains(a)
                     where !L10.Contains(a)
                     let b = a as object
                             select b).ToArray();

            lst_L.Items.AddRange(L.Where(a => !lst_L.Items.Contains(a)).ToArray());

            lst_L1.Items.AddRange(L1.Where(a => AllLayers.Contains(a) && !L.Contains(a)).Distinct().ToArray());
            lst_L2.Items.AddRange(L2.Where(a => AllLayers.Contains(a) && !L.Contains(a)).Distinct().ToArray());
            lst_L3.Items.AddRange(L3.Where(a => AllLayers.Contains(a) && !L.Contains(a)).Distinct().ToArray());
            lst_L4.Items.AddRange(L4.Where(a => AllLayers.Contains(a) && !L.Contains(a)).Distinct().ToArray());
            lst_L5.Items.AddRange(L5.Where(a => AllLayers.Contains(a) && !L.Contains(a)).Distinct().ToArray());
            lst_L6.Items.AddRange(L6.Where(a => AllLayers.Contains(a) && !L.Contains(a)).Distinct().ToArray());
            lst_L7.Items.AddRange(L7.Where(a => AllLayers.Contains(a) && !L.Contains(a)).Distinct().ToArray());
            lst_L8.Items.AddRange(L8.Where(a => AllLayers.Contains(a) && !L.Contains(a)).Distinct().ToArray());
            lst_L9.Items.AddRange(L9.Where(a => AllLayers.Contains(a) && !L.Contains(a)).Distinct().ToArray());
            lst_L10.Items.AddRange(L10.Where(a => AllLayers.Contains(a) && !L.Contains(a)).Distinct().ToArray());

            #endregion
        }