Esempio n. 1
0
        public void LoadFromXmlElement(XmlElement root)
        {
            OnResolutionChanged();
            var val = root.GetAttribute("Name");

            if (!String.IsNullOrEmpty(val))
            {
                Name = val;
            }
            val = root.GetAttribute("IsVisible");
            if (!String.IsNullOrEmpty(val))
            {
                IsVisible = bool.Parse(val);
            }
            TimeLength = Convert.ToSingle(root.GetAttribute("TimeLength"));
            val        = root.GetAttribute("SwitchMode");
            if (!String.IsNullOrEmpty(val))
            {
                SwitchMode = (ViewportSwitchMode)Enum.Parse(typeof(ViewportSwitchMode), val);
            }
            else
            {
                SwitchMode = ViewportSwitchMode.时间切换;
            }
            val = root.GetAttribute("SwitchHotKey");
            if (!String.IsNullOrEmpty(val))
            {
                SwitchHotKey = (System.Windows.Forms.Keys)Enum.Parse(typeof(System.Windows.Forms.Keys), val);
            }
            else
            {
                SwitchHotKey = System.Windows.Forms.Keys.None;
            }
            val = root.GetAttribute("ElementsCaptionColor"); int dwClr;
            if (!String.IsNullOrEmpty(val) && Int32.TryParse(val, out dwClr))
            {
                ElementsCaptionColor = System.Drawing.Color.FromArgb(dwClr);
            }
            val = root.GetAttribute("ElementsCaptionScale");
            if (!String.IsNullOrEmpty(val))
            {
                ElementsCaptionScale = float.Parse(val);
            }
            foreach (XmlElement node in root.GetElementsByTagName("Element"))
            {
                if (node.ParentNode == root)
                {
                    var kind = (ResourceKind)Enum.Parse(typeof(ResourceKind), node.GetAttribute("Kind"));
                    var file = node.GetAttribute("ResourceFile");
                    var res  = ProjectDoc.Instance.ResourceGroups[kind].GetResourceInfo(file);
                    if (res != null)
                    {
                        var e = ElementInfo.CreateElement(res, this, new System.Drawing.PointF(0, 0));
                        AddElement(e);
                        e.LoadFromXmlElement(node);
                    }
                }
            }
            ElemGroupCollector.LoadFromParentXmlElement(root);
        }
Esempio n. 2
0
        public ViewportInfo(ViewportInfo info)
            : base(info)
        {
            ParentSceneInfo      = info.ParentSceneInfo;
            IsSelected           = false;
            TimeLength           = info.TimeLength;
            CurTimeTick          = info.CurTimeTick;
            IsVisible            = info.IsVisible;
            IsMaximized          = info.IsMaximized;
            IsFullscreenMode     = info.IsFullscreenMode;
            Name                 = ToString();
            SwitchMode           = info.SwitchMode;
            SwitchHotKey         = info.SwitchHotKey;
            ViewScale            = info.ViewScale;
            ElementsCaptionColor = info.ElementsCaptionColor;
            ElementsCaptionScale = info.ElementsCaptionScale;
            ElemGroupCollector   = new ElementGroupCollector(this);

            for (int i = 0; i < info.Elements.Count; ++i)
            {
                if (i == 0 && info.Elements[i] == null)
                {
                    Elements.Add(null);
                }
                else
                {
                    AddElement(ElementInfo.CreateElement(info.Elements[i]));
                }
            }

            for (int i = 0; i < 4; ++i)
            {
                m_vFrameRc[i] = info.m_vFrameRc[i];
            }
        }
Esempio n. 3
0
        public ElementInfo DuplicateElement(ElementInfo elm, System.Drawing.Point?pos)
        {
            var newElm = ElementInfo.CreateElement(elm);

            if (AddElement(newElm))
            {
                if (!pos.HasValue)
                {
                    var p = elm.Location;
                    pos = new System.Drawing.Point(p.X, p.Y);
                }
                newElm.Location = pos.Value;
            }
            return(newElm);
        }
Esempio n. 4
0
        public override void Do()
        {
            var rg  = ProjectDoc.Instance.ResourceGroups[Info.ResKind];
            var res = rg.GetResourceInfo(Info.ResPathFile);

            if (res == null)
            {
                // TODO: Log Null resources
            }
            else
            {
                var e = ElementInfo.CreateElement(res, Viewport, new System.Drawing.PointF(0, 0));
                e.GUID      = Info.GUID;
                e.CreatorId = UserID;
                e.BaseTrans.Copy(Info.TransInfo);
                e.ManualScaleOnSrcBackImage = Info.ManualScaleOnSrcBackImage;
                Viewport.AddElement(e);
            }
        }
        // 合作组员创建元素
        public void SetGroupUserOperation_Create(long userId, ElementCreateInfo info)
        {
            var vi  = ProjectDoc.Instance.SelectedViewportInfo;
            var rg  = ProjectDoc.Instance.ResourceGroups[info.ResKind];
            var res = rg.GetResourceInfo(info.ResPathFile);

            if (res == null)
            {
                MessageController.PushMessage(MessageLevel.警告, MessageType.任务操作, Color.Red, "未能找到所需的同步资源:" + info.ResPathFile);
            }
            else
            {
                var e = ElementInfo.CreateElement(res, vi, new System.Drawing.PointF(0, 0));
                e.GUID      = info.GUID;
                e.CreatorId = userId;
                e.BaseTrans.Copy(info.TransInfo);
                e.ManualScaleOnSrcBackImage = info.ManualScaleOnSrcBackImage;
                vi.AddElement(e);
            }
        }