Exemplo n.º 1
0
        private void btnAdd_Click(object sender, EventArgs e)
        {
            // ----- Objects -----
            if (objectForm)
            {
                frmAddObject form = new frmAddObject();
                Guid         ID   = Guid.Empty;
                form.ShowDialog(ref ID);
                if (ID != Guid.Empty)
                {
                    databaseEntities db = new databaseEntities();       // Database
                    var obj             = db.Objects.Find(ID);
                    if (obj != null)
                    {
                        ObjectList.Add(obj);
                    }
                    FileText = global.GetTextFromObjects(ObjectList);

                    UpdateOLVObject();
                }
            }
            // ----- Files -----
            else
            {
                string      text = "";
                frmEditFile form = new frmEditFile();
                form.ShowDialog(ref text, RelativePath);
                if (text != "")
                {
                    if (FileText != "")
                    {
                        FileText += ";";
                    }
                    FileText += text;
                    FileList  = global.GetFInfoList(FileText);

                    UpdateOLV();
                }
            }
        }
Exemplo n.º 2
0
        private void btnEdit_Click(object sender, EventArgs e)
        {
            if (olvFiles.SelectedObject != null)
            {
                // ----- Objects -----
                if (objectForm)
                {
                    frmAddObject form   = new frmAddObject();
                    Guid         ID     = ((Objects)olvFiles.SelectedObject).ID;
                    string       OrigID = ID.ToString();
                    form.ShowDialog(ref ID);
                    if (ID != Guid.Empty)
                    {
                        FileText   = FileText.Replace(OrigID, ID.ToString());
                        FileText   = FileText.Replace(";;", ";");
                        ObjectList = global.GetObjectsFromText(FileText);

                        UpdateOLVObject();
                    }
                }
                // ----- Files -----
                else
                {
                    FInfo       info     = (FInfo)olvFiles.SelectedObject;
                    string      text     = global.FInfoToText(info);
                    string      textOgig = text;
                    frmEditFile form     = new frmEditFile();
                    if (form.ShowDialog(ref text, RelativePath) == DialogResult.OK)
                    {
                        FileText = FileText.Replace(textOgig, text);
                        FileText = FileText.Replace(";;", ";");
                        FileList = global.GetFInfoList(FileText);

                        UpdateOLV();
                    }
                }
            }
        }