示例#1
0
        protected override void Load(ContainerBuilder builder)
        {
            base.Load(builder);

            SimpleSecurityWebServiceClient securityClient = new SimpleSecurityWebServiceClient("User");
            SimpleAmplaDatabase            amplaDatabase  = new SimpleAmplaDatabase();

            amplaDatabase.EnableModule("Production");
            amplaDatabase.EnableModule("Quality");
            amplaDatabase.EnableModule("Downtime");

            SimpleAmplaConfiguration configuration = new SimpleAmplaConfiguration();

            configuration.EnableModule("Production");
            configuration.AddLocation("Production", "Enterprise.Site.Area.Production");
            configuration.SetDefaultView("Production", QualityViews.StandardViewPlus(
                                             StandardViews.Field <double>("Weight"),
                                             StandardViews.Field <string>("Material", "Material", false, true)
                                             ));

            configuration.EnableModule("Quality");
            configuration.AddLocation("Quality", "Enterprise.Site.Area.Quality");
            configuration.SetDefaultView("Quality", QualityViews.StandardViewPlus(
                                             StandardViews.Field <double>("Moisture"),
                                             StandardViews.Field <string>("SampleId", "SampleId", false, true),
                                             StandardViews.Field <double>("Silica", "Silica", false, true),
                                             StandardViews.Field <double>("Sodium", "Sodium", false, true)
                                             ));

            configuration.EnableModule("Downtime");
            configuration.AddLocation("Downtime", "Enterprise.Site.Area.Downtime");
            configuration.SetDefaultView("Downtime", DowntimeViews.StandardView());

            builder.RegisterInstance(amplaDatabase).As <IAmplaDatabase>().SingleInstance();
            builder.RegisterInstance(configuration).As <IAmplaConfiguration>().SingleInstance();

            builder.RegisterInstance(securityClient).As <ISecurityWebServiceClient>().SingleInstance();
            builder.RegisterInstance(securityClient).SingleInstance();

            builder.RegisterType <SimpleDataWebServiceClient>().As <IDataWebServiceClient>();
        }
示例#2
0
 /// <summary>Returns a standard view associated with the current action and passes a view model</summary>
 /// <param name="standardView">Standard view supported by all themes</param>
 /// <param name="model">The model that is to be passed to the view</param>
 /// <param name="level">The level the view desires to be</param>
 /// <param name="forceNewShell">Indicates whether it is desired to launch this view in a new shell (may or may not be respected by each theme)</param>
 /// <returns>A view result</returns>
 /// <example>
 /// public ActionResult ShowDetails()
 /// {
 ///     var model = new MyModel();
 ///     return Document(StandardViews.Block, model, ViewLevel.Popup);
 /// }
 /// </example>        
 protected virtual ViewResult View(StandardViews standardView, object model = null, ViewLevel level = ViewLevel.Normal, bool forceNewShell = false)
 {
     var viewName = "CODEFrameworkStandardView" + standardView;
     return View(viewName, model, level, forceNewShell);
 }
示例#3
0
        /// <summary>This helper method finds the specified view which can often be useful in special cases, such as associating custom views with actions</summary>
        /// <param name="standardView">Standard view identifier</param>
        /// <param name="controllerType">Type of the controller (used as a context to find views)</param>
        /// <returns>Document as UIElement, or null if not found.</returns>
        public static FrameworkElement LoadView(StandardViews standardView, Type controllerType = null)
        {
            var viewName = "CODEFrameworkStandardView" + standardView;

            // If a controller type was specified, we try to use it, which provides a context to find views
            Controller controller;
            if (controllerType == null) controller = new Controller();
            else controller = Activator.CreateInstance(controllerType) as Controller;
            if (controller == null) controller = new Controller();
            var result = new ViewResult();
            return controller.FindView(viewName, ViewLevel.Normal, result) ? result.View : null;
        }
示例#4
0
 /// <summary>Displays the specified notification</summary>
 /// <param name="text">Main text</param>
 /// <param name="text2">Secondary text</param>
 /// <param name="number">Numeric information (such as an item count) passed as a string</param>
 /// <param name="imageResource">Generic image resource to load a brush from (if this parameter is passed an the resource is found the image parameter is ignored)</param>
 /// <param name="image">A logo image (passed as a brush).</param>
 /// <param name="model">Notification view model (if passed, text, number, image and overrideTimeout parameters are ignored)</param>
 /// <param name="standardView">Standard view to display</param>
 /// <param name="controllerType">Type of the controller (used as a context to find views)</param>
 /// <param name="overrideTimeout">Overrides the theme's default notification timeout. If model is passed, set this property in model.</param>
 public static void Notification(StandardViews standardView, string text = "", string text2 = "", string number = "", string imageResource = "", Brush image = null, NotificationViewModel model = null, Type controllerType = null, TimeSpan? overrideTimeout = null)
 {
     var viewName = "CODEFrameworkStandardView" + standardView;
     Notification(text, text2, number, imageResource, image, model, viewName, controllerType, overrideTimeout);
 }
示例#5
0
 public void EnableModule(string module)
 {
     locationsByModule.Add(module, new List <string>());
     defaultViewByModule.Add(module, StandardViews.EmptyView());
 }