Stetic.WidgetEditSession.OnProjectReloaded C# (CSharp) Method

OnProjectReloaded() private method

private OnProjectReloaded ( object s, EventArgs a ) : void
s object
a System.EventArgs
return void
        void OnProjectReloaded(object s, EventArgs a)
        {
            // Update the actions group list
            if (!autoCommitChanges) {
                gproject.AttachActionGroups (sourceProject.ActionGroups);
                gproject.WidgetLibraries = (ArrayList) sourceProject.WidgetLibraries.Clone ();
                gproject.InternalWidgetLibraries = (ArrayList) sourceProject.InternalWidgetLibraries.Clone ();
            }

            Gtk.Widget[] tops = gproject.Toplevels;
            if (tops.Length > 0) {
                rootWidget = Stetic.Wrapper.Container.Lookup (tops[0]);
                undoManager.RootObject = rootWidget;
                if (rootWidget != null) {
                    Gtk.Widget oldWidget = designer;
                    if (widget != null) {
                        widget.SelectionChanged -= OnSelectionChanged;
                        widget = null;
                    }
                    OnRootWidgetChanged ();
                    if (oldWidget != null) {
                        // Delay the destruction of the old widget, so the designer has time to
                        // show the new widget. This avoids flickering.
                        GLib.Timeout.Add (500, delegate {
                            oldWidget.Destroy ();
                            return false;
                        });
                    }

                    gproject.NotifyComponentTypesChanged ();
                    return;
                }
            }
            SetErrorMode ();
        }