示例#1
0
        public void StoreStateChart(FileStream ofile)
        {
            StateChartDocument doc = (StateChartDocument)goView1.Document;

            doc.StoreXml(ofile);
            doc.IsModified = false;
        }
示例#2
0
        public static StateChartDocument LoadXml(string ifile)
        {
            StateChartDocument state = null;

            if (File.Exists(ifile))
            {
                FileStream fs = File.OpenRead(ifile);
                state = LoadXml(fs);
            }
            return(state);
        }
示例#3
0
        public static StateChartDocument LoadXml(Stream ifile)
        {
            GoXmlReader xr = new GoXmlReader();

            InitReaderWriter(xr);
            StateChartDocument doc = xr.Consume(ifile) as StateChartDocument;

            if (doc == null)
            {
                return(null);
            }
            return(doc);
        }
示例#4
0
        private void craeteNodeLine()
        {
            if (msd != null && !isLoad)
            {
                if (this.InvokeRequired)
                {
                    Action a = craeteNodeLine;
                    this.Invoke(a);
                }
                else
                {
                    goView1.StartTransaction();

                    GoLayoutRandom l = new GoLayoutRandom();
                    RectangleF     r = goView1.DisplayRectangle;

                    l.Document = goView1.Document;
                    l.MinX     = (int)((r.X / goView1.DocScale) + 100);
                    l.MaxX     = (int)((r.Width - r.X) / goView1.DocScale - 100);
                    l.MinY     = (int)((r.Y / goView1.DocScale) + 100);
                    l.MaxY     = (int)((r.Height - r.Y) / goView1.DocScale - 100);

                    foreach (var s in msd.svrinfos)
                    {
                        GoBasicNode state = StateChartDocument.NewNode();
                        state.ToolTipText = "";
                        state.Text        = s.ServiceName;
                        state.UserFlags   = 0;
                        if (!isNodes(s.ServiceName))
                        {
                            goView1.Document.Add(state);
                        }
                    }
                    foreach (var s in msd.svrrefs)
                    {
                        addLine(s, Color.Green);
                    }
                    l.PerformLayout();

                    goView1.FinishTransaction("added  node");
                }
            }
        }
示例#5
0
        //SoundPlayer warnSoundPlayer = new SoundPlayer();
        public SRControl()
        {
            InitializeComponent();

            ToolStripMenuItem btnSave = new ToolStripMenuItem();

            btnSave.Text         = "保存布局";
            btnSave.DisplayStyle = ToolStripItemDisplayStyle.ImageAndText;

            btnSave.Click += new EventHandler(btnSave_Click);

            ToolStripMenuItem btnDelete = new ToolStripMenuItem();

            btnDelete.Text         = "删除布局";
            btnDelete.DisplayStyle = ToolStripItemDisplayStyle.ImageAndText;

            btnDelete.Click += new EventHandler(btnDelete_Click);

            ToolStripMenuItem btnClear = new ToolStripMenuItem();

            btnClear.Text         = "清除警告信息";
            btnClear.DisplayStyle = ToolStripItemDisplayStyle.ImageAndText;

            btnClear.Click += new EventHandler(btnClear_Click);
            contextMenuStrip.Items.Add(btnSave);
            contextMenuStrip.Items.Add(btnDelete);
            contextMenuStrip.Items.Add(new ToolStripSeparator());
            contextMenuStrip.Items.Add(btnClear);
            this.Disposed            += new EventHandler(SRControl_Disposed);
            goView1.NewLinkPrototype  = new AnimatedLink();
            this.goView1.NewLinkClass = typeof(AnimatedLink);
            StateChartDocument filedoc = StateChartDocument.LoadXml(loc);

            if (filedoc == null)
            {
                filedoc = new StateChartDocument();
                GoComment com = StateChartDocument.NewComment();
                com.Width   = this.Width;
                com.Visible = false;
                filedoc.Add(com);
            }
            else
            {
                isLoad = true;
            }
            GoDocument doc = filedoc;

            this.goView1.Document        = doc;
            goView1.ObjectDoubleClicked += new GoObjectEventHandler(goView1_ObjectDoubleClicked);
            goView1.Document.UndoManager = new GoUndoManager();
            logHelper           = new TextLogHelper(label1, this, ip, port);
            logHelper.SRControl = this;
            _cedaSubscribe      = new CedaManager(logHelper);
            timer1 = new Timer();


            this.timer1.Interval = 50;
            this.timer1.Tick    += new System.EventHandler(this.timer1_Tick);
            //setTimeEnable(true);
            //_cedaSubscribe.SRControl = this;
            //warnSoundPlayer.SoundLocation = Consts.SoundLocation;

            device = new DeviceImpl();
            device.init(this, Microsoft.DirectX.DirectSound.CooperativeLevel.Priority);
        }