Exemple #1
0
 public override void DocumentContextChanged(GH_Document document, GH_DocumentContext context)
 {
     if (context == GH_DocumentContext.Unloaded)
     {
         if (myControlPanel != null)
         {
             channel = myControlPanel.channel;
         }
         if (host != null)
         {
             try
             {
                 host.Close();
             }
             catch
             {
                 host.Abort();
             }
         }
     }
     if (context == GH_DocumentContext.Loaded)
     {
         myControlPanel = new mypanel(this, channel);
         functionset();
         myControlPanel._update();
         myControlPanel.Width = 190;
         init();
     }
     base.DocumentContextChanged(document, context);
 }
Exemple #2
0
 public override void DocumentContextChanged(GH_Document document, GH_DocumentContext context)
 {
     if (context == GH_DocumentContext.Close)
     {
         Receiver.Dispose();
     }
     base.DocumentContextChanged(document, context);
 }
        public override void DocumentContextChanged(GH_Document document, GH_DocumentContext context)
        {
            if (context == GH_DocumentContext.Close)
            {
                if (mySender != null)
                {
                    mySender.Dispose();
                }
            }

            base.DocumentContextChanged(document, context);
        }
        public override void DocumentContextChanged(GH_Document document, GH_DocumentContext context)
        {
            switch (context)
            {
            case GH_DocumentContext.Loaded:
                OnDisplayExpired(true);
                break;

            case GH_DocumentContext.Unloaded:
                // Will execute every time a document becomes inactive (in background or closing file.)
                //Correctly dispose of the client when changing documents to prevent subscription handlers being called in background.
                RequestCancellation();
                break;
            }

            base.DocumentContextChanged(document, context);
        }
        public override void DocumentContextChanged(GH_Document document, GH_DocumentContext context)
        {
            switch (context)
            {
            case GH_DocumentContext.Loaded:
            {
                // Will execute every time a document becomes active (from background or opening file.).
                if (StreamWrapper != null)
                {
                    Task.Run(async() =>
                        {
                            // Ensure fresh instance of client.
                            await ResetApiClient(StreamWrapper);

                            // Get last commit from the branch
                            var b = ApiClient.BranchGet(BaseWorker.CancellationToken, StreamWrapper.StreamId, StreamWrapper.BranchName ?? "main", 1).Result;

                            // Compare commit id's. If they don't match, notify user or fetch data if in auto mode
                            if (b.commits.items[0].id != ReceivedCommitId)
                            {
                                HandleNewCommit();
                            }

                            OnDisplayExpired(true);
                        });
                }

                break;
            }

            case GH_DocumentContext.Unloaded:
                // Will execute every time a document becomes inactive (in background or closing file.)
                //Correctly dispose of the client when changing documents to prevent subscription handlers being called in background.
                CurrentComponentState = "expired";
                RequestCancellation();
                ApiClient?.Dispose();
                break;
            }

            base.DocumentContextChanged(document, context);
        }
Exemple #6
0
 public override void DocumentContextChanged(GH_Document document, GH_DocumentContext context)
 {
     if (context == GH_DocumentContext.Unloaded)
     {
         if (myControlPanel != null)
         {
             proj         = myControlPanel.project;
             key          = myControlPanel.key;
             filteroldone = myControlPanel._filteroldone;
             filterbyname = myControlPanel._filterbyname;
         }
     }
     if (context == GH_DocumentContext.Loaded)
     {
         myControlPanel = new mypanel(this, repo, proj, key, filterbyname, filteroldone);
         functionset();
         myControlPanel._update();
         myControlPanel.Width = 190;
     }
     base.DocumentContextChanged(document, context);
 }
        /// <summary>
        /// This method will be called when the document that owns this object moves into a different context.
        /// </summary>
        /// <param name="document">Document that owns this object.</param>
        /// <param name="context">The reason for this event.<br/>
        ///     Unknown	 0:	Specifies unknown context.This should never be used.<br/>
        ///     None     1:	Specifies unset state.This is only used for documents that have never been in a context.<br/>
        ///     Open     2:	Indicates the document was created anew from a file.<br/>
        ///     Close    3:	Indicates the document has been unloaded from memory.<br/>
        ///     Loaded   4:	Indicates the document has been loaded into the Canvas.<br/>
        ///     Unloaded 5:	Indicates the document has been unloaded from the Canvas.<br/>
        ///     Lock     6:	Indicates the document has been locked. This is only possible for nested documents.<br/>
        ///     Unlock   7:	Indicates the document has been unlocked. This is only possible for nested documents.
        /// </param>
        public override void DocumentContextChanged(GH_Document document, GH_DocumentContext context)
        {
            RhinoApp.WriteLine("DocumentContextChanged");
            switch (context)
            {
            case GH_DocumentContext.Open:
                RhinoApp.WriteLine("Open");
                break;

            case GH_DocumentContext.Close:
                RhinoApp.WriteLine("Close");
                RemoveEvents();
                break;

            case GH_DocumentContext.Loaded:
                RhinoApp.WriteLine("Loaded");
                break;

            case GH_DocumentContext.Unloaded:
                RhinoApp.WriteLine("Unloaded");
                RemoveEvents();
                break;

            case GH_DocumentContext.Lock:
                RhinoApp.WriteLine("Lock");
                RemoveEvents();
                break;

            case GH_DocumentContext.Unlock:
                RhinoApp.WriteLine("Unlock");
                break;

            default:
                break;
            }
        }
Exemple #8
0
 public override void DocumentContextChanged(GH_Document document, GH_DocumentContext context)
 {
     base.DocumentContextChanged(document, context);
 }
 public override void DocumentContextChanged(GH_Document document, GH_DocumentContext context)
 {
     base.DocumentContextChanged(document, context);
     if (context == GH_DocumentContext.Loaded)
     {
         myControlPanel = new controlPanel();
     }
 }
 public void DocumentContextChanged(GH_Document document, GH_DocumentContext context)
 {
     throw new NotImplementedException();
 }
 public void DocumentContextChanged(GH_Document document, GH_DocumentContext context)
 {
     throw new NotImplementedException();
 }