Free cookie consent management tool by TermsFeed Policy Generator

Changeset 2467 for trunk/sources


Ignore:
Timestamp:
11/05/09 13:18:44 (15 years ago)
Author:
mkommend
Message:

added CreateView methods in MainFormManager (ticket #771)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/sources/HeuristicLab.MainForm/3.2/MainFormManager.cs

    r2466 r2467  
    113113        return (IView)Activator.CreateInstance(t, objectToView);
    114114    }
     115
     116    public static IView CreateView(Type viewType) {
     117      if (!typeof(IView).IsAssignableFrom(viewType))
     118        throw new ArgumentException("View can not be created becaues given type " + viewType.ToString() + " is not of type IView.");
     119      return (IView)Activator.CreateInstance(viewType);
     120    }
     121
     122    public static IView CreateView(Type viewType, object objectToView) {
     123      if (!typeof(IView).IsAssignableFrom(viewType))
     124        throw new ArgumentException("View can not be created becaues given type " + viewType.ToString() + " is not of type IView.");
     125      return (IView)Activator.CreateInstance(viewType,objectToView);
     126    }
    115127  }
    116128}
Note: See TracChangeset for help on using the changeset viewer.