0

I have this class and internal class as part of a namespace, like this (Just removed and replaced some code and namespace declarations:

namespace X.Y.MessageHandlers.AsxActivity
{
    public class AsxActivityAliveEventMessageHandler : IHandleMessages<AsxActivityAliveEvent>
    {
        private const double INTERVAL = 10000;
        public static bool AsxConnected { get; set; }
        private static Dictionary<String, TagTimer> _connectionTimers = new Dictionary<string, TagTimer>();

        public void Handle(AsxActivityAliveEvent message)
        {
              ...
        }

        void timer_Elapsed(object sender, System.Timers.ElapsedEventArgs e)
        {
              ...
        }

        static void NotifyClients(AsxActivityAliveEvent message)
        {
              ...
        }
    }

    internal class TagTimer : Timer
    {
        public object Tag { get; set; }
    }
}

Whenever I double-click my "AsxActivityAliveEventMessageHandler.cs" from the solution explorer, Visual studio pops up a window I've never seen before that gives me the following message:

To prevent possible data loss before loading the designer, the following errors must be resolved:

This is followed by this explanation:

The class TagTimer can be designed, but is not the first class in the file. Visual Studio requires that designers use the first class in the file. Move the class code so that it is the first class in the file and try loading the designer again.

Tried changing the class TagTimer from internal to public to private, but error does not seem do budge. Am I missing something here?

Nicklas Pouey-Winger
  • 3,023
  • 6
  • 43
  • 75

1 Answers1

1

When you double clik the file, VS tries to open the designer if there are designable classes in the file. You can either change the default open action, or move the TagTimer class above the AsxActivityAliveEventMessageHandler.

Another solution is to open the file not by double clicking, but by pressing F7.

Community
  • 1
  • 1
Bart Friederichs
  • 33,050
  • 15
  • 95
  • 195