Exemplo n.º 1
0
        //public Control Invoker { get; set; } = null;



        /// <summary>
        /// if path is null, data is saved as @"Asmodat\IO\FormsControls\" + base.Name + ".cds"
        /// </summary>
        /// <param name="AutoSave"></param>
        /// <param name="path"></param>
        public void InitializeDatabase(bool AutoSave, string ID, string path)//, Control invoker)
        {
            //if (invoker != null) this.Invoker = invoker;

            if (path == null)
            {
                path = Files.GetFullPath(string.Format("{0}\\{1}{2}.{3}", BaseDirectory, base.Name, ID, "cds"));
            }
            else
            {
                if (!path.Contains(":"))
                {
                    path = BaseDirectory + "\\" + path;
                }

                path = Files.GetFullPath(path);
            }

            Database = new DatabseSimpleton(path, false);

            if (Database.Count <= 0)
            {
                this.Save();
            }
            else
            {
                this.Load();
            }

            this.AutoSave = AutoSave;
        }