Esempio n. 1
0
        private void OnLoadEvent(Dom.Event e)
        {
            BackgroundImage bgImage = RenderData.BGImage;

            if (bgImage == null)
            {
                return;
            }

            Image = bgImage.Image;

            if (Image == null)
            {
                return;
            }

            float width  = (float)Image.Width;
            float height = (float)Image.Height;

            // Figure out the aspect ratios:
            AspectRatio        = width / height;
            InverseAspectRatio = height / width;

            // Cache w/h:
            RawWidth  = width;
            RawHeight = height;

            // Request layout:
            bgImage.RequestLayout();
        }
Esempio n. 2
0
        void ReleaseDesignerOutlets()
        {
            if (BackgroundImage != null)
            {
                BackgroundImage.Dispose();
                BackgroundImage = null;
            }

            if (ButtonA != null)
            {
                ButtonA.Dispose();
                ButtonA = null;
            }

            if (ButtonB != null)
            {
                ButtonB.Dispose();
                ButtonB = null;
            }

            if (PageTitle != null)
            {
                PageTitle.Dispose();
                PageTitle = null;
            }
        }
Esempio n. 3
0
    /// <summary>
    /// When pressing the "Continue" button in the Pause Menu, the Pause Menu will move away
    /// </summary>
    public void ExitPauseMenu()
    {
        GameUiTweens[0].TweenTarget.DOAnchorPos(new Vector2(0, 0), GameUiTweens[0].TweenTime);
        GameUiTweens[1].TweenTarget.DOAnchorPos(new Vector2(GameUiTweens[1].XPosition, 0), GameUiTweens[1].TweenTime);

        BackgroundImage.DOFade(GameUiTweens[0].Alpha, GameUiTweens[0].TweenTime);
    }
Esempio n. 4
0
        protected override void SetupLayoutConstraints()
        {
            base.SetupLayoutConstraints();

            this.SubviewsDoNotTranslateAutoresizingMaskIntoConstraints();

            this.AddConstraints(BackgroundImage.FullSizeOf(this));

            this.AddConstraints(
                InvalidCredentialsLabel.WithSameLeft(LoginTextField),
                InvalidCredentialsLabel.WithSameRight(LoginTextField),
                InvalidCredentialsLabel.Height().EqualTo(AppDimens.DefaultErrorMessageHeight),
                InvalidCredentialsLabel.Above(LoginTextField, AppDimens.Inset3X));

            this.AddConstraints(
                LoginTextField.AtLeftOf(this, AppDimens.Inset5X),
                LoginTextField.AtRightOf(this, AppDimens.Inset5X),
                LoginTextField.Height().EqualTo(AppDimens.DefaultTextFieldHeight),
                LoginTextField.Above(PasswordTextField, AppDimens.Inset2X));

            this.AddConstraints(
                PasswordTextField.WithSameLeft(LoginTextField),
                PasswordTextField.WithSameCenterY(this),
                PasswordTextField.WithSameRight(LoginTextField),
                PasswordTextField.Height().EqualTo(AppDimens.DefaultTextFieldHeight));

            this.AddConstraints(
                LoginButton.AtLeftOf(this, AppDimens.Inset8X),
                LoginButton.AtRightOf(this, AppDimens.Inset8X),
                LoginButton.Below(PasswordTextField, AppDimens.Inset2X),
                LoginButton.Height().EqualTo(AppDimens.DefaultButtonHeight));
        }
