Exemple #1
0
        public SerializeableSortableBindingList(string filePathName, int writeDelayMs)
        {
            try
            {
                this.FilePathName  = AssemblyPath + "\\" + filePathName;
                this.LastSerialize = DateTime.MinValue;

                this._List        = new SortableBindingList <T>();
                this.WriteDelayMs = writeDelayMs;

                if (!File.Exists(this.FilePathName))
                {
                    _List = new SortableBindingList <T>();

                    _List.XmlSerialize(this.FilePathName);
                    _List.XmlDeserialize(this.FilePathName);
                }
                else
                {
                    this._List = _List.XmlDeserialize(this.FilePathName);
                }

                if (_List != null)
                {
                    this._List.ListChanged += OnListChangeHandler;
                }
            }
            catch (Exception ex)
            {
                Console.WriteLine("[SerializeableSortableBindingList] Exception [" + ex + "]");
            }
        }
Exemple #2
0
        public SerializeableSortableBindingList(string filePathName, int writeDelayMs)
        {
            this.FilePathName  = AssemblyPath + "\\" + filePathName;
            this.LastSerialize = DateTime.MinValue;
            this.FileName      = Path.GetFileName(this.FilePathName);

            this._List        = new SortableBindingList <T>();
            this.WriteDelayMs = writeDelayMs;

            if (!File.Exists(this.FilePathName))
            {
                _List = new SortableBindingList <T>();

                _List.XmlSerialize(this.FilePathName);
                _List.XmlDeserialize(this.FilePathName);
            }
            else
            {
                this._List = _List.XmlDeserialize(this.FilePathName);
            }
            this._List.ListChanged += OnListChangeHandler;
        }