Esempio n. 1
0
        internal ImagePanel(ContextObject context, Meta meta) : this()
        {
            _context = context;
            Meta     = meta;

            ShowMeta();
            Theme = _context.Theme;
        }
Esempio n. 2
0
        /// <summary>
        /// 添加联系上下文
        /// </summary>
        /// <param name="trans"></param>
        /// <param name="insID"></param>
        public virtual void AddContext(Transform trans, int insID)
        {
            ContextObject co = new ContextObject();

            co.Ins   = trans;
            co.InsID = insID;
            objects.Add(co);
        }
Esempio n. 3
0
        public void BoundViewSize(string path, ContextObject context)
        {
            _pdfControl = new PdfViewerControl();

            var desiredSize = _pdfControl.GetDesiredControlSizeByFirstPage(path);

            context.SetPreferredSizeFit(desiredSize, 0.8);
        }
Esempio n. 4
0
        public void View(string path, ContextObject context)
        {
            _ip = new InfoPanel();
            context.ViewerContent = _ip;

            _ip.DisplayInfo(path);
            context.IsBusy = false;
        }
Esempio n. 5
0
        /// <summary>
        ///		Wraps the object to ether an TaskT or an ValueTaskT
        /// </summary>
        /// <param name="data"></param>
        /// <returns></returns>
        public static ContextObjectPromise ToPromise(this ContextObject data)
        {
#if ValueTask
            return(new ContextObjectPromise(data));
#else
            return(Promise.FromResult(data));
#endif
        }
Esempio n. 6
0
        public void Prepare(string path, ContextObject context)
        {
            //context.Theme = Themes.Light;

            context.PreferredSize = new Size {
                Width = 800, Height = 600
            };
        }
Esempio n. 7
0
        public Database(ContextObject owner)
            : base(owner)
        {
            Connection = new Connection(this);

            Tables = new ContextObjectList <TableInfo>(this);
            Views  = new ContextObjectList <ViewInfo>(this);
        }
 /// <inheritdoc />
 public override ItemExecutionPromise Render(
     IByteCounterStream outputStream,
     ContextObject context,
     ScopeData scopeData)
 {
     CoreAction(outputStream, scopeData);
     return(Enumerable.Empty <DocumentItemExecution>().ToPromise());
 }
Esempio n. 9
0
        internal MainWindowTransparent()
        {
            // this object should be initialized before loading UI components, because many of which are binding to it.
            ContextObject = new ContextObject();

            InitializeComponent();

            FontFamily = new FontFamily(TranslationHelper.GetString("UI_FontFamily", failsafe: "Segoe UI"));

            windowCaptionContainer.MouseLeftButtonDown += WindowDragMoveStart;
            windowCaptionContainer.MouseMove           += WindowDragMoving;
            windowCaptionContainer.MouseLeftButtonUp   += WindowDragMoveEnd;

            windowFrameContainer.PreviewMouseMove += ShowWindowCaptionContainer;

            buttonPin.Click += (sender, e) =>
            {
                if (Pinned)
                {
                    Topmost       = !Topmost;
                    buttonPin.Tag = Topmost ? "PinTop" : "Pin";
                    return;
                }
                Pinned        = true;
                buttonPin.Tag = "Pin";
                ViewWindowManager.GetInstance().ForgetCurrentWindow();
            };

            buttonCloseWindow.Click += (sender, e) =>
            {
                if (Pinned)
                {
                    BeginClose();
                }
                else
                {
                    ViewWindowManager.GetInstance().ClosePreview();
                }
            };

            buttonOpenWith.Click += (sender, e) =>
            {
                if (Pinned)
                {
                    RunAndClose();
                }
                else
                {
                    ViewWindowManager.GetInstance().RunAndClosePreview();
                }
            };

            buttonWindowStatus.Click += (sender, e) =>
                                        WindowState = WindowState == WindowState.Maximized ? WindowState.Normal : WindowState.Maximized;

            buttonShare.Click +=
                (sender, e) => RunWith("rundll32.exe", $"shell32.dll,OpenAs_RunDLL {_path}");
        }
