コード例 #1
0
        protected IProgressDispatcherIntern GetCurrentProgressDispatcher()
        {
            IBeanContextHolder <IProgressDispatcherIntern> childSP = progressDispatcherTL.Value;

            if (childSP == null)
            {
                return(noOpProgressDispatcher);
            }
            return(childSP.GetTypedValue());
        }
コード例 #2
0
        public IProgress StartProgress()
        {
            IBeanContextHolder <IProgressDispatcherIntern> childSP = progressDispatcherTL.Value;

            if (childSP == null)
            {
                IBeanContextHolder <IProgressDispatcherIntern> progressDispatcher = BeanContext.CreateService <IProgressDispatcherIntern>(typeof(ProgressDispatcherModule));
                progressDispatcherTL.Value = progressDispatcher;
            }
            return(((ProgressDispatcher)childSP.GetTypedValue()).StartProgress());
        }
コード例 #3
0
        public void EndProgress(Object result)
        {
            IProgressDispatcherIntern progressDispatcher = GetCurrentProgressDispatcher();

            progressDispatcher.EndProgress(result);
            if (progressDispatcher.IsProgressPending)
            {
                return;
            }
            IBeanContextHolder <IProgressDispatcherIntern> childSP = progressDispatcherTL.Value;

            progressDispatcherTL.Value = null;
            childSP.Dispose();
        }
コード例 #4
0
        public void Failure(Exception e)
        {
            IProgressDispatcherIntern progressDispatcher = GetCurrentProgressDispatcher();

            progressDispatcher.Failure(e);
            if (progressDispatcher.IsProgressPending)
            {
                return;
            }
            IBeanContextHolder <IProgressDispatcherIntern> childSP = progressDispatcherTL.Value;

            progressDispatcherTL.Value = null;
            childSP.Dispose();
        }
コード例 #5
0
        public IBeanContextHolder <RadWindow> CreateDefaultWindow(String header, UserControl content)
        {
            String windowBeanName = "window";
            IBeanContextHolder <RadWindow> radWindow = BeanContext.CreateService <RadWindow>(delegate(IBeanContextFactory childContextFactory)
            {
                childContextFactory.RegisterExternalBean("param.header", header);

                IBeanConfiguration window = childContextFactory.RegisterBean <RadWindow>(windowBeanName)
                                            .PropertyRef("Header", "param.header")
                                            .PropertyValue("WindowStartupLocation", Telerik.Windows.Controls.WindowStartupLocation.CenterScreen)
                                            .PropertyValue("CanClose", "true")
                                            .PropertyValue("CanMove", "true")
                                            .PropertyValue("ResizeMode", ResizeMode.CanResize)
                                            .Autowireable <RadWindow>();

                if (content != null)
                {
                    // Optional content argument
                    childContextFactory.RegisterExternalBean("param.content", content);

                    window.PropertyRef("Content", "param.content")
                    .PropertyValue("Width", content.Width + 20)
                    .PropertyValue("Height", content.Height + 50);
                }
                UserControl parent = Application.Current.RootVisual as UserControl;
                if (parent != null)
                {
                    window.PropertyValue("MaxHeight", parent.ActualHeight)
                    .PropertyValue("MaxWidth", parent.ActualWidth);
                }
                if (parent != null && content != null)
                {
                    window.PropertyValue("MinHeight", Math.Min(content.MinHeight, parent.ActualHeight))
                    .PropertyValue("MinWidth", Math.Min(content.MinWidth, parent.ActualWidth));
                }
            });

            radWindow.LinkExtendable.Link(new RoutedEventHandler(DefaultWindow_Loaded)).To(windowBeanName, RadWindowEvents.Loaded);
            radWindow.LinkExtendable.Link(new SizeChangedEventHandler(DefaultWindow_SizeChanged)).To(windowBeanName, RadWindowEvents.SizeChanged);

            return(radWindow);
        }