public void ReadAspectFile(string path, ParserWrapper _parserWrapper)
 {
     ClearAspect();
     if (File.Exists(path))
     {
         manager.WorkingAspect = manager.DeserializeAspect(path, _parserWrapper);
         manager.WorkingDir    = Path.GetDirectoryName(path) + "\\";
         manager.isFileSaved   = true;
         RebuildTree();
     }
 }
Exemple #2
0
        private void tvAspects_DragDrop(object sender, DragEventArgs e)
        {
            try
            {
                if (e.Data.GetDataPresent(Strings.TreeNodeType, false))
                {
                    TreeNode newParent;
                    int      pos;
                    CursorHelper.GetPositionToInsert(tvAspects, Adapter, e.X, e.Y, out newParent, out pos);
                    TreeNode NewNode = (TreeNode)e.Data.GetData(Strings.TreeNodeType);
                    Adapter.MoveNode(NewNode, newParent, pos);
                    SynchronizeUndoButtons();
                }
                else if (e.Data.GetDataPresent(DataFormats.FileDrop))
                {
                    string fileName = ((string[])(e.Data.GetData(DataFormats.FileDrop)))[0];
                    try
                    {
                        ParserWrapper   pw        = treeManager.GetParserWrapper();
                        PointOfInterest subAspect = Manager.DeserializeAspect(fileName, pw);
                        treeManager.ReleaseParserWrapper(pw);
                        if (subAspect != null)
                        {
                            Point    pt        = tvAspects.PointToClient(new Point(e.X, e.Y));
                            TreeNode newParent = tvAspects.GetNodeAt(pt);
                            Adapter.InsertNode(newParent, subAspect);
                        }
                    }
                    catch (Exception exc)
                    {
                        SetStatus(Strings.UnsupportedAspectFile);
                    }

                    SynchronizeUndoButtons();
                }
            }
            catch (Exception exc)
            {
                ExceptionInfoHelper.ShowInfo(exc);
            }
        }