Esempio n. 10
0
 public void Prepare(string path, ContextObject context)
 {
     //comment by gh - I need larger size
     //context.SetPreferredSizeFit(new Size {Width = 800, Height = 800}, 0.8);
     //----------------//
     context.SetPreferredSizeFit(new Size {
         Width = 1200, Height = 800
     }, 0.9);
 }
Esempio n. 11
0
        public void Given_ContextObject_When_NullObjectInPathExists_Then_ShouldResultInNull()
        {
            var obj = new ContextObject(new Container {
                X = new Child {
                }
            });

            Assert.IsNull(obj.GetObject("X.Y.Z"));
        }
        public void Prepare(string path, ContextObject context)
        {
            _fitsImagePtr = NativeMethods.FitsImageCreate(path);
            ImageDim outputDim = NativeMethods.FitsImageGetOutputDim(_fitsImagePtr);

            var size = new Size(outputDim.nx, outputDim.ny);

            context.SetPreferredSizeFit(size, 0.8);
        }
Esempio n. 13
0
        public void Cleanup()
        {
            GC.SuppressFinalize(this);

            _pdfControl?.Dispose();
            _pdfControl = null;

            _context = null;
        }
Esempio n. 14
0
        public async Task <ContextObject> GetValue(ContextObject context, ScopeData scopeData)
        {
            await Task.CompletedTask;

            return(new ContextObject(context.Options, ".", context)
            {
                Value = Value
            });
        }
Esempio n. 15
0
 /// <summary>
 ///     是否有效
 /// </summary>
 /// <param name="token"></param>
 /// <returns></returns>
 public override bool IsExpired(Token token)
 {
     using (ContextObject context = new ContextObject(token))
     {
         WSTokenIsExpiredSVProxy proxy = new WSTokenIsExpiredSVProxy();
         proxy.WSTokenDTO = TransToWSTokenDTOData(token);
         return(proxy.Do());
     }
 }
Esempio n. 16
0
        public void View(string path, ContextObject context)
        {
            _panel = new WebpagePanel();
            context.ViewerContent = _panel;
            context.Title         = Path.GetFileName(path);

            _panel.LoadHtml(GenerateMarkdownHtml(path));
            _panel.Dispatcher.Invoke(() => { context.IsBusy = false; }, DispatcherPriority.Loaded);
        }
Esempio n. 17
0
 public void Prepare(string path, ContextObject context)
 {
     //comment by gh - I need larger size
     //context.PreferredSize = new Size { Width = 1300, Height = 500 };
     //----------------
     context.PreferredSize = new Size {
         Width = 1200, Height = 600
     };
 }
Esempio n. 18
0
 public void OnAffordance(ContextObject obj, string name)
 {
     if (obj.HasEntries == true)
     {
         AffordanceRunner runner = 
             this.CurrentUser.GetComponent<AffordanceRunner>();
         runner.RunAffordance(obj.ParentObject, name);
     }
 }
        public void BoundViewSize(string path, ContextObject context)
        {
            _ip = new InfoPanel();

            context.CanResize     = false;
            context.PreferredSize = new Size {
                Width = _ip.Width, Height = _ip.Height
            };
        }
Esempio n. 20
0
        public void View(string path, ContextObject context)
        {
            _panel = new WebpagePanel();
            context.ViewerContent = _panel;
            context.Title         = Path.IsPathRooted(path) ? Path.GetFileName(path) : path;

            _panel.LoadFile(path);
            _panel.Dispatcher.Invoke(() => { context.IsBusy = false; }, DispatcherPriority.Loaded);
        }
Esempio n. 21
0
        public void View(string path, ContextObject context)
        {
            _tvp = new TextViewerPanel(path);

            context.ViewerContent = _tvp;
            context.Title         = $"{Path.GetFileName(path)}";

            context.IsBusy = false;
        }