Esempio n. 5
0
    public void Start()
    {
        orientation = Input.deviceOrientation;

        updateOrientation();

        int index = 0;

        foreach (GameObject button in MenuButtons)
        {
            float         xPos    = Mathf.Round((ButtonWidth * 1.5f) * index);
            RectTransform btnRect = button.GetComponent <RectTransform>();
            btnRect.sizeDelta = new Vector2(ButtonWidth, ButtonWidth);

            button.transform.localPosition = new Vector3(xPos, 0, 0);
            index++;
        }

        LeanTween.scale(BackgroundImage.GetComponent <RectTransform>(), new Vector2(1.2f, 1.2f), 30f)
        .setLoopPingPong()
        .setEaseInOutQuint();

        //Debug.Log("***** canvasResX: "+canvasResX+" | canvasResY: "+canvasResY+" | canvasWidth: "+canvasWidth);
        //Debug.Log("***** screenWidth: "+Screen.width+" | screenHeight: "+Screen.height);

        Invoke("screenSelect", 2f);
    }
Esempio n. 6
0
        private void OnDraw(object sender, DrawToolTipEventArgs e) // use this event to customise the tool tip
        {
            // Set our background
            Graphics g      = e.Graphics;
            var      n      = BackgroundImage.Clone() as Bitmap;
            var      rectSz = e.Bounds.Size;

            n = ResizeBitmap(n, rectSz.Width, rectSz.Height);
            g.Clear(Color.FromArgb(50, 50, 50));
            g.DrawImage(n, 0, 0);
            e.DrawBorder();

            // Draw our ToolTip title
            var rectF = new RectangleF(new PointF(8, TitleFont.Height + 10), new Size(tSize.Width - 8, tSize.Height));

            if (MaxWidth != 0)
            {
                g.DrawString(ToolTipDescription, DescriptionFont, DescriptionBrush, rectF);
            }
            else
            {
                g.DrawString(ToolTipDescription, DescriptionFont, DescriptionBrush, rectF.Location);
            };
            g.DrawString((Prefix + this.ToolTipTitle + Suffix).Trim('\n'), TitleFont, TitleBrush, new PointF(6, 4));
        }
Esempio n. 7
0
 public void Dispose()
 {
     if (BackgroundImage != null)
     {
         BackgroundImage.Dispose();
     }
 }
        /// <summary> Method is called whenever this form is resized. </summary>
        /// <param name="e"></param>
        /// <remarks> This redraws the background of this form </remarks>
        protected override void OnResize(EventArgs e)
        {
            base.OnResize(e);

            // Get rid of any current background image
            if (BackgroundImage != null)
            {
                BackgroundImage.Dispose();
                BackgroundImage = null;
            }

            if (ClientSize.Width > 0)
            {
                // Create the items needed to draw the background
                Bitmap    image = new Bitmap(ClientSize.Width, ClientSize.Height);
                Graphics  gr    = Graphics.FromImage(image);
                Rectangle rect  = new Rectangle(new Point(0, 0), ClientSize);

                // Create the brush
                LinearGradientBrush brush = new LinearGradientBrush(rect, SystemColors.Control, ControlPaint.Dark(SystemColors.Control), LinearGradientMode.Vertical);
                brush.SetBlendTriangularShape(0.33F);

                // Create the image
                gr.FillRectangle(brush, rect);
                gr.Dispose();

                // Set this as the backgroundf
                BackgroundImage = image;
            }
        }
