Free cookie consent management tool by TermsFeed Policy Generator

source: branches/Mainform refactoring/HeuristicLab.MainForm/3.2/MainFormManager.cs @ 2426

Last change on this file since 2426 was 2426, checked in by mkommend, 15 years ago

initial version of refactored mainform (ticket #771)

File size: 746 bytes
Line 
1using System;
2using System.Collections.Generic;
3using System.Linq;
4using System.Text;
5
6namespace HeuristicLab.MainForm {
7  public class MainFormManager {
8    private MainFormManager() {
9      MainFormManager.mainform = null;
10    }
11
12    private static IMainForm mainform;
13    public static void RegisterMainForm(IMainForm mainform) {
14      if (MainFormManager.mainform == null)
15        MainFormManager.mainform = mainform;
16      else
17        throw new ArgumentException("A mainform was already associated with the mainform manager.");
18    }
19
20    public static IMainForm Instance {
21      get { return mainform; }
22    }
23
24    public static T GetInstance<T>() where T : IMainForm {
25      return (T)mainform;
26    }
27  }
28}
Note: See TracBrowser for help on using the repository browser.