Ejemplo n.º 1
0
        /// <summary>
        /// Get the path of the currently-selected profile
        /// </summary>
        /// <returns>path to the profile file</returns>
        string IUserInterface.GetSelectedProfile()
        {
            PathDisplayAdaptor adaptor = (PathDisplayAdaptor)this.profiles.SelectedItem;

            if (adaptor == null)
            {
                return(null);
            }

            return(adaptor.Path);
        }
Ejemplo n.º 2
0
 /// <summary>
 /// Select a profile in the UI
 /// </summary>
 /// <param name="path">path to the profile</param>
 void IUserInterface.SelectProfile(string path)
 {
     for (int i = 0; i < this.profiles.Items.Count; i++)
     {
         PathDisplayAdaptor adaptor = (PathDisplayAdaptor)this.profiles.Items[i];
         if (adaptor.Equals(path))
         {
             this.profiles.SelectedIndex = i;
             return;
         }
     }
 }
Ejemplo n.º 3
0
        /// <summary>
        /// Add a profile to the list shown in the UI
        /// </summary>
        /// <param name="path">path to the profile</param>
        void IUserInterface.AddProfile(string path)
        {
            foreach (PathDisplayAdaptor adaptor in this.profiles.Items)
            {
                if (adaptor.Equals(path))
                {
                    return;
                }
            }

            PathDisplayAdaptor newAdaptor = new PathDisplayAdaptor(path);

            this.profiles.Items.Add(newAdaptor);
        }
Ejemplo n.º 4
0
        /// <summary>
        /// Load the currently selected logging profile.
        /// </summary>
        private void LoadSelectedProfile()
        {
            Trace("Lumberjack.LoadSelectedProfile");
            if ((this.logger.CurrentProfile != null) && this.currentProfileIsChanged)
            {
                string       oldPath      = new PathDisplayAdaptor(this.Settings.LastProfilePath).ToString();
                DialogResult dialogResult = this.ui.PromptToSaveProfileBeforeChanging(oldPath);

                if (dialogResult == DialogResult.Cancel)
                {
                    this.ui.SelectProfile(this.Settings.LastProfilePath);
                    return;
                }
                else if (dialogResult == DialogResult.Yes)
                {
                    this.logger.CurrentProfile.Save(this.Settings.LastProfilePath);
                }
            }

            string profilePath = this.ui.GetSelectedProfile();

            Trace("Lumberjack.LoadSelectedProfile: " + profilePath);
            this.logger.BeginStopLogging(ContinueLoadSelectedProfile, profilePath);
        }