Esempio n. 1
0
        /// <summary>
        /// Initializes a new instance of the Window class.
        /// </summary>
        public Window()
            : base("Window", "Window", "---", "Aviary", "Dashboard Layout")
        {
            this.UpdateMessage();

            ID     = this.Attributes.InstanceGuid.ToString();
            name   = new GUIDtoAlpha(Convert.ToString(ID + Convert.ToString(this.RunCount)), false).Text;
            window = new pWindow(name);
        }
Esempio n. 2
0
        /// <summary>
        /// This is the method that actually does the work.
        /// </summary>
        /// <param name="DA">The DA object is used to retrieve from inputs and store in outputs.</param>
        protected override void SolveInstance(IGH_DataAccess DA)
        {
            IGH_Goo X = null;

            if (!DA.GetData(0, ref X))
            {
                return;
            }

            wObject W;

            X.CastTo(out W);
            pWindow E = (pWindow)W.Element;
        }
Esempio n. 3
0
        /// <summary>
        /// This is the method that actually does the work.
        /// </summary>
        /// <param name="DA">The DA object is used to retrieve from inputs and store in outputs.</param>
        protected override void SolveInstance(IGH_DataAccess DA)
        {
            bool           Launch = false;
            string         Title  = "";
            List <IGH_Goo> X      = new List <IGH_Goo>();

            if (!DA.GetDataList(0, X))
            {
                return;
            }
            if (!DA.GetData(1, ref Title))
            {
                return;
            }
            if (!DA.GetData(2, ref Launch))
            {
                return;
            }

            if (Launch)
            {
                window.Close();
                window = new pWindow(name);
                window.SetProperties(Title);

                for (int i = 0; i < X.Count; i++)
                {
                    wObject  W;
                    pElement E;
                    X[i].CastTo(out W);
                    E = (pElement)W.Element;
                    window.AddElement(E);

                    var cP = Grasshopper.Instances.ActiveCanvas.Document.FindComponent(W.GUID) as Grasshopper.Kernel.IGH_Component;
                    SetComponentWindow S = new SetComponentWindow(cP, W, W.Type, W.Instance);
                }

                window.SetTransparency(modeTrans);
                window.SetScroll(modeScrollH, modeScrollV);
                window.SetTitleBar(modeTitle);
                window.SetWindowControls(modeCtrl);

                WindowInteropHelper H = new WindowInteropHelper(window.Element);

                switch (modeStatus)
                {
                case 1:
                    window.Element.Topmost = true;
                    break;

                case 2:
                    H.Owner = Rhino.RhinoApp.MainWindowHandle();
                    break;

                case 3:
                    H.Owner = Grasshopper.Instances.DocumentEditor.Handle;
                    break;

                default:
                    window.Element.Topmost = false;
                    break;
                }

                window.Open();
            }

            pElement Element    = new pElement(window.Element, window, window.Type, false);
            wObject  WindObject = new wObject(Element, "Parrot", Element.Type);

            DA.SetData(0, WindObject);
            DA.SetDataList(1, X);
        }