Ejemplo n.º 1
0
        private TabPage AddTabPage(Options options)
        {
            var optionsControl = new OptionsDisplayControl(_session);

            var tabPage = new TabPage(options.Name);

            _tabControl.TabPages.Add(tabPage);

            optionsControl.DeletionRequested += delegate { _tabControl.TabPages.Remove(tabPage); };

            optionsControl.HeaderChanged += delegate(object sender, HeaderEventArgs e)
            {
                tabPage.Text = e.Name;

                switch (e.FolderItemType)
                {
                case OlItemType.olAppointmentItem:
                    if (e.IsInactive)
                    {
                        tabPage.ImageKey = "AppointmentDisabled";
                    }
                    else
                    {
                        tabPage.ImageKey = "Appointment";
                    }
                    break;

                case OlItemType.olTaskItem:
                    if (e.IsInactive)
                    {
                        tabPage.ImageKey = "TaskDisabled";
                    }
                    else
                    {
                        tabPage.ImageKey = "Task";
                    }
                    break;

                default:
                    tabPage.ImageKey = null;
                    break;
                }
            };

            optionsControl.CopyRequested += delegate
            {
                var newOptions = optionsControl.Options;
                newOptions.Name += " (Copy)";
                newOptions.Id    = Guid.NewGuid();
                var newPage = AddTabPage(newOptions);
                _tabControl.SelectedTab = newPage;
            };

            optionsControl.Options = options;
            tabPage.Controls.Add(optionsControl);
            optionsControl.Dock = DockStyle.Fill;
            return(tabPage);
        }
    private TabPage AddTabPage (Options options)
    {
      var optionsControl = new OptionsDisplayControl (_session);

      var tabPage = new TabPage (options.Name);
      _tabControl.TabPages.Add (tabPage);

      optionsControl.DeletionRequested += delegate { _tabControl.TabPages.Remove (tabPage); };

      optionsControl.HeaderChanged += delegate (object sender, HeaderEventArgs e)
      {
        tabPage.Text = e.Name;

        switch (e.FolderItemType)
        {
          case OlItemType.olAppointmentItem:
            if (e.IsInactive)
              tabPage.ImageKey = "AppointmentDisabled";
            else
              tabPage.ImageKey = "Appointment";
            break;
          case OlItemType.olTaskItem:
            if (e.IsInactive)
              tabPage.ImageKey = "TaskDisabled";
            else
              tabPage.ImageKey = "Task";
            break;
          case OlItemType.olContactItem:
            if (e.IsInactive)
              tabPage.ImageKey = "ContactDisabled";
            else
              tabPage.ImageKey = "Contact";
            break;
          default:
            tabPage.ImageKey = null;
            break;
        }
      };

      optionsControl.CopyRequested += delegate
      {
        var newOptions = optionsControl.Options;
        newOptions.Name += " (Copy)";
        newOptions.Id = Guid.NewGuid();
        var newPage = AddTabPage (newOptions);
        _tabControl.SelectedTab = newPage;
      };

      optionsControl.Options = options;
      tabPage.Controls.Add (optionsControl);
      optionsControl.Dock = DockStyle.Fill;
      return tabPage;
    }
 public SettingsFaultFinder (OptionsDisplayControl optionsDisplayControl)
 {
   _ = optionsDisplayControl;
 }