Esempio n. 9
0
        public virtual void Draw(ShaderProgram shader, VAO vao, GameWindow gw)
        {
            shader.SetUniform("rect", GlobalBounds);
            shader.SetUniform("color", BackgroundColor);
            shader.SetUniform("borderWidth", BorderWidth);
            shader.SetUniform("borderColor", BorderColor);

            if (BackgroundImage != null)
            {
                BackgroundImage.Bind();
                shader.SetUniform("useTexture", true);
            }
            else
            {
                shader.SetUniform("useTexture", false);
            }

            vao.DrawArrays(OpenTK.Graphics.OpenGL.PrimitiveType.TriangleStrip);

            var temp = this as IText;

            if (temp != null && !string.IsNullOrWhiteSpace(temp.Text))
            {
                GuiManager.setScisor(GlobalBounds, BorderWidth, gw, Parent);
                temp.TextImage.Bind();
                shader.SetUniform("useTexture", true);
                shader.SetUniform("rect", temp.TextBounds);
                shader.SetUniform("borderWidth", 0);

                vao.DrawArrays(OpenTK.Graphics.OpenGL.PrimitiveType.TriangleStrip);
            }
        }
        public RepoDetailView()
        {
            this.InitializeComponent();
            ViewModel        = new RepoDetailViewmodel();
            this.DataContext = ViewModel;

            // Adjust the UI to make sure the text is readable
            Messenger.Default.Register <GlobalHelper.SetBlurredAvatarUIBrightnessMessageType>(this, b =>
            {
                if (Application.Current.RequestedTheme == ApplicationTheme.Light && b.Brightness <= 80)
                {
                    byte delta                  = (byte)(128 - b.Brightness + 24);
                    Color color                 = Color.FromArgb(byte.MaxValue, delta, delta, delta);
                    SolidColorBrush brush       = new SolidColorBrush(color);
                    RepoName.Foreground         = brush;
                    ProfileLinkBlock.Foreground = brush;
                    FavoriteIcon.Foreground     = brush;
                    FavoriteBlock.Foreground    = brush;
                    BranchPath.Fill             = brush;
                    BranchBlock.Foreground      = brush;
                }
                else if (Application.Current.RequestedTheme == ApplicationTheme.Dark && b.Brightness >= 180)
                {
                    double opacity = 1.0 - b.Brightness * 0.5 / 255;
                    BackgroundImage.StartCompositionFadeAnimation(null, (float)opacity, 200, null, EasingFunctionNames.Linear);
                }
            });
        }
Esempio n. 11
0
 private void Initialized()
 {
     //绑定事件
     if (BackgroundImage != null)
     {
         UIRockerEventView view = BackgroundImage.GetComponent <UIRockerEventView>();
         if (view != null)
         {
             view.OnRockerBeginDragEvent += OnRoeckerBeginDragEvent;
             view.OnRockerDragEvent      += OnRoeckerDragEvent;
             view.OnRockerEndDragEvent   += OnRoeckerEndDragEvent;
             view.OnRockerPointDownEvent += OnRoeckerBeginDragEvent;
             view.OnRockerPointUpEvent   += OnRoeckerEndDragEvent;
         }
     }
     if (CenterImage != null)
     {
         UIRockerEventView view = CenterImage.GetComponent <UIRockerEventView>();
         if (view != null)
         {
             view.OnRockerBeginDragEvent += OnRoeckerBeginDragEvent;
             view.OnRockerDragEvent      += OnRoeckerDragEvent;
             view.OnRockerEndDragEvent   += OnRoeckerEndDragEvent;
             view.OnRockerPointDownEvent += OnRoeckerBeginDragEvent;
             view.OnRockerPointUpEvent   += OnRoeckerEndDragEvent;
         }
     }
 }
Esempio n. 12
0
        public ActionResult UploadBackgroundImage(HttpPostedFileBase image)
        {
            if (image != null)
            {
                BackgroundImage im = new BackgroundImage
                {
                    ImageMimeType = image.ContentType,
                    ImageData     = new byte[image.ContentLength]
                };
                image.InputStream.Read(im.ImageData, 0, image.ContentLength);


                repo.SaveBckgr(im);
                TempData["Confirm"] = "The image has been saved";
            }
            else
            {
                TempData["Fail"] = "Failed to save image";
            }


            return(View("Index", new PagingInfo
            {
                PageSize = pageSize,
                Products = repo.Products
                           .OrderBy(p => p.ProductID)
                           .Take(pageSize),
                TotalItems = repo.Products.Count()
            }
                        ));
        }
