Exemple #1
0
 private void Initialization(IHMIForm f, string fullName)
 {
     f.FullName = fullName;
     _openedList.Add(f);
     ((Form)f).FormClosed += FormClosed;
     f.Common.Initialization();
 }
Exemple #2
0
        public IHMIForm Open(string fullName)
        {
            IHMIForm f = FindOpened(fullName);

            if (f != null)
            {
                Show(f);
                return(f);
            }

            BinaryFormatter bf = new BinaryFormatter();

            try
            {
                using (Stream s = File.Open(fullName, FileMode.Open))
                {
                    f = new HMIForm(_framework);
                    (f as HMIForm).Deserialize(bf, s);
                    Initialization(f, fullName);
                }
            }
            catch (Exception e)
            {
                MessageBox.Show(e.Message);
                return(null);
            }

            Show(f);
            return(f);
        }
Exemple #3
0
        public void MouseMove(PointF point)
        {
            IUndoRedoManager undo = null;

            if (_list.Count > 0)
            {
                IHMIForm form = _list[0].Parant;
                undo = form.Studio.Undo;
            }

            Invalidate();

            if (undo != null)
            {
                undo.StartTransaction("Move");
            }
            foreach (IDrawObj obj in _list)
            {
                obj.MouseMove(point);
            }
            if (undo != null)
            {
                undo.EndTransaction();
            }

            SetListRect();
            SetRotatePointPos();

            Invalidate(true);
        }
Exemple #4
0
        public LayerConfigForm(IHMIForm data)
        {
            InitializeComponent();

            Debug.Assert(data != null);

            _data = data;
        }
Exemple #5
0
        public void ActiveDocumentChanged(object sender, EventArgs e)
        {
            if (sender is DockPanel)
            {
                _activeForm = (sender as DockPanel).ActiveDocument as IHMIForm;
            }

            SetCreateObjectState(_currentToolboxItem);
        }
Exemple #6
0
        private static void ChangeText(IHMIForm f, string newFullName)
        {
            string name = Path.GetFileNameWithoutExtension(f.FullName);

            //Text和文件名保持一致,才改名
            if (string.Compare(name, ((Form)f).Text, true) == 0)
            {
                ((Form)f).Text = Path.GetFileNameWithoutExtension(newFullName);
            }
        }
Exemple #7
0
 private void Show(IHMIForm form)
 {
     if (_framework.IsStudioMode)
     {
         ((DockContent)form).Show(((FrameworkManager)_framework.Manager).MainPanel);
     }
     else
     {
         ((Form)form).Show();
     }
 }
Exemple #8
0
        public bool Close(string fullName)
        {
            IHMIForm f = FindOpened(fullName);

            if (f != null)
            {
                ((Form)f).Close();
                return(true);
            }

            return(false);
        }
Exemple #9
0
        public bool Rename(string newFullName, string oldFullName)
        {
            IHMIForm f = FindOpened(oldFullName);

            if (f != null)
            {
                ChangeText(f, newFullName);
                f.FullName = newFullName;
                return(true);
            }

            return(false);
        }
Exemple #10
0
        public ControlPointContainer(IHMIForm container)
        {
            Debug.Assert(container != null);

            _container  = container;
            _selectObjs = new SelectObjectManager(this);

            _node    = new NodePoint(_selectObjs);
            _custom  = new CustomPoint(_selectObjs);
            _frame   = new FramePoint(_selectObjs);
            _segment = new SegmentPoint(_selectObjs);
            _form    = new FormPoint((HMIForm)_container);
        }
Exemple #11
0
 public bool Save(IHMIForm form)
 {
     form.Save();
     return(true);
 }