Esempio n. 22
0
 /// <inheritdoc />
 public override ItemExecutionPromise Render(IByteCounterStream outputStream, ContextObject context,
                                             ScopeData scopeData)
 {
     scopeData.Partials[PartialName] = new MorestachioDocument(ExpressionStart, Enumerable.Empty <ITokenOption>())
     {
         Children = Children
     };
     return(Enumerable.Empty <DocumentItemExecution>().ToPromise());
 }
Esempio n. 23
0
        public void Prepare(string path, ContextObject context)
        {
            context.PreferredSize = new Size {
                Width = 453, Height = 172
            };

            context.Title     = "";
            context.CanResize = false;
        }
Esempio n. 24
0
        public void View(string path, ContextObject context)
        {
            _ip = new ImagePanel(path);

            context.ViewerContent = _ip;
            context.Title         = $"{Path.GetFileName(path)} ({_imageSize.Width} × {_imageSize.Height})";

            context.IsBusy = false;
        }
Esempio n. 25
0
        public void View(string path, ContextObject context)
        {
            _panel = new WebpagePanel();
            context.ViewerContent = _panel;
            context.Title         = Path.GetFileName(path);

            _panel.Navigate(ExtractMailBody(path));
            _panel.Dispatcher.Invoke(() => { context.IsBusy = false; }, DispatcherPriority.Loaded);
        }
Esempio n. 26
0
        public void Prepare(string path, ContextObject context)
        {
            _context = context;
            _path    = path;

            var desiredSize = PdfViewerControl.GetDesiredControlSizeByFirstPage(path);

            context.SetPreferredSizeFit(desiredSize, 0.8);
        }
Esempio n. 27
0
        public void View(string path, ContextObject context)
        {
            var viewer = SyncfusionControl.Open(path);

            context.ViewerContent = viewer;
            context.Title         = $"{Path.GetFileName(path)}";

            context.IsBusy = false;
        }
        public async Task <ContextObject> GetValue(ContextObject context, ScopeData scopeData)
        {
            foreach (var valueDocumentItem in Children.OfType <IValueDocumentItem>())
            {
                context = await valueDocumentItem.GetValue(context, scopeData);
            }

            return(context);
        }
        /// <inheritdoc />
        public async ContextObjectPromise GetValue(ContextObject contextObject, ScopeData scopeData)
        {
            foreach (var expression in Expressions)
            {
                contextObject = await expression.GetValue(contextObject, scopeData);
            }

            return(contextObject);
        }
Esempio n. 30
0
        public void PreviewFile(string file, ContextObject context)
        {
            _control = new PreviewHandlerHost();
            Child    = _control;
            _control.Open(file);

            //SetForegroundWindow(new WindowInteropHelper(context.ViewerWindow).Handle);
            //SetActiveWindow(presenter.Handle);
        }
Esempio n. 31
0
        public void View(string path, ContextObject context)
        {
            _panel = new ArchiveInfoPanel(path);

            context.ViewerContent = _panel;
            context.Title         = $"{Path.GetFileName(path)}";

            context.IsBusy = false;
        }
