コード例 #1
0
ファイル: SUtils.cs プロジェクト: palmaross/MMSynergy
        public static void ProcessBoundary(Boundary b, string _path, string what)
        {
            Topic  t      = b.Topic;
            string _tguid = t.get_Attributes(SUtils.SYNERGYNAMESPACE).GetAttributeValue(SUtils.OGUID);

            TransactionsWrapper.SetAttributes(b, b.Guid);
            t = null;

            string s = b.Shape.ToString(); // boundary:add

            if (what == "boundary:modify")
            {
                s = s + ";" +
                    b.FillColor.Value.ToString() + ";" +
                    b.LineColor.Value.ToString() + ";" +
                    b.LineDashStyle.ToString() + ";" +
                    b.LineWidth.ToString();
            }

            try
            {
                StreamWriter sw = new StreamWriter(File.Create(_path));
                sw.WriteLine(what);
                sw.WriteLine(_tguid);
                sw.WriteLine(s);
                sw.WriteLine(b.get_Attributes(SUtils.SYNERGYNAMESPACE).GetAttributeValue(SUtils.OGUID));
                sw.Close();
            }
            catch (Exception e)
            {
                System.Windows.Forms.MessageBox.Show("Exception: " + e.Message, "SUtils:ProcessBoundary"); //TODO поточнее ошибку!
            }
        }
コード例 #2
0
ファイル: SUtils.cs プロジェクト: palmaross/MMSynergy
        public const string TMODIFIED = "TMODIFIED"; // topic last modified datetime

        public static void ProcessRelationship(Relationship r, string _path, string what)
        {
            string Guid1, Guid2;

            Boundary b1 = r.ConnectedObject1 as Boundary;
            Boundary b2 = r.ConnectedObject2 as Boundary;

            if (r.ConnectedObject1 is Topic t1)
            {
                Guid1 = t1.get_Attributes(SUtils.SYNERGYNAMESPACE).GetAttributeValue(SUtils.OGUID);
            }
            else
            {
                Guid1 = b1.get_Attributes(SUtils.SYNERGYNAMESPACE).GetAttributeValue(SUtils.OGUID);
            }

            if (r.ConnectedObject2 is Topic t2)
            {
                Guid2 = t2.get_Attributes(SUtils.SYNERGYNAMESPACE).GetAttributeValue(SUtils.OGUID);
            }
            else
            {
                Guid2 = b2.get_Attributes(SUtils.SYNERGYNAMESPACE).GetAttributeValue(SUtils.OGUID);
            }

            float CX1 = 0, CX2 = 0, CY1 = 0, CY2 = 0;

            if (what != "relationship:add")
            {
                r.GetControlPoints(out CX1, out CY1, out CX2, out CY2);  //TODO что-то не плавающие они, а integer...
            }
            if (what != "relationship:modify")
            {
                TransactionsWrapper.SetAttributes(r, r.Guid);
            }

            try
            {
                StreamWriter sw = new StreamWriter(File.Create(_path));
                sw.WriteLine(what);
                sw.WriteLine(r.get_Attributes(SUtils.SYNERGYNAMESPACE).GetAttributeValue(SUtils.OGUID));
                sw.WriteLine(Guid1);
                sw.WriteLine(Guid2);
                //end if added new relationship
                if (what == "relationship:paste" || what == "relationship:modify")
                {
                    sw.WriteLine(CX1.ToString());
                    sw.WriteLine(CY1.ToString());
                    sw.WriteLine(CX2.ToString());
                    sw.WriteLine(CY2.ToString());
                    sw.WriteLine(r.Shape1);
                    sw.WriteLine(r.Shape2);
                    sw.WriteLine(r.LineColor.Value);
                    sw.WriteLine(r.LineDashStyle);
                    sw.WriteLine(r.LineShape);
                    sw.WriteLine(r.LineWidth);
                    sw.WriteLine(r.AutoRouting);
                }
                sw.Close();
            }
            catch (Exception e)
            {
                System.Windows.Forms.MessageBox.Show("Exception: " + e.Message, "SUtils:ProcessRelationship"); //TODO
            }
            finally
            {
                t1 = null; t2 = null; b1 = null; b2 = null;
            }
        }