Esempio n. 13
0
        public async Task <BackgroundImage> GetBackgroundImageAsync()
        {
            DateTimeOffset now = DateTimeOffset.UtcNow;

#if DEBUG
            if ((now - this._lastChange).TotalSeconds > 30) // DEBUG: every 30s
#else
            if (now.Day != this._lastChange.Day)            // RELEASE: change on first request after midnight
#endif
            {
                this._logger.LogInformation("Fetching new background...");
                this._lastChange = now;
                if (this._nextBackgrounds.Count == 0) // generate random queue of next images
                {
                    this.FillBackgroundsQueue();
                }
                // async copy to local disk of the next background image
                this._lastImage = await this.CopyNextBackgroundToLocalCacheAsync();
            }

            Models.OpenStreetMap.GeoLocation location = this._lastImage?.Location;
            if (location != null && this._lastImage.LocationDisplayString == null)
            {
                this._lastImage.LocationDisplayString =
                    await this._geoCodingService.ReverseGeoCodingAsync(location);
            }

            return(this._lastImage);
        }
Esempio n. 14
0
        private void UpdateBackgroundImage()
        {
            var bmp = new Bitmap(
                Width,
                Height,
                PixelFormat.Format32bppArgb);

            using (var grf = Graphics.FromImage(bmp))
            {
                grf.Clear(Color.Fuchsia);

                var pen = new Pen(DefaultBorderColor, 3f);
                //pen.Alignment = PenAlignment.Inset;

                var rect = new Rectangle(0, 0, Width, Height);
                grf.DrawRectangle(pen, rect);
            }

            if (BackgroundImage != null)
            {
                BackgroundImage.Dispose();
                BackgroundImage = null;
            }

            BackgroundImage = bmp;
        }
Esempio n. 15
0
 private void RedrawMap()
 {
     Log.Write("{0}: Rendering Map", GetType().Name);
     BackgroundImage.Dispose();
     if (F != null)
     {
         using (var BMP = MapRender.RenderFile(F))
         {
             //Add file info string
             using (var G = Graphics.FromImage(BMP))
             {
                 var Info = string.Format("{0}: {1} {2}",
                                          Path.GetFileName(FileName),
                                          DateTime.Now.ToShortDateString(),
                                          DateTime.Now.ToShortTimeString());
                 using (var F = new Font("Arial", 16))
                 {
                     var Pos = G.MeasureString(Info, F);
                     G.DrawString(
                         Info, F,
                         Brushes.Red,
                         (int)(BMP.Width - Pos.Width),
                         (int)(BMP.Height - Pos.Height));
                 }
             }
             BackgroundImage = new Bitmap(BMP);
             BMP.Save(Path.ChangeExtension(FileName, "png"));
         }
     }
     else
     {
         BackgroundImage = MapRender.GetMap();
     }
 }
Esempio n. 16
0
        protected override void SetupLayoutConstraints()
        {
            base.SetupLayoutConstraints();

            this.SubviewsDoNotTranslateAutoresizingMaskIntoConstraints();

            this.AddConstraints(
                BackgroundImage.FullSizeOf(this));

            this.AddConstraints(
                LoginField.AtTopOf(this, 220),
                LoginField.AtLeadingOf(this, 50),
                LoginField.AtTrailingOf(this, 50),
                LoginField.Height().EqualTo(Theme.Dimensions.TextFieldHeight),

                PasswordField.Below(LoginField, 12),
                PasswordField.WithSameLeading(LoginField),
                PasswordField.WithSameWidth(LoginField),
                PasswordField.WithSameHeight(LoginField),

                SignInButton.Below(PasswordField, 16),
                SignInButton.WithSameCenterX(this),
                SignInButton.Width().EqualTo(218),
                SignInButton.Height().EqualTo(44),

                ErrorMessageView.Above(LoginField, 36),
                ErrorMessageView.WithSameLeading(LoginField),
                ErrorMessageView.WithSameWidth(LoginField),

                ErrorMessageTriangleImage.Below(ErrorMessageView),
                ErrorMessageTriangleImage.WithSameCenterX(this));
        }
