예제 #1
0
        public JazzGraphContainer(int index, JazzPackage jp,
                                  IResourceIndexEntry rie, Control view, TabPage page)
        {
            this.Index     = index;
            this.UndoRedo  = new UndoManager();
            this.SaveState = JazzSaveState.Saved;
            this.Key       = new RK(rie);
            this.Comp      = rie.Compressed == 0xFFFF;
            this.JP        = jp;
            this.RIE       = rie;
            IResource           res  = null;
            GenericRCOLResource rcol = null;

            try
            {
                res = WrapperDealer.GetResource(0, jp.Package, rie);
            }
            catch (Exception ex)
            {
                MainForm.ShowException(ex,
                                       "Could not load JAZZ resource: " + this.Key + "\n",
                                       MainForm.kName + ": Unable to load JAZZ resource");
            }
            if (res != null)
            {
                rcol = res as GenericRCOLResource;
                if (rcol != null)
                {
                    this.Scene = new StateMachineScene(
                        new StateMachine(rcol), view, this);
                    KKLayoutAlgorithm <StateNode, StateEdge> layout
                        = new KKLayoutAlgorithm <StateNode, StateEdge>(
                              this.Scene.StateGraph, this.Scene);
                    layout.LengthFactor = 1.25f;
                    this.Scene.Layout   = layout;
                    layout.ShuffleNodes();
                    this.Scene.LayoutPaused = true;
                    this.Scene.StartLayout();
                }
                else
                {
                    this.Scene = null;
                }
            }
            if (!KeyNameReg.TryFindName(rie.Instance, out this.mName))
            {
                this.mName = "0x" + rie.Instance.ToString("X16");
            }
            if (this.Scene != null)
            {
                this.mPage = page;
                this.mPage.Controls.Add(view);
                this.mPage.Text         = this.mName;
                this.mPage.SizeChanged +=
                    new EventHandler(this.OnTabSizeChanged);
            }
        }
예제 #2
0
        static void Main(string[] args)
        {
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);
#if DEBUG
            Application.Run(new MainForm(args));
#else
            try
            {
                Application.Run(new MainForm(args));
            }
            catch (Exception ex)
            {
                MainForm.ShowException(ex);
            }
#endif
        }