Esempio n. 1
0
 private void OnProfileControllerAction(ProfileControllerActionEventArgs e)
 {
     if (ProfileControllerAction != null)
     {
         ProfileControllerAction(this, e);
     }
 }
Esempio n. 2
0
        void profileController_ProfileControllerAction(Object sender, ProfileControllerActionEventArgs e)
        {
            if(e.Profile != null)
            {
                switch(e.Action)
                {
                    case ProfileControllerAction.AlreadyLoaded:
                        WriteLogLine("ERROR: Profile \"", e.Profile.Name, "\" has already been loaded and cannot be loaded twice.");
                        WriteLogLine("If you want to reload your profiles, restart the bot. ",
                            "May make this process more user friendly in the future.");
                        break;

                    case ProfileControllerAction.Save:
                        WriteLogLine("Successfully saved profile: \"",  e.Profile.Name, "\"");
                        break;

                    case ProfileControllerAction.Load:
                        WriteLogLine("Loaded new profile: \"", e.Profile.Name, "\"");
                        cbProfileSelector.SelectedIndex = -1;
                        cbProfileSelector.SelectedIndex = profileController.IndexOfProfileWithFilePath(e.Profile.FilePath);
                        break;

                    case ProfileControllerAction.Activated:
                        WriteLogLine("Activated profile: \"", e.Profile.Name, "\"");
                        BindingList<GenericNode> nodeList = e.Profile.NodeList;

                        if(lbNodes.DataSource is BindingList<GenericNode> && lbNodes.DataSource != null)
                            ((BindingList<GenericNode>) lbNodes.DataSource).ListChanged -= lbNodesListChangedEventHandler;

                        lbNodes.DataSource = nodeList;

                        // Extend ListControl
                        elbNodes = new ExtendedListControl<GenericNode>(lbNodes);

                        nodeList.ListChanged += lbNodesListChangedEventHandler;

                        lblCurrentProfile.Text = e.Profile.ToString();
                        nodeList.ResetBindings(); // Trigger event initially
                        break;
                }
            }
        }
Esempio n. 3
0
 private void OnProfileControllerAction(ProfileControllerActionEventArgs e)
 {
     if(ProfileControllerAction != null)
         ProfileControllerAction(this, e);
 }