Esempio n. 17
0
        internal void PopulateElement(Element_TileBinding binding, TileSize size)
        {
            // Assign properties
            binding.TextStacking = TextStacking;

            // Add the background image if there's one
            if (BackgroundImage != null)
            {
                // And add it as a child
                binding.Children.Add(BackgroundImage.ConvertToElement());
            }

            // Add the peek image if there's one
            if (PeekImage != null)
            {
                var el = PeekImage.ConvertToElement();

                binding.Children.Add(el);
            }

            // And then add all the children
            foreach (var child in Children)
            {
                binding.Children.Add(ConvertToBindingChildElement(child));
            }
        }
Esempio n. 18
0
 private void LoadUserSettings()
 {
     try
     {
         txtUser.Text = Settings.Instance.Username;
         if (Settings.Instance.WantSavePassword)
         {
             txtPass.Text = UwpHelper.GetPassword();
         }
     }
     catch (Exception ex)
     {
         Log.Error(ex);
     }
     // Read user settings
     if (Settings.Instance.WantCursor) // Old Toontown Cursors
     {
         MemoryStream cursorMemoryStream = new MemoryStream(Properties.Resources.toonmono);
         Cursor = new Cursor(cursorMemoryStream);
     }
     // Load last saved user background choice
     BackgroundImage.Dispose();
     if (Settings.Instance.WantRandomBackgrounds)
     {
         BackgroundImage = Background.ReturnRandomBackground();
     }
     else
     {
         BackgroundImage = Background.ReturnBackground(Settings.Instance.Background);
     }
 }
Esempio n. 19
0
        //no instance required
        /// <summary>Calculates width and height values for image with a given area params.</summary>
        /// <param name="image">
        /// the
        /// <see cref="iText.Layout.Properties.BackgroundImage"/>
        /// width and height of which you want to calculate
        /// </param>
        /// <param name="areaWidth">width of the area of this images</param>
        /// <param name="areaHeight">height of the area of this images</param>
        /// <returns>array of two Float values. NOTE that first value defines width, second defines height.</returns>
        /// <seealso cref="iText.Layout.Properties.BackgroundSize"/>
        public static float[] CalculateBackgroundImageSize(BackgroundImage image, float areaWidth, float areaHeight
                                                           )
        {
            bool           isGradient = image.GetLinearGradientBuilder() != null;
            BackgroundSize size;

            if (!isGradient && image.GetBackgroundSize().IsSpecificSize())
            {
                size = CalculateBackgroundSizeForArea(image, areaWidth, areaHeight);
            }
            else
            {
                size = image.GetBackgroundSize();
            }
            UnitValue width  = size.GetBackgroundWidthSize();
            UnitValue height = size.GetBackgroundHeightSize();

            float?[] widthAndHeight = new float?[2];
            if (width != null && width.GetValue() >= 0)
            {
                bool needScale = !isGradient && height == null;
                CalculateBackgroundWidth(width, areaWidth, needScale, image, widthAndHeight);
            }
            if (height != null && height.GetValue() >= 0)
            {
                bool needScale = !isGradient && width == null;
                CalculateBackgroundHeight(height, areaHeight, needScale, image, widthAndHeight);
            }
            SetDefaultSizeIfNull(widthAndHeight, areaWidth, areaHeight, image, isGradient);
            return(new float[] { (float)widthAndHeight[0], (float)widthAndHeight[1] });
        }
Esempio n. 20
0
 private void CaptureBackgroundDialog_FormClosing(object sender, FormClosingEventArgs e)
 {
     if (BackgroundImage != null)
     {
         BackgroundImage.Dispose();
     }
 }