Esempio n. 32
0
        public void AddObjectAsContextItem()
        {
            ContextObject obj = new ContextObject();
            Logger.SetContextItem("object", obj);

            LogEntry log = CommonUtil.GetDefaultLogEntry();
            log.Category = "MockCategoryOne";
            Logger.Write(log);

            string result = MockLogSink.GetLastEntry().ExtendedProperties["object"].ToString();
            string expected = obj.ToString();
            Assert.AreEqual(expected, result);
        }
            public void can_handle_nullable_reference_key()
            {
                var provider = new DefaultRuleParameterProvider();
                var parameters = provider.GetParameters(typeof(ContextObject));

                var productNameParam = parameters.FirstOrDefault(p => p.Name == "Product.Name");

                // has value
                var context = new ContextObject
                {
                    ProductId = 2
                };

                var productName = productNameParam.ValueResolver.ResolveValue(productNameParam, context);
                Assert.Equal("Product 2", productName);

                // no value
                context = new ContextObject
                {
                    ProductId = null
                };

                productName = productNameParam.ValueResolver.ResolveValue(productNameParam, context);
                Assert.Null(productName);
            }
            public void can_resolve_nested_object_param_values()
            {
                var provider = new DefaultRuleParameterProvider();
                var parameters = provider.GetParameters(typeof(ContextObject));

                var prop1 = parameters.FirstOrDefault(p => p.Name == "Nested.Prop1");
                var prop2 = parameters.FirstOrDefault(p => p.Name == "Nested.Prop2");

                var context = new ContextObject
                {
                    Nested = new NestedContextObject
                    {
                        Prop1 = 10,
                        Prop2 = "Hello World"
                    }
                };

                var prop1Value = prop1.ValueResolver.ResolveValue(prop1, context);
                Assert.NotNull(prop1Value);
                Assert.Equal(typeof(Int32), prop1Value.GetType());
                Assert.Equal(10, prop1Value);

                var prop2Value = prop2.ValueResolver.ResolveValue(prop2, context);
                Assert.NotNull(prop2Value);
                Assert.Equal(typeof(String), prop2Value.GetType());
                Assert.Equal("Hello World", prop2Value);
            }
            public void can_handle_non_nullable_primitive_reference_key()
            {
                var provider = new DefaultRuleParameterProvider();
                var parameters = provider.GetParameters(typeof(ContextObject));

                var productNameParam = parameters.FirstOrDefault(p => p.Name == "RequiredProduct.Name");

                var context = new ContextObject
                {
                    RequiredProductId = 3
                };

                var productName = productNameParam.ValueResolver.ResolveValue(productNameParam, context);
                Assert.Equal("Product 3", productName);
            }
            public void can_handle_null_nested_object()
            {
                var provider = new DefaultRuleParameterProvider();
                var parameters = provider.GetParameters(typeof(ContextObject));

                var prop1 = parameters.FirstOrDefault(p => p.Name == "Nested.Prop1");
                var prop2 = parameters.FirstOrDefault(p => p.Name == "Nested.Prop2");

                var context = new ContextObject
                {
                    Nested = null
                };

                object prop1Value = null;

                Assert.DoesNotThrow(() =>
                {
                    prop1Value = prop1.ValueResolver.ResolveValue(prop1, context);
                });
                Assert.Null(prop1Value);

                object prop2Value = null;

                Assert.DoesNotThrow(() =>
                {
                    prop2Value = prop2.ValueResolver.ResolveValue(prop2, context);
                });
                Assert.Null(prop2Value);
            }
Esempio n. 37
0
		public void AddObjectAsContextItem()
		{
			ContextObject obj = new ContextObject();
			Logger.SetContextItem("object", obj);

			LogEntry log = CommonUtil.GetDefaultLogEntry();
			log.Categories = new string[] { "MockCategoryOne" };
			log.Severity = TraceEventType.Error;
			Logger.Write(log);

			string result = ((LogEntry)MockTraceListener.LastEntry).ExtendedProperties["object"].ToString();
			string expected = obj.ToString();
			Assert.AreEqual(expected, result);
		}
            public void should_return_null_for_invalid_reference_key()
            {
                var provider = new DefaultRuleParameterProvider();
                var parameters = provider.GetParameters(typeof(ContextObject));
                var idParam = parameters.FirstOrDefault(p => p.Name == "RequiredProduct.Id");
                var nameParam = parameters.FirstOrDefault(p => p.Name == "RequiredProduct.Name");

                Assert.NotNull(idParam);
                Assert.NotNull(nameParam);

                var context = new ContextObject
                {
                    RequiredProductId = 5
                };

                var id = nameParam.ValueResolver.ResolveValue(idParam, context);
                var name = nameParam.ValueResolver.ResolveValue(nameParam, context);

                Assert.Null(id);
                Assert.Null(name);
            }
Esempio n. 39
0
 public void AddReceiver(ContextObject co)
 {
     this.receivers.Add(co);
 }