Beispiel #1
0
        public override void AppendAdditionalMenuItems(ToolStripDropDown menu)
        {
            base.AppendAdditionalMenuItems(menu);
            GH_DocumentObject.Menu_AppendItem(menu, "Copy streamId (" + StreamId + ") to clipboard.", (sender, e) =>
            {
                if (StreamId != null)
                {
                    System.Windows.Clipboard.SetText(StreamId);
                }
            });

            GH_DocumentObject.Menu_AppendSeparator(menu);

            GH_DocumentObject.Menu_AppendItem(menu, "View stream.", (sender, e) =>
            {
                if (StreamId == null)
                {
                    return;
                }
                System.Diagnostics.Process.Start(RestApi.Replace("api", "view") + @"/?" + StreamId);
            });

            GH_DocumentObject.Menu_AppendItem(menu, "View stream data.", (sender, e) =>
            {
                if (StreamId == null)
                {
                    return;
                }
                System.Diagnostics.Process.Start(RestApi + @"/streams/" + StreamId);
            });

            GH_DocumentObject.Menu_AppendItem(menu, "View layers data online.", (sender, e) =>
            {
                if (StreamId == null)
                {
                    return;
                }
                System.Diagnostics.Process.Start(RestApi + @"/streams/" + StreamId + @"/layers");
            });

            GH_DocumentObject.Menu_AppendItem(menu, "View objects data online.", (sender, e) =>
            {
                if (StreamId == null)
                {
                    return;
                }
                System.Diagnostics.Process.Start(RestApi + @"/streams/" + StreamId + @"/objects?omit=displayValue,base64");
            });

            GH_DocumentObject.Menu_AppendSeparator(menu);
            GH_DocumentObject.Menu_AppendItem(menu, "Save current stream as a version.", (sender, e) =>
            {
                var cloneResult = mySender.StreamClone(StreamId);
                mySender.Stream.Children.Add(cloneResult.Clone.StreamId);

                mySender.BroadcastMessage(new { eventType = "update-children" });

                System.Windows.MessageBox.Show("Stream version saved. CloneId: " + cloneResult.Clone.StreamId);
            });

            if (mySender.Stream == null)
            {
                return;
            }

            GH_DocumentObject.Menu_AppendSeparator(menu);
            if (mySender.Stream.Parent == null)
            {
                GH_DocumentObject.Menu_AppendItem(menu: menu, text: "This is a parent stream.", enabled: false, click: null);
            }
            else
            {
                GH_DocumentObject.Menu_AppendItem(menu: menu, text: "Parent: " + mySender.Stream.Parent, click: (sender, e) =>
                {
                    System.Windows.Clipboard.SetText(mySender.Stream.Parent);
                    System.Windows.MessageBox.Show("Parent id copied to clipboard. Share away!");
                });
            }
            GH_DocumentObject.Menu_AppendSeparator(menu);


            GH_DocumentObject.Menu_AppendSeparator(menu);
            GH_DocumentObject.Menu_AppendItem(menu, "Children:");
            GH_DocumentObject.Menu_AppendSeparator(menu);

            foreach (string childId in mySender.Stream.Children)
            {
                GH_DocumentObject.Menu_AppendItem(menu, "Child " + childId, (sender, e) =>
                {
                    System.Windows.Clipboard.SetText(childId);
                    System.Windows.MessageBox.Show("Child id copied to clipboard. Share away!");
                });
            }
        }