Esempio n. 21
0
    void DisplayBackgroundImageButtons()
    {
        Store store = setting as Store;

        for (int i = 0; i < backgroundImageButtons.Count; i++)
        {
            BackgroundImage bi = Store.backgroundImages[(BackgroundImageTypes)i];
            Button          b  = buttons[3][i];

            Image backgroundImage = b.transform.Find("Background Image").gameObject.GetComponent <Image>();
            Text  message         = b.transform.Find("Buy Button").GetChild(0).GetComponent <Text>();
            Text  price           = b.transform.Find("Buy Button").GetChild(1).GetComponent <Text>();
            Image moneyIcon       = b.transform.Find("Buy Button").GetChild(2).GetComponent <Image>();

            backgroundImage.sprite = bi.sprite;
            backgroundImage.color  = bi.color;

            if (store.IsUnlocked((BackgroundImageTypes)i))
            {
                message.text      = "Bought";
                price.text        = "";
                moneyIcon.enabled = false;
            }
            else
            {
                message.text      = "";
                price.text        = bi.price.ToString();
                moneyIcon.enabled = true;
            }
        }
    }
Esempio n. 22
0
        private static void ScaleHeight(float newHeight, BackgroundImage image, float?[] imageWidthAndHeight)
        {
            float difference = image.GetImageHeight() == 0f ? 1f : newHeight / image.GetImageHeight();

            imageWidthAndHeight[0] = image.GetImageWidth() * difference;
            imageWidthAndHeight[1] = newHeight;
        }
Esempio n. 23
0
        private void 保存toolStripMenuItem_Click(object sender, EventArgs e)
        {
            var saveFileDialog = new SaveFileDialog();

            saveFileDialog.Filter           = "jpg图片(*.jpg)|*.jpg|png图片(*.png)|*.jpg|bmp图片(*.bmp)|*.bmp";
            saveFileDialog.AddExtension     = false;
            saveFileDialog.FileName         = string.Concat("tianruo_", DateTime.Now.Year.ToString(), "-", DateTime.Now.Month.ToString(), "-", DateTime.Now.Day.ToString(), "-", DateTime.Now.Ticks.ToString());
            saveFileDialog.Title            = "保存图片";
            saveFileDialog.FilterIndex      = 1;
            saveFileDialog.RestoreDirectory = true;
            var flag = saveFileDialog.ShowDialog() == DialogResult.OK;

            if (flag)
            {
                var extension = Path.GetExtension(saveFileDialog.FileName);
                var flag2     = extension.Equals(".jpg");
                if (flag2)
                {
                    BackgroundImage.Save(saveFileDialog.FileName, ImageFormat.Jpeg);
                }
                var flag3 = extension.Equals(".png");
                if (flag3)
                {
                    BackgroundImage.Save(saveFileDialog.FileName, ImageFormat.Png);
                }
                var flag4 = extension.Equals(".bmp");
                if (flag4)
                {
                    BackgroundImage.Save(saveFileDialog.FileName, ImageFormat.Bmp);
                }
            }
        }
        private static void ApplyBackgroundSize(IList <IList <String> > backgroundProperties, float em, float rem, int
                                                imageIndex, BackgroundImage image)
        {
            if (backgroundProperties == null || backgroundProperties.IsEmpty())
            {
                return;
            }
            if (image.GetForm() != null && (image.GetImageHeight() == 0f || image.GetImageWidth() == 0f))
            {
                return;
            }
            IList <String> backgroundSizeValues = backgroundProperties[GetBackgroundSidePropertyIndex(backgroundProperties
                                                                                                      .Count, imageIndex)];

            if (backgroundSizeValues.Count == 2 && CommonCssConstants.AUTO.Equals(backgroundSizeValues[1]))
            {
                backgroundSizeValues.JRemoveAt(1);
            }
            if (backgroundSizeValues.Count == 1)
            {
                String widthValue = backgroundSizeValues[0];
                ApplyBackgroundWidth(widthValue, image, em, rem);
            }
            if (backgroundSizeValues.Count == 2)
            {
                ApplyBackgroundWidthHeight(backgroundSizeValues, image, em, rem);
            }
        }
        internal void PopulateElement(Element_TileBinding binding, TileSize size)
        {
            // Assign properties
            binding.TextStacking = TextStacking;

            // Add the background image if there's one
            if (BackgroundImage != null)
            {
                // We pull up the overlay value from there
                binding.Overlay = BackgroundImage.Overlay;

                // And add it as a child
                binding.Children.Add(BackgroundImage.ConvertToElement());
            }

            // Add the peek image if there's one
            if (PeekImage != null)
            {
                var el = PeekImage.ConvertToElement();

                // If peek overlay needs to be specified
                if (ShouldSpecifyPeekOverlay(binding, PeekImage))
                {
                    el.Overlay = PeekImage.Overlay;
                }

                binding.Children.Add(el);
            }

            // And then add all the children
            foreach (var child in Children)
            {
                binding.Children.Add(ConvertToBindingChildElement(child));
            }
        }
