Пример #1
0
        public static void RegisterViewModel(object viewModel)
        {
            jQuery.OnDocumentReady(delegate()
            {
                if (!_templateLoaded)
                {
                    jQuery.Get(sparkleXrmTemplatePath, delegate(object template)
                    {
                        jQuery.Select("body").Append((string)template);

                        ValidationApi.RegisterExtenders();

                        // Init settings
                        OrganizationServiceProxy.GetUserSettings();

                        // set the flag so we do not perform the above steps again.
                        _templateLoaded = true;

                        Knockout.ApplyBindings(viewModel);
                    });
                }
                else
                {
                    Knockout.ApplyBindings(viewModel);
                }
            });
        }
Пример #2
0
        public static void RegisterViewModel(object viewModel)
        {
            jQuery.OnDocumentReady(delegate()
            {
                jQuery.Get("../../sparkle_/html/form.templates.htm", delegate(object template)
                {
                    jQuery.Select("body").Append((string)template);

                    ValidationApi.RegisterExtenders();

                    // Init settings
                    OrganizationServiceProxy.GetUserSettings();
                    Knockout.ApplyBindings(viewModel);
                });
            });
        }