Esempio n. 26
0
        public override void OnComputeBox(Renderman renderer, Css.LayoutBox box, ref bool widthUndefined, ref bool heightUndefined)
        {
            if (document is SVGDocument)
            {
                return;
            }

            // Occurs on inline SVG's.

            // Set the size:
            Context.SetSize((int)box.InnerWidth, (int)box.InnerHeight);

            UnityEngine.Texture tex = Context.Texture;

            if (tex == null)
            {
                return;
            }

            // Update the background raw image:
            BackgroundImage img = RenderData.BGImage;

            if (img == null)
            {
                img = new Css.BackgroundImage(RenderData);
                RenderData.BGImage = img;
            }

            // Update the bg image:
            img.UpdateImage(tex);
        }
 private void AnimateOut()
 {
     BackgroundImage.LayoutTo(new Rectangle(0, 0, Width, 100), 250, Easing.SpringIn);
     PersonImage.TranslateTo(0, 0, 250, Easing.SpringIn);
     PickPersonPhotoImage.TranslateTo(0, 0, 250, Easing.SpringIn);
     PersonInfoLayout.TranslateTo(0, 0, 250, Easing.SpringIn);
 }
Esempio n. 28
0
        private void Window_Loaded(object sender, RoutedEventArgs e)
        {
            DpiScale = PresentationSource.FromVisual(this).CompositionTarget.TransformToDevice.M11;
            labelHeader.Visibility   = Visibility.Visible;
            borderCapture.Visibility = Visibility.Visible;
            this.Width  = SystemParameters.VirtualScreenWidth;
            this.Height = SystemParameters.VirtualScreenHeight;
            this.Left   = SystemParameters.VirtualScreenLeft;
            this.Top    = SystemParameters.VirtualScreenTop;

            if (captureMode == Models.CaptureMode.PNG)
            {
                using (var ms = new MemoryStream())
                {
                    BackgroundImage.Save(ms, System.Drawing.Imaging.ImageFormat.Png);
                    var bi = new BitmapImage();
                    bi.BeginInit();
                    bi.StreamSource = ms;
                    bi.CacheOption  = BitmapCacheOption.OnLoad;
                    bi.EndInit();
                    bi.Freeze();
                    gridMain.Background = new ImageBrush(bi);
                }
            }
            FrameWindowUnderCursor();
            this.Activate();
        }
Esempio n. 29
0
        /// <summary>
        /// Ends drag/resize operations and commits changes
        /// </summary>
        private void EndOperations()
        {
            this.Visible = false;
            Capture      = false;

            if (_control != null)
            {
                Point newP = _control.Parent.PointToClient(this.Location);

                //clamp it to (0,0)
                newP.X = Math.Max((_control.Parent as Panel).AutoScrollPosition.X, newP.X);
                newP.Y = Math.Max((_control.Parent as Panel).AutoScrollPosition.Y, newP.Y);

                (_control.Parent as DaggerUIGraph).BeginCanvasUpdate();
                _control.Location = newP;
                _control.Size     = this.Size;
                (_control.Parent as DaggerUIGraph).EndCanvasUpdate();
            }
            else
            {
                Point oldP = _multiControls[0].Parent.PointToClient(_multiControlCurrentLocation);
                Point newP = _multiControls[0].Parent.PointToClient(this.Location);

                //clamp it to (0,0)
                newP.X = Math.Max((_multiControls[0].Parent as Panel).AutoScrollPosition.X, newP.X);
                newP.Y = Math.Max((_multiControls[0].Parent as Panel).AutoScrollPosition.Y, newP.Y);

                // translate the controls to new locations
                int offx = newP.X - oldP.X;
                int offy = newP.Y - oldP.Y;

                // pause updating of noodles and nodes
                (_multiControls[0].Parent as DaggerUIGraph)._noodles.BeginUpdate();
                (_multiControls[0].Parent as DaggerUIGraph).BeginCanvasUpdate();

                foreach (Control c in _multiControls)
                {
                    c.Location = new Point(c.Location.X + offx, c.Location.Y + offy);
                }

                // resume updating of noodles and nodes and refresh graph
                (_multiControls[0].Parent as DaggerUIGraph)._noodles.EndUpdate();
                (_multiControls[0].Parent as DaggerUIGraph).EndCanvasUpdate();

                // we made our own temp region for multi controls so dispose of it here
                Region = null;
                _multiControlRegion.Dispose();
                _multiControlRegion = null;
            }

            // dispose of the Background image if we created one
            if (BackgroundImage != null)
            {
                BackgroundImage.Dispose();
                BackgroundImage = null;
            }

            this.Close();
        }
Esempio n. 30
0
        public object Clone()
        {
            PmsPageSplitter layout = new PmsPageSplitter();

            layout.Name      = Name;
            layout.AutoSize  = AutoSize;
            layout.BackColor = BackColor;
            if (null != BackgroundImage)
            {
                layout.BackgroundImage = BackgroundImage.Clone() as Image;
            }
            layout.BackgroundImageLayout = BackgroundImageLayout;
            if (null != Border)
            {
                layout.Border = Border.Clone() as ElementBorder;
                layout.Border.OwnerElement = layout;
            }
            layout.BorderName = BorderName;
            if (null != ExternDatas)
            {
                layout.ExternDatas = new List <ExternData>();
                foreach (ExternData ed in ExternDatas)
                {
                    object value = ed.Value;
                    if (null != value && value is ICloneable)
                    {
                        value = ((ICloneable)value).Clone();
                    }
                    layout.ExternDatas.Add(new ExternData(ed.Key, value));
                }
            }
            if (null != Font)
            {
                layout.Font = Font.Clone() as Font;
            }
            layout.HasBorder         = HasBorder;
            layout.HasBottomBorder   = HasBottomBorder;
            layout.HasLeftBorder     = HasLeftBorder;
            layout.HasRightBorder    = HasRightBorder;
            layout.HasTopBorder      = HasTopBorder;
            layout.Height            = Height;
            layout.HorizontalScale   = HorizontalScale;
            layout.Location          = Location;
            layout.MESType           = MESType;
            layout.MoveX             = MoveX;
            layout.MoveY             = MoveY;
            layout.Text              = Text;
            layout.VerticalScale     = VerticalScale;
            layout.Width             = Width;
            layout.Visible           = Visible;
            layout.MESType           = MESType;
            layout.EnableSplitter    = EnableSplitter;
            layout.VisibleExpression = VisibleExpression;
            if (null != ((IElement)this).ExtendObject)
            {
                ((IElement)layout).ExtendObject = ((IElement)this).ExtendObject.Clone() as ExtendObject;
            }
            return(layout);
        }
Esempio n. 31
0
        public Level1(Player player, BackgroundImage image, Texture2D windowTexture, SpriteFont scoreFont)
            : base(player, scoreFont)
        {
            this.windowTexture = windowTexture;
            Player.Position = new Vector2(40, 357);
            Sprites.Insert(0, image);
            AddAllWindows();

            Sprites.AddRange(windows.Cast<IComponent>());
        }