private void InitializeWidget(LayoutOrientation orientation)
        {
            TitleImage = new ImageBox();
            TitleImage.Name = "TitleImage";
            TouchToStartText = new Label();
            TouchToStartText.Name = "TouchToStartText";

            // TitleImage
            TitleImage.Image = new ImageAsset("/Application/assets/images/UI/header.png");
            TitleImage.ImageScaleType = ImageScaleType.Center;

            // TouchToStartText
            TouchToStartText.TextColor = new UIColor(255f / 255f, 255f / 255f, 255f / 255f, 255f / 255f);
            TouchToStartText.Font = new UIFont(FontAlias.System, 25, FontStyle.Regular);
            TouchToStartText.LineBreak = LineBreak.Character;
            TouchToStartText.HorizontalAlignment = HorizontalAlignment.Center;

            // TitleScene
            this.RootWidget.AddChildLast(TitleImage);
            this.RootWidget.AddChildLast(TouchToStartText);
            this.Showing += new EventHandler(onShowing);
            this.Shown += new EventHandler(onShown);

            SetWidgetLayout(orientation);

            UpdateLanguage();
        }
		public void SelectDisplaySet()
		{
			IDisplaySet displaySet1 = new DisplaySet();
			displaySet1.PresentationImages.Add(new TestPresentationImage());
			displaySet1.PresentationImages.Add(new TestPresentationImage());
			displaySet1.PresentationImages.Add(new TestPresentationImage());
			displaySet1.PresentationImages.Add(new TestPresentationImage());

			IDisplaySet displaySet2 = new DisplaySet();
			displaySet2.PresentationImages.Add(new TestPresentationImage());
			displaySet2.PresentationImages.Add(new TestPresentationImage());

			IImageViewer viewer = new ImageViewerComponent();
			IImageBox imageBox = new ImageBox();
			viewer.PhysicalWorkspace.ImageBoxes.Add(imageBox);

			imageBox.SetTileGrid(2, 2);
			imageBox.DisplaySet = displaySet1;
			imageBox[0, 0].Select();

			Assert.IsTrue(imageBox[0, 0].Selected);
			Assert.IsFalse(imageBox[0, 1].Selected);

			imageBox[0, 1].Select();
			Assert.IsFalse(imageBox[0, 0].Selected);
			Assert.IsTrue(imageBox[0, 1].Selected);

			imageBox.DisplaySet = displaySet2;
			Assert.IsFalse(imageBox[0, 0].Selected);
			Assert.IsTrue(imageBox[0, 1].Selected);
		}
		public void SetDisplaySet()
		{
			ImageBox imageBox = new ImageBox();
			IDisplaySet displaySet1 = new DisplaySet();
			IDisplaySet displaySet2 = new DisplaySet();
			PresentationImage image1 = new TestPresentationImage();
			PresentationImage image2 = new TestPresentationImage();
			displaySet1.PresentationImages.Add(image1);
			displaySet2.PresentationImages.Add(image2);

			imageBox.DisplaySet = displaySet1;
			Assert.IsTrue(displaySet1.Visible);
			Assert.AreEqual(imageBox, displaySet1.ImageBox);

			imageBox.DisplaySet = null;
			Assert.IsFalse(displaySet1.Visible);
			Assert.IsNull(displaySet1.ImageBox);

			imageBox.DisplaySet = displaySet1;
			Assert.IsTrue(displaySet1.Visible);
			Assert.AreEqual(imageBox, displaySet1.ImageBox);

			imageBox.DisplaySet = displaySet2;
			Assert.IsTrue(displaySet2.Visible);
			Assert.IsFalse(displaySet1.Visible);
			Assert.AreEqual(imageBox, displaySet2.ImageBox);
			Assert.IsNull(displaySet1.ImageBox);
		}
Esempio n. 4
0
		public void ReplaceDisplaySet()
		{
			IDisplaySet displaySet1 = new DisplaySet();
			IPresentationImage image1 = new TestPresentationImage();
			displaySet1.PresentationImages.Add(image1);

			IDisplaySet displaySet2 = new DisplaySet();
			IPresentationImage image2 = new TestPresentationImage();
			displaySet2.PresentationImages.Add(image2);

			ImageViewerComponent viewer = new ImageViewerComponent();

			IImageBox imageBox1 = new ImageBox();
			viewer.PhysicalWorkspace.ImageBoxes.Add(imageBox1);

			imageBox1.SetTileGrid(2, 2);
			imageBox1.DisplaySet = displaySet1;
			imageBox1[0,0].Select();

			Assert.IsTrue(displaySet1.Selected);
			Assert.IsTrue(image1.Selected);

			imageBox1.DisplaySet = displaySet2;

			Assert.IsFalse(displaySet1.Selected);
			Assert.IsFalse(image1.Selected);

			Assert.IsTrue(displaySet2.Selected);
			Assert.IsTrue(image2.Selected);

		}
        private void InitializeWidget(LayoutOrientation orientation)
        {
            ImageBox_1 = new ImageBox();
            ImageBox_1.Name = "ImageBox_1";
            Button_1 = new Button();
            Button_1.Name = "Button_1";

            // ImageBox_1
            ImageBox_1.Image = new ImageAsset("/Application/assets/stageClear.png");
            ImageBox_1.ImageScaleType = ImageScaleType.Center;

            // Button_1
            Button_1.TextColor = new UIColor(255f / 255f, 255f / 255f, 255f / 255f, 255f / 255f);
            Button_1.TextFont = new UIFont(FontAlias.System, 25, FontStyle.Regular);
            Button_1.Alpha = 1;
            Button_1.Style = ButtonStyle.Custom;
            Button_1.CustomImage = new CustomButtonImageSettings(){
                BackgroundNormalImage = null,
                BackgroundPressedImage = null,
            };

            // GameOverScene
            this.RootWidget.AddChildLast(ImageBox_1);
            this.RootWidget.AddChildLast(Button_1);

            this.Transition = new CrossFadeTransition();

            SetWidgetLayout(orientation);

            UpdateLanguage();
        }
		public MenuScene ()
		{
			this.Camera.SetViewFromViewport();
			Sce.PlayStation.HighLevel.UI.Panel dialog = new Panel();
			dialog.Width = Director.Instance.GL.Context.GetViewport().Width;
			dialog.Height = Director.Instance.GL.Context.GetViewport().Height;
			
			ImageBox ib = new ImageBox();
			ib.Width = dialog.Width;
			ib.Image = new ImageAsset("/Application/images/title.png", false);
			ib.Height = dialog.Height;
			ib.SetPosition(0.0f, 0.0f);
			
			Button buttonPlay = new Button();
			buttonPlay.Name = "buttonPlay";
			buttonPlay.Text = "Play Game";
			buttonPlay.Width = 300;
			buttonPlay.Height = 50;
			buttonPlay.Alpha = 0.8f;
			buttonPlay.SetPosition(dialog.Width/2.0f - buttonPlay.Width/2.0f, 220.0f); 
			buttonPlay.TouchEventReceived += OnButtonPlay;
			
			dialog.AddChildLast(ib);
			dialog.AddChildLast(buttonPlay);
			m_uiScene = new Sce.PlayStation.HighLevel.UI.Scene();
			m_uiScene.RootWidget.AddChildLast(dialog);
			UISystem.SetScene(m_uiScene);
			Scheduler.Instance.ScheduleUpdateForTarget(this, 0, false);
		}
Esempio n. 7
0
        public PersonPanel(Rectangle boundingBox)
            : base(MediaRepository.Textures["Blank"], boundingBox, Color.TransparentWhite)
        {
            professionToString = new Dictionary<Person.ProfessionType, string>();
            professionToString[Person.ProfessionType.Doctor] = "Doctor";
            professionToString[Person.ProfessionType.Educator] = "Educator";
            professionToString[Person.ProfessionType.Environmentalist] = "Environmentalist";
            professionToString[Person.ProfessionType.Scientist] = "Scientist";
            professionToString[Person.ProfessionType.Worker] = "Worker";

            professionToColor = new Dictionary<Person.ProfessionType, Color>();
            professionToColor[Person.ProfessionType.Doctor] = Color.Red;
            professionToColor[Person.ProfessionType.Educator] = Color.Yellow;
            professionToColor[Person.ProfessionType.Environmentalist] = Color.Green;
            professionToColor[Person.ProfessionType.Scientist] = Color.Blue;
            professionToColor[Person.ProfessionType.Worker] = Color.Gray;

            title = new TextBox(new Rectangle(45, 10, 50, 25), "Person", Color.White, TextBox.AlignType.Left);
            movementBar = new StatusBar(new Rectangle(125, 40, 150, 10), Color.Green, Color.White);
            educationBar = new StatusBar(new Rectangle(125, 65, 150, 10), new Color(200, 200, 0), Color.White);
            healthBar = new StatusBar(new Rectangle(125, 90, 150, 10), Color.Red, Color.White);

            professionIcon = new ImageBox(new Rectangle(25, 15, 10, 10), Color.White);

            AddComponent(title);
            AddComponent(new TextBox(new Rectangle(25, 40, 100, 10), "Movement:", Color.Black, TextBox.AlignType.Left));
            AddComponent(movementBar);
            AddComponent(new TextBox(new Rectangle(25, 65, 100, 10), "Education:", Color.Black, TextBox.AlignType.Left));
            AddComponent(educationBar);
            AddComponent(new TextBox(new Rectangle(25, 90, 100, 10), "Health:", Color.Black, TextBox.AlignType.Left));
            AddComponent(healthBar);
            AddComponent(professionIcon);
            this.consumesMouseEvent = false;
            Deactivate();
        }
Esempio n. 8
0
        public ImageBoxScrollbarView(ImageBox imageBox, ServerEventMediator eventMediator)
        {
            _eventMediator = eventMediator;
            IsTabStop = true; // allow focus
            ServerEntity = imageBox;

            DataContext = imageBox; 
            
            InitializeComponent();

            LayoutRoot.IsHitTestVisible = !imageBox.Tiles.Any(t => t.HasCapture);

            _eventMediator.TileHasCaptureChanged += EventBrokerTileHasCaptureChanged;

            ImageScrollBar.SetBinding(RangeBase.ValueProperty,
                    new Binding(TopLeftPresentationImageIndexPropertyName) { 
                        Mode = BindingMode.OneTime 
            });

            ImageScrollBar.Maximum = ServerEntity.ImageCount - ServerEntity.Tiles.Count;
            ImageScrollBar.Visibility = ImageScrollBar.Maximum > 0 ? Visibility.Visible : Visibility.Collapsed;

            ServerEntity.PropertyChanged += OnPropertyChanged;

            _scrollbarEventPublisher =
                new DelayedEventPublisher<ScrollBarUpdateEventArgs>(
                    (s, ev) => _eventMediator.DispatchMessage(new UpdatePropertyMessage
                                                                  {
                                                                      Identifier = Guid.NewGuid(),
                                                                      PropertyName =
                                                                          TopLeftPresentationImageIndexPropertyName,
                                                                      TargetId = ServerEntity.Identifier,
                                                                      Value = ev.ScrollbarPosition
                                                                  }), 100);
        }
        private void InitializeWidget(LayoutOrientation orientation)
        {
            ImageBox_1 = new ImageBox();
            ImageBox_1.Name = "ImageBox_1";
            Button_1 = new Button();
            Button_1.Name = "Button_1";

            // ImageBox_1
            ImageBox_1.Image = new ImageAsset("/Application/assets/gameover.png");
            ImageBox_1.ImageScaleType = ImageScaleType.Center;

            // Button_1
            Button_1.TextColor = new UIColor(255f / 255f, 255f / 255f, 255f / 255f, 255f / 255f);
            Button_1.TextFont = new UIFont(FontAlias.System, 25, FontStyle.Regular);

            // GameOverScene
            this.RootWidget.AddChildLast(ImageBox_1);
            this.RootWidget.AddChildLast(Button_1);

            this.Transition = new CrossFadeTransition();

            SetWidgetLayout(orientation);

            UpdateLanguage();
        }
Esempio n. 10
0
        private void addUI()
        {
            Panel panel = new Panel();
            panel.Width = Director.Instance.GL.Context.GetViewport().Width;
            panel.Height = Director.Instance.GL.Context.GetViewport().Height;
            ImageBox backgroundImageBox = new ImageBox();
            backgroundImageBox.Width = panel.Width;
            backgroundImageBox.Height = panel.Height;
            backgroundImageBox.SetPosition(0.0f,0.0f);
            backgroundImageBox.Image = new ImageAsset(backgroundImagePath, false);

            Button playButton = new Button();
            playButton.Name = "Play Game";
            playButton.Text = "Play Game";
            playButton.Width = 300;
            playButton.Height = 50;
            playButton.Alpha = 0.8f;
            playButton.SetPosition(panel.Width/2 - 150, 200.0f);
            playButton.TouchEventReceived += (sender, e) => {
                Director.Instance.ReplaceScene(new MainGameScene());
            };

            panel.AddChildLast(backgroundImageBox);
            panel.AddChildLast(playButton);

            this.uiScene = new Sce.PlayStation.HighLevel.UI.Scene();
            this.uiScene.RootWidget.AddChildLast(panel);
            UISystem.SetScene(this.uiScene);
        }
Esempio n. 11
0
        /// <summary>
        /// Constructor
        /// </summary>
		internal ImageBoxControl(ImageBox imageBox, Rectangle parentRectangle)
        {
			_imageBox = imageBox;
            
			this.ParentRectangle = parentRectangle;
             
			InitializeComponent();

			_imageScrollerVisible = _imageScroller.Visible;
			_imageScroller.MouseDown += ImageScrollerMouseDown;
			_imageScroller.MouseUp += ImageScrollerMouseUp;
			_imageScroller.ValueChanged += ImageScrollerValueChanged;

			this.SetStyle(ControlStyles.OptimizedDoubleBuffer, true);
			this.SetStyle(ControlStyles.AllPaintingInWmPaint, true);
			this.BackColor = Color.Black;
			this.Dock = DockStyle.None;
			this.Anchor = AnchorStyles.None;

			_imageBox.Drawing += OnDrawing;
			_imageBox.SelectionChanged += OnImageBoxSelectionChanged;
			_imageBox.LayoutCompleted += OnLayoutCompleted;

            foreach (var extension in Extensions)
            {
                AttachExtension(extension);
            }
        }
Esempio n. 12
0
        public CreditScene()
        {
            //create a panel
            Sce.PlayStation.HighLevel.UI.Panel panel = new Sce.PlayStation.HighLevel.UI.Panel();
            panel.Width = Director.Instance.GL.Context.GetViewport().Width;
            panel.Height = Director.Instance.GL.Context.GetViewport().Height;

            Button buttonUI1 = new Button(); //buttons
            buttonUI1.Name = "go back";
            buttonUI1.Text = "go back";
            buttonUI1.Width = 250;
            buttonUI1.Height = 50;
            buttonUI1.Alpha = 0.8f;
            buttonUI1.SetPosition(panel.Width/2.5f,panel.Height - 100);
            buttonUI1.TouchEventReceived += (sender, e) => {
                Support.SoundSystem.Instance.Play("ButtonClick.wav");
                Director.Instance.ReplaceScene(new MenuScene());
            };

            ImageBox ib = new ImageBox(); //set background images
            ib.Width = panel.Width;
            ib.Image = new ImageAsset("/Application/resources/Credits.png",false);
            ib.Height = panel.Height;
            ib.SetPosition(0.0f,0.0f);

            //add panel to rootwidget
            panel.AddChildLast(buttonUI1);
            _uiScene = new Sce.PlayStation.HighLevel.UI.Scene();
            _uiScene.RootWidget.AddChildLast(ib);
            _uiScene.RootWidget.AddChildLast(panel);
            UISystem.SetScene(_uiScene);
            Scheduler.Instance.ScheduleUpdateForTarget(this,0,false); //run the loop
        }
Esempio n. 13
0
        public ImageBoxView(ImageBox serverEntity, ServerEventMediator eventMediator)
        {
			ServerEntity = serverEntity;
            _eventMediator = eventMediator;
			_eventMediator.RegisterEventHandler(serverEntity.Identifier, OnImageBoxEvent);
            InitializeComponent();
			UpdateTileViews();
        }
		public SubmitScore ()
		{
			this.Camera.SetViewFromViewport();
			Sce.PlayStation.HighLevel.UI.Panel dialog = new Panel();
			dialog.Width = Director.Instance.GL.Context.GetViewport().Width;
			dialog.Height = Director.Instance.GL.Context.GetViewport().Height;
			
			//textInfo = new TextureInfo(m_texture);
			//SpriteUV tScreen = new SpriteUV(textInfo);
			
			//tScreen.Scale = textInfo.TextureSizef;
			//tScreen.Pivot = new Vector2(0.5f,0.5f);
			//tScreen.Position = new Vector2(Director.Instance.GL.Context.GetViewport().Width/2,
			                            //Director.Instance.GL.Context.GetViewport().Height/2);
			//this.AddChild(tScreen);
			
			ImageBox ib = new ImageBox();
			ib.Width = dialog.Width;
			ib.Image = new ImageAsset("/Application/images/highScore.png", false);
			ib.Height = dialog.Height;
			ib.SetPosition(0.0f, 0.0f);
					
			Button submitScore = new Button();
			submitScore.Name = "submitScore";
			submitScore.Text = "Submit Score";
			submitScore.Width = 200;
			submitScore.Height = 50;
			submitScore.Alpha = 0.8f;
			submitScore.SetPosition(250.0f, 40.0f);
			submitScore.TouchEventReceived += OnSubmitScore;
			
			Button returnToMenu = new Button();
			returnToMenu.Name = "returnToMenu";
			returnToMenu.Text = "Menu";
			returnToMenu.Width = 200;
			returnToMenu.Height = 50;
			returnToMenu.Alpha = 0.8f;
			returnToMenu.SetPosition(700.0f, 40.0f);
			returnToMenu.TouchEventReceived += OnButtonPlay;
			
			playerNameField = new EditableText();
			playerNameField.Name = "playerNameField";
			playerNameField.Width = 200;
			playerNameField.Height = 50;
			playerNameField.Alpha = 0.8f;
			playerNameField.SetPosition(25.0f, 40.0f);
			
			UpdateImage(totalScore);
			
			dialog.AddChildLast(ib);
			dialog.AddChildLast(submitScore);
			dialog.AddChildLast(returnToMenu);
			dialog.AddChildLast(playerNameField);
			m_uiScene = new Sce.PlayStation.HighLevel.UI.Scene();
			m_uiScene.RootWidget.AddChildLast(dialog);
			UISystem.SetScene(m_uiScene);
			Scheduler.Instance.ScheduleUpdateForTarget(this, 0, false);
		}
Esempio n. 15
0
        public void Initialize()
        {
            Sce.PlayStation.HighLevel.UI.Panel dialog = new Panel();//create panel
            dialog.Width = 960;//only for vita
            dialog.Height = 544;

            ImageBox ib = new ImageBox(); //set background images
            ib.Width = dialog.Width;
            ib.Image = new ImageAsset("/Application/resources/lose.png",false);
            ib.Height = dialog.Height;
            ib.SetPosition(0.0f,0.0f);

            Button buttonUI1 = new Button(); //set buttons positions
            buttonUI1.Name = "replay";
            buttonUI1.Text = "replay";
            buttonUI1.Width = 250;
            buttonUI1.Height = 50;
            buttonUI1.Alpha = 0.8f;
            buttonUI1.SetPosition(dialog.Width/15,dialog.Height - 100);
            buttonUI1.TouchEventReceived += (sender, e) => {
                Support.SoundSystem.Instance.Play("ButtonClick.wav");
                Director.Instance.ReplaceScene(new GameScene());
            };

            Button buttonUI2 = new Button();
            buttonUI2.Name = "home";
            buttonUI2.Text = "home";
            buttonUI2.Width = 250;
            buttonUI2.Height = 50;
            buttonUI2.Alpha = 0.8f;
            buttonUI2.SetPosition(dialog.Width/2.7f,dialog.Height - 100);
            buttonUI2.TouchEventReceived += (sender, e) => {
                Support.SoundSystem.Instance.Play("ButtonClick.wav");
                Director.Instance.ReplaceScene(new MenuScene());
            };

            Sce.PlayStation.HighLevel.UI.Label scoreLabel = new Sce.PlayStation.HighLevel.UI.Label();
            labelSetting(scoreLabel,                    				//total score
                         "Total Score: " + GameScene.totalScore,
                         690,
                         0,
                         300,
                         100,
                         30,
                         FontStyle.Regular,
                         new UIColor(255, 0, 0, 255));

            dialog.AddChildLast(ib);
            dialog.AddChildLast(buttonUI1);
            dialog.AddChildLast(buttonUI2);
            dialog.AddChildLast(scoreLabel);

            _uiScene = new Sce.PlayStation.HighLevel.UI.Scene();
            _uiScene.RootWidget.AddChildLast(dialog);
            UISystem.SetScene(_uiScene); // create menu scene
        }
 protected override void Dispose(bool disposing)
 {
     base.Dispose(disposing);
     if (disposing && _imageBox != null)
     {
         _imageBox.SelectionChanged -= OnSelectionChanged;
         _imageBox.Drawing          -= OnImageBoxDrawing;
         _imageBox.LayoutCompleted  -= OnLayoutCompleted;
         DisposeTileHandlers();
         _imageBox = null;
     }
 }
Esempio n. 17
0
        public TaskStorage(Manager manager, Slot[] itemSlots, BlockItem storageItem, int slotsX, int slotsY)
            : base(manager)
        {
            imageCaption = new ImageBox(manager);
            imageCaption.Init();
            if (storageItem.RenderMode == BlockRenderMode.Single)
            {
                imageCaption.Image = ContentPack.Textures["spritesheets\\" + storageItem.Name];
            }
            else
            {
                imageCaption.Image = ContentPack.Textures["items\\" + storageItem.Name];
            }
            imageCaption.Left   = 8;
            imageCaption.Width  = imageCaption.Image.Width;
            imageCaption.Height = imageCaption.Image.Height;
            imageCaption.Top    = 4;
            Add(imageCaption);
            Caption.Left    = Description.Left = imageCaption.Left + imageCaption.Width + 8;
            TopPanel.Height = imageCaption.Image.Height + 12;
            Resizable       = false;

            Text             = storageItem.Name;
            TopPanel.Visible = true;
            Remove(BottomPanel);
            Caption.Text          = storageItem.Name;
            Description.Text      = storageItem.Description + " - " + storageItem.StorageSlots.X * storageItem.StorageSlots.Y + " Slots";
            Description.TextColor = Color.Gray;
            Caption.TextColor     = Color.LightGray;

            slotContainer = new SlotContainer(Manager, slotsX, slotsY);
            slotContainer.Init();
            slotContainer.ItemSlots        = itemSlots;
            slotContainer.Left             = 8;
            slotContainer.Top              = TopPanel.Height + TopPanel.Top + 8;
            slotContainer.ShiftClickItems += slotContainer_ShiftClickItems;
            Add(slotContainer);

            ClientWidth  = slotContainer.Left + slotContainer.ClientWidth;
            ClientHeight = slotContainer.Top + slotContainer.ClientHeight;
            Center();

            Top     = Interface.MainWindow.inventory.Top + Interface.MainWindow.InventoryOpenHeight + 48;
            Closed += TaskStorage_Closed;
            SendToBack();

            //For some reason Center() changes with width, this resets it to the correct amount.
            ClientWidth = slotContainer.Left + slotContainer.ClientWidth;

            //Open inventory
            Interface.MainWindow.hiding    = false;
            Interface.MainWindow.expanding = true;
        }
Esempio n. 18
0
 private static void ZoomToImage(ImageBox pbx)
 {
     if (pbx.ImgBW <= 0 || pbx.ImgBH <= 0)
     {
         pbx.ZoomReset();
     }
     else
     {
         pbx.ZoomToRect(0, 0, pbx.ImgBW, pbx.ImgBH);
     }
     pbx.Invalidate();
 }
Esempio n. 19
0
 public void Inicializar(int Indice, ImageBox imgBox, ImageBox imgBoxA)
 {
     Indice1 = Indice;
     imgBox1 = imgBox;
     imgBox2 = imgBoxA;
     Frame   = new Mat();
     capture = new VideoCapture(Indice);
     capture.SetCaptureProperty(CapProp.FrameHeight, imgBox1.Height);
     capture.SetCaptureProperty(CapProp.FrameWidth, imgBox1.Width);
     capture.FlipHorizontal = true;
     capture.ImageGrabbed  += CapturarImagen;
 }
Esempio n. 20
0
        ////////////////////////////////////////////////////////////////////////////

        #endregion

        #region         //// Properties ////////

        ////////////////////////////////////////////////////////////////////////////
        ////////////////////////////////////////////////////////////////////////////

        #endregion

        #region         //// Events ////////////

        ////////////////////////////////////////////////////////////////////////////
        ////////////////////////////////////////////////////////////////////////////

        #endregion

        #region         //// Construstors //////

        ////////////////////////////////////////////////////////////////////////////
        public ExitDialog(Manager manager)
            : base(manager)
        {
            string msg = "Do you really want to exit " + Manager.Game.Window.Title + "?";

            ClientWidth      = (int)Manager.Skin.Controls["Label"].Layers[0].Text.Font.Resource.MeasureString(msg).X + 48 + 16 + 16 + 16;
            ClientHeight     = 120;
            TopPanel.Visible = false;
            IconVisible      = true;
            Resizable        = false;
            Text             = Manager.Game.Window.Title;
            Center();

            imgIcon = new ImageBox(Manager);
            imgIcon.Init();
            imgIcon.Image    = Manager.Skin.Images["Icon.Question"].Resource;
            imgIcon.Left     = 16;
            imgIcon.Top      = 16;
            imgIcon.Width    = 48;
            imgIcon.Height   = 48;
            imgIcon.SizeMode = SizeMode.Stretched;

            lblMessage = new Label(Manager);
            lblMessage.Init();

            lblMessage.Left      = 80;
            lblMessage.Top       = 16;
            lblMessage.Width     = ClientWidth - lblMessage.Left;
            lblMessage.Height    = 48;
            lblMessage.Alignment = Alignment.TopLeft;
            lblMessage.Text      = msg;

            btnYes = new Button(Manager);
            btnYes.Init();
            btnYes.Left        = (BottomPanel.ClientWidth / 2) - btnYes.Width - 4;
            btnYes.Top         = 8;
            btnYes.Text        = "Yes";
            btnYes.ModalResult = ModalResult.Yes;

            btnNo = new Button(Manager);
            btnNo.Init();
            btnNo.Left        = (BottomPanel.ClientWidth / 2) + 4;
            btnNo.Top         = 8;
            btnNo.Text        = "No";
            btnNo.ModalResult = ModalResult.No;

            Add(imgIcon);
            Add(lblMessage);
            BottomPanel.Add(btnYes);
            BottomPanel.Add(btnNo);

            DefaultControl = btnNo;
        }
Esempio n. 21
0
        private void InitializeWidget(LayoutOrientation orientation)
        {
            Title_1      = new ImageBox();
            Title_1.Name = "Title_1";

            ScreenVignette      = new ImageBox();
            ScreenVignette.Name = "ScreenVignette";

            btnNewgame      = new ImageBox();
            btnNewgame.Name = "btnNewgame";
            btnQuit         = new ImageBox();
            btnQuit.Name    = "btnQuit";


            // Title_1
            Title_1.Image = new ImageAsset("assets/StartScreen/magnate-title2.png");

            // Arrow_2


            // ScreenVignette
            ScreenVignette.Image = new ImageAsset("assets/GUI/Screen_Vignette.png");

            // Tutbox


            // Label_1

            // btnNewgame
            btnNewgame.Image = new ImageAsset("assets/StartScreen/newgame.png");

            // btnQuit
            btnQuit.Image = new ImageAsset("assets/StartScreen/quit.png");

            // Button_2

            // Button_1

            // Scene
            this.RootWidget.AddChildLast(Title_1);

            this.RootWidget.AddChildLast(ScreenVignette);

            this.RootWidget.AddChildLast(btnNewgame);
            this.RootWidget.AddChildLast(btnQuit);

            this.Showing += new EventHandler(onShowing);
            this.Shown   += new EventHandler(onShown);

            SetWidgetLayout(orientation);

            UpdateLanguage();
        }
Esempio n. 22
0
 public void StartStopCapture(ImageBox imageBox)
 {
     _imageBox = imageBox;
     if (_isCapturing == false)
     {
         Start();
     }
     else
     {
         StopCapture();
     }
 }
Esempio n. 23
0
        public Menu(StackEngine engine)
        {
            FocusSound = engine.EngineContent.Load <SoundEffect>(content.audio.menu_click);
            ClickSound = engine.EngineContent.Load <SoundEffect>(content.audio.menu_focus);
            MenuSong   = engine.EngineContent.Load <Song>(content.audio.menu);

            Engine       = engine;
            GameSettings = engine.GameSettings;

            MediaPlayer.Volume = MathHelper.Clamp(GameSettings.MusicVolume, 0.0f, 1.0f);
            if (!AudioManager.SoundDisabled)
            {
                MediaPlayer.Play(MenuSong);
            }
            MediaPlayer.IsRepeating = true;

            var GUI    = engine.Renderer.GUIManager;
            var Cursor = CreateCursor();

            GUI.ShowSoftwareCursor = true;

            GUI.Skin.Cursors["Default"].Resource = Cursor;
            GUI.SetCursor(Cursor);

            MainMenuBackground = new ImageBox(GUI); // Imagebox showing the image
            MainMenuBackground.Init();
            MainMenuBackground.SizeMode = SizeMode.Stretched;

            MainMenuBackground.Width  = engine.Renderer.DisplaySettings.VirtualResolution.X;
            MainMenuBackground.Height = engine.Renderer.DisplaySettings.VirtualResolution.Y;

            MainMenuLabel = new Label(GUI);
            MainMenuLabel.Init();
            MainMenuLabel.Text      = string.Empty;
            MainMenuLabel.TextColor = Color.Black;
            MainMenuLabel.Parent    = MainMenuBackground;
            MainMenuLabel.Width     = engine.Renderer.DisplaySettings.VirtualResolution.X - 12;
            MainMenuLabel.Height    = 24;
            MainMenuLabel.Left      = 6;
            MainMenuLabel.Top       = engine.Renderer.DisplaySettings.VirtualResolution.Y - MainMenuLabel.Height;

            AddExitConfirmationWindow(GUI);
            AddLoadGameWindow(GUI);
            AddSaveGameWindow(GUI);
            AddSettingsWindow(GUI);
            AddCreditsWindow(GUI);
            RefreshSaveGames();
            InitMenuButtons(GUI);

            GUI.Add(MainMenuBackground);

            ShowLogo(true);
        }
Esempio n. 24
0
        protected void SetImageBox(ImageBox imageBox)
        {
            var message = new DicomMessage(null, (DicomAttributeCollection)imageBox.DicomAttributeProvider)
            {
                RequestedSopClassUid    = this.ColorMode == ColorMode.Color ? SopClass.BasicColorImageBoxSopClassUid : SopClass.BasicGrayscaleImageBoxSopClassUid,
                RequestedSopInstanceUid = imageBox.SopInstanceUid.UID
            };

            this.Client.SendNSetRequest(GetPresentationContextId(this.AssociationParameters), this.Client.NextMessageID(), message);
            _eventObject = EventObject.ImageBox;
            Platform.Log(LogLevel.Debug, "Setting image box {0}...", _numberOfImageBoxesSent);
        }
Esempio n. 25
0
        ////////////////////////////////////////////////////////////////////////////       
        public ExitDialog(Manager manager)
            : base(manager, DialogPanelsVisible.BothPanels)
        {
            string msg = "Do you really want to exit " + Manager.Game.Window.Title + "?";
              ClientWidth = (int)Manager.Skin.Controls["Label"].Layers[0].Text.Font.Resource.MeasureString(msg).X + 48 + 16 + 16 + 16;
              ClientHeight = 120;
              TopPanel.Visible = false;
              IconVisible = true;
              Resizable = false;
              Text = Manager.Game.Window.Title;
              Center();

              imgIcon = new ImageBox(Manager);
              imgIcon.Init();
              imgIcon.Image = Manager.Skin.Images["Icon.Question"].Resource;
              imgIcon.Left = 16;
              imgIcon.Top = 16;
              imgIcon.Width = 48;
              imgIcon.Height = 48;
              imgIcon.SizeMode = SizeMode.Stretched;

              lblMessage = new Label(Manager);
              lblMessage.Init();

              lblMessage.Left = 80;
              lblMessage.Top = 16;
              lblMessage.Width = ClientWidth - lblMessage.Left;
              lblMessage.Height = 48;
              lblMessage.Alignment = Alignment.TopLeft;
              lblMessage.Text = msg;

              btnYes = new Button(Manager);
              btnYes.Init();
              btnYes.Left = (BottomPanel.ClientWidth / 2) - btnYes.Width - 4;
              btnYes.Top = 8;
              btnYes.Text = "Yes";
              btnYes.ModalResult = ModalResult.Yes;

              btnNo = new Button(Manager);
              btnNo.Init();
              btnNo.Left = (BottomPanel.ClientWidth / 2) + 4;
              btnNo.Top = 8;
              btnNo.Text = "No";
              btnNo.ModalResult = ModalResult.No;

              Add(imgIcon);
              Add(lblMessage);
              BottomPanel.Add(btnYes);
              BottomPanel.Add(btnNo);

              DefaultControl = btnNo;
        }
Esempio n. 26
0
 private void IsGrayscaleBox_CheckedChanged(object sender, EventArgs e)
 {
     IsGrayscale = IsGrayscaleBox.Checked;
     if (IsGrayscaleBox.Checked)
     {
         ImageBox.Image = grayscaleThumbnail;
     }
     else
     {
         ImageBox.Image = thumbnail;
     }
     ImageBox.Refresh();
 }
Esempio n. 27
0
 /// <summary>
 /// Mouse move event.
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void ImageBox_MouseMove(object sender, MouseEventArgs e)
 {
     if (ImageBox.IsPointInImage(e.Location))
     {
         Point onImage = ImageBox.PointToImage(e.Location.X, e.Location.Y);
         MouseAnnotationToolTip.SetToolTip(ImageBox, "" + onImage.X + "," + onImage.Y + ":" + GetValue(onImage).ToString("#0.000"));
         MouseAnnotationToolTip.Active = true;
     }
     else
     {
         MouseAnnotationToolTip.Active = false;
     }
 }
Esempio n. 28
0
 internal override void MouseDown(MouseEventArgs e, ImageBox box)
 {
     if (e.Button == MouseButtons.Left)
     {
         _isLeftMouseDown     = true;
         _leftMouseDownAnchor = SetCursor(e.Location, box);
         _lastMousePoint      = e.Location;
         _lastImagePoint      = Cpt;
         _lastSradius         = Sradius;
         _lastEradius         = Eradius;
         box.Invalidate();
     }
 }
Esempio n. 29
0
        /// </summary>
        /// <param name="Rect"></param>
        /// <returns></returns>

        /// <summary>
        /// collect information my rectangle affine
        /// </summary>
        /// <param name="Center_Point"></param>
        /// <returns></returns>

        public void SetPictureBox(ImageBox p)
        {
            this.mPictureBox           = p;
            mPictureBox.FunctionalMode = ImageBox.FunctionalModeOption.Minimum;
            mPictureBox.Resize        += MPictureBox_Resize;
            mPictureBox.MouseEnter    += MPictureBox_MouseEnter;
            mPictureBox.MouseLeave    += MPictureBox_MouseLeave;
            mPictureBox.MouseDown     += new MouseEventHandler(mPictureBox_MouseDown);
            mPictureBox.MouseUp       += new MouseEventHandler(mPictureBox_MouseUp);
            mPictureBox.MouseMove     += new MouseEventHandler(mPictureBox_MouseMove);
            mPictureBox.Paint         += new PaintEventHandler(mPictureBox_Paint);
            mPictureBox.MouseWheel    += new MouseEventHandler(Picture_box_MouseWheel);
        }
Esempio n. 30
0
        private void AddImageBoxControl(ImageBox imageBox)
        {
            ImageBoxView view = ViewFactory.CreateAssociatedView(typeof(ImageBox)) as ImageBoxView;

            view.ImageBox        = imageBox;
            view.ParentRectangle = this.ClientRectangle;

            ImageBoxControl control = view.GuiElement as ImageBoxControl;

            control.SuspendLayout();
            this.Controls.Add(control);
            control.ResumeLayout(false);
        }
Esempio n. 31
0
        public void Activate(string filePath, int type, object[] values)
        {
            switch (type)
            {
            case 0:
                ImageBox.ShowDialog((Image)values[0]);
                break;

            case 1:
                MessageBox.Show("Not implemented yet.");    //TODO: make switch images
                break;
            }
        }
Esempio n. 32
0
 private void loadImage(string path, ImageBox imageBox)
 {
     using (var srce = new Bitmap(path))
     {
         var dest = new Bitmap(imageBox.Width, imageBox.Height, System.Drawing.Imaging.PixelFormat.Format32bppPArgb);
         using (var gr = Graphics.FromImage(dest))
         {
             gr.DrawImage(srce, new Rectangle(Point.Empty, dest.Size));
         }
         //if (pictureBox.Image != null) pictureBox.Dispose();
         imageBox.Image = dest;
     }
 }
Esempio n. 33
0
        public void SetImageBox(ImageBox imgBox)
        {
            if (_imgBox != null)
            {
                _imgBox.MouseMove -= _imgBox_MouseMove;
                _imgBox.Click     -= _imgBox_Click;
            }

            _imgBox = imgBox;

            _imgBox.MouseMove += _imgBox_MouseMove;
            _imgBox.Click     += _imgBox_Click;
        }
Esempio n. 34
0
 public void Init()
 {
     _deductions.ForEach(d => d.Init(ClearPriorDeductions,
                                     new Transform2(
                                         new Vector2(_transform.Location.X, _transform.Location.Y + _transform.Size.Height - 10),
                                         new Size2(_transform.Size.Width, 130))));
     _newDeductions = new ImageBox
     {
         Transform = new Transform2(new Vector2(_transform.Location.X - 20, _transform.Location.Y - 20), new Size2(36, 36)),
         Image     = "UI/NewRedIcon",
         IsActive  = () => HasNewAnswers
     };
 }
Esempio n. 35
0
 protected void DrawLineTo(ImageBox canvas, Point orig, Point desti, MCvScalar color, int strokeWidth)
 {
     if (orig == InvalidPoint || desti == InvalidPoint)
     {
         return;
     }
     if (strokeWidth <= 0)
     {
         strokeWidth = 1;
     }
     CvInvoke.Line(canvas.Image, orig, desti, color, strokeWidth, LineType.AntiAlias);
     canvas.Refresh();
 }
 void taskMenu_Showing(object sender, EventArgs e)
 {
     if (adImage == null)
     {
         adImage      = (ImageBox)ParentWidget.createWidgetT("ImageBox", "ImageBox", 2, taskMenu.AdTop, AdWidth, AdHeight, Align.Left | Align.Top, "");
         rocketWidget = new RocketWidget(adImage, false);
         openRml();
         Right = adImage.Right;
         Top   = HorizontalAdHeight;
         fireAdCreated();
         taskMenu.Showing -= taskMenu_Showing;
     }
 }
Esempio n. 37
0
 private void ImageBox_MouseUp(object sender, MouseEventArgs e)
 {
     if (drawing)
     {
         drawing = false;
         Rectangle rectangle = GetRectangle();
         if (rectangle.Width > 0 && rectangle.Height > 0)
         {
             myRectangles.Add(rectangle);
         }
         ImageBox.Invalidate();
     }
 }
Esempio n. 38
0
 private void Capture_ImageGrabbed(object sender, EventArgs e)
 {
     try
     {
         ImageBox img = new ImageBox();
         Emgu.CV.Image <Bgr, Byte> imagez = capture.QueryFrame().ToImage <Bgr, Byte>();
         //    img.Image = imagez.ToBitmap();
         //    img.Image = Emgu.CV.IImage(imagez);
     }
     catch (Exception)
     {
     }
 }
        public void ProcessImageTest4()
        {
            Bitmap[] bitmaps = 
            {
                Resources.flower01,
                Resources.flower03,
                Resources.flower06,
                Resources.flower07,
                Resources.flower09,
                Resources.flower10,
            };

            var surf = new SpeededUpRobustFeaturesDetector();

            int current = 0;
            foreach (Bitmap img in bitmaps)
            {
                List<SpeededUpRobustFeaturePoint> expected;
                List<SpeededUpRobustFeaturePoint> actual;

                // Create OpenSURF detector by Chris Evans
                {
                    // Create Integral Image
                    OpenSURFcs.IntegralImage iimg = OpenSURFcs.IntegralImage.FromImage(img);

                    // Extract the interest points
                    var pts = OpenSURFcs.FastHessian.getIpoints(0.0002f, 5, 2, iimg);

                    // Describe the interest points
                    OpenSURFcs.SurfDescriptor.DecribeInterestPoints(pts, false, false, iimg);

                    expected = new List<SpeededUpRobustFeaturePoint>();
                    foreach (var p in pts)
                        expected.Add(new SpeededUpRobustFeaturePoint(p.x, p.y, p.scale,
                            p.laplacian, p.orientation, p.response));
                }

                // Create Accord.NET SURF detector (based on OpenSURF by Chris Evans)
                {
                    actual = surf.ProcessImage(img);
                }

                var img1 = new FeaturesMarker(actual).Apply(img);
                var img2 = new FeaturesMarker(expected).Apply(img);

                ImageBox.Show(new Concatenate(img1).Apply(img2), PictureBoxSizeMode.Zoom);


                current++;
            }
        }
Esempio n. 40
0
        public void Init()
        {
            fForm            = new Form();
            fForm.ClientSize = new Size(383, 221);
            fForm.Text       = "ImageViewTests";

            fImageBox      = new ImageBox();
            fImageBox.Dock = DockStyle.Fill;

            fForm.SuspendLayout();
            fForm.Controls.Add(fImageBox);
            fForm.ResumeLayout(false);
            fForm.PerformLayout();
        }
        public static ImageBox[] Reduce(ImageBox[] images, DeleteImageSlotAction action)
        {
            var index = action.Slot;

            ReducerValidators.ValidateLength(images);
            ReducerValidators.ValidateIndex(images, index);

            var newArray = new ImageBox[images.Length - 1];

            Array.Copy(images, 0, newArray, 0, index);
            Array.Copy(images, index + 1, newArray, index, images.Length - (index + 1));

            return(newArray);
        }
Esempio n. 42
0
        public Point GetImgBoxImgCoords(ImageBox imgBox, Point controlCoords)
        {
            ///When you mouse over an (EMGU CV) ImageBox, the location you receive
            ///from MouseEventArgs is not the actual location on the image because
            ///there is zoom scaling. This function takes the MouseEventArgs coords
            ///and translates them into image coords.
            int   offsetX = (int)(controlCoords.X / imgBox.ZoomScale);
            int   offsetY = (int)(controlCoords.Y / imgBox.ZoomScale);
            int   horizontalScrollBarValue = imgBox.HorizontalScrollBar.Visible ? imgBox.HorizontalScrollBar.Value : 0;
            int   verticalScrollBarValue   = imgBox.VerticalScrollBar.Visible ? imgBox.VerticalScrollBar.Value : 0;
            Point nonImageLimitedPoint     = new Point(offsetX + horizontalScrollBarValue, offsetY + verticalScrollBarValue);

            return(GetImageLimitedPoint(imgBox.DisplayedImage, nonImageLimitedPoint));
        }
Esempio n. 43
0
        private void AddTileControls(ImageBox imageBox)
        {
            this.SuspendLayout();

            foreach (Tile tile in imageBox.Tiles)
            {
                AddTileControl(tile);
            }

            // keep the image scroller at the forefront
            _imageScroller.BringToFront();

            this.ResumeLayout(false);
        }
Esempio n. 44
0
 public DialogueReader(IEnumerable <DialogueElement> lines, Action onFinished, Action <DialogueElement> onAdvance)
 {
     _chatBox          = new ChatBox("", 840, DefaultFont.Value, CurrentOptions.MillisPerTextCharacter, 32);
     _chatBoxTransform = new Transform2(new Vector2(120, 912));
     _lines            = new Queue <DialogueElement>(lines);
     _onFinished       = onFinished;
     _onAdvance        = onAdvance;
     Input.On(Control.A, Advance);
     _box = new ImageBox {
         Transform = new Transform2(new Size2(1920, 1080)), Image = "Convo/ChatBox"
     };
     _chatBox.ShowMessage(_lines.Dequeue().Line);
     _onAdvance(lines.First());
 }
Esempio n. 45
0
        public Detect(ImageBox resultImageBox)
        {
            this.resultImageBox = resultImageBox;

            detectionCounter = 0;

            workImage = new Image <Gray, byte>(new Size(640, 480));
            kernel    = CvInvoke.GetStructuringElement(ElementShape.Rectangle, new Size(3, 3), new Point(-1, -1));

            svm = new SVM();
            FileStorage file = new FileStorage("..//svm.txt", FileStorage.Mode.Read);

            svm.Read(file.GetNode("opencv_ml_svm"));
        }
Esempio n. 46
0
        public static void Test()
        {
            ImageBox image = Gui.Instance.CreateWidget <ImageBox>("ImageBox", new IntCoord(320, 120, 100, 100), Align.Default, "Main");

            image.SetItemResource("pic_CoreMessageIcon");
            image.SetItemGroup("Icons");
            image.SetItemName("Warning");

            image = Gui.Instance.CreateWidget <ImageBox>("ImageBox", new IntCoord(320, 20, 100, 100), Align.Default, "Main");
            image.SetImageTexture("core.png");
            image.SetImageCoord(new IntCoord(0, 0, 1024, 256));
            image.SetImageTile(new IntSize(100, 100));
            image.ImageIndex = 1;
        }
Esempio n. 47
0
        public MenuScene()
        {
            this.Camera.SetViewFromViewport();
            Panel dialog = new Panel();

            dialog.Width = Director.Instance.GL.Context.GetViewport().Width;
            dialog.Height = Director.Instance.GL.Context.GetViewport().Height;

            ImageBox ib = new ImageBox();
            ib.Width = dialog.Width;
            ib.Image = new ImageAsset("/Application/images/title.png", false);
            ib.Height = dialog.Height;
            ib.SetPosition(0.0f, 0.0f);

            Button playButton = new Button();
            playButton.Name = "buttonPlay";
            playButton.Text = "Play Game";
            playButton.Width = 300;
            playButton.Height = 50;
            playButton.Alpha = 0.8f;
            playButton.SetPosition(dialog.Width/2 - playButton.Width / 2, 200.0f);
            playButton.TouchEventReceived += (sender, e) => {
                Director.Instance.ReplaceScene(new GameScene());
            };

            Button menuButton = new Button();
            menuButton.Name = "buttonMenu";
            menuButton.Text = "Main Menu";
            menuButton.Width = 300;
            menuButton.Height = 50;
            menuButton.Alpha = 0.8f;
            menuButton.SetPosition(dialog.Width/2 - playButton.Width / 2, 250.0f);
            menuButton.TouchEventReceived += (sender, e) => {
                Director.Instance.ReplaceScene(new TitleScene());
            };

            dialog.AddChildLast(ib);
            dialog.AddChildLast(playButton);
            dialog.AddChildLast(menuButton);
            _uiScene = new Sce.PlayStation.HighLevel.UI.Scene();
            _uiScene.RootWidget.AddChildLast(dialog);
            UISystem.SetScene(_uiScene);
            Scheduler.Instance.ScheduleUpdateForTarget(this, 0, false);
        }
		public LeaderBoard (string scores)
		{
			highScores = scores;
			this.Camera.SetViewFromViewport();
			Sce.PlayStation.HighLevel.UI.Panel dialog = new Panel();
			dialog.Width = Director.Instance.GL.Context.GetViewport().Width;
			dialog.Height = Director.Instance.GL.Context.GetViewport().Height;
			
			textInfo = new TextureInfo(m_texture);
			SpriteUV tScreen = new SpriteUV(textInfo);
			UpdateImage(highScores);
			
			tScreen.Scale = textInfo.TextureSizef;
			tScreen.Pivot = new Vector2(0.5f,0.5f);
			tScreen.Position = new Vector2(Director.Instance.GL.Context.GetViewport().Width/2,
			                            Director.Instance.GL.Context.GetViewport().Height/2);
			this.AddChild(tScreen);
			
			ImageBox ib = new ImageBox();
			ib.Width = dialog.Width;
			ib.Image = new ImageAsset("/Application/images/highScore.png", false);
			ib.Height = dialog.Height;
			ib.SetPosition(0.0f, 0.0f);
			
			Button returnToMenu = new Button();
			returnToMenu.Name = "returnToMenu";
			returnToMenu.Text = "Menu";
			returnToMenu.Width = 200;
			returnToMenu.Height = 50;
			returnToMenu.Alpha = 0.8f;
			returnToMenu.SetPosition(700.0f, 40.0f);
			returnToMenu.TouchEventReceived += OnButtonPlay;
			
			dialog.AddChildLast(ib);
			dialog.AddChildLast(returnToMenu);
			m_uiScene = new Sce.PlayStation.HighLevel.UI.Scene();
			m_uiScene.RootWidget.AddChildLast(dialog);
			UISystem.SetScene(m_uiScene);
			Scheduler.Instance.ScheduleUpdateForTarget(this, 0, false);
		}
        private void InitializeWidget(LayoutOrientation orientation)
        {
            sceneBackgroundPanel = new Panel();
            sceneBackgroundPanel.Name = "sceneBackgroundPanel";
            ImageBox_1 = new ImageBox();
            ImageBox_1.Name = "ImageBox_1";

            // sceneBackgroundPanel
            sceneBackgroundPanel.BackgroundColor = new UIColor(0f / 255f, 0f / 255f, 0f / 255f, 255f / 255f);

            // ImageBox_1
            ImageBox_1.Image = new ImageAsset("/Application/assets/images/UI/eyes.png");
            ImageBox_1.ImageScaleType = ImageScaleType.Center;

            // SplashScene
            this.RootWidget.AddChildLast(sceneBackgroundPanel);
            this.RootWidget.AddChildLast(ImageBox_1);

            SetWidgetLayout(orientation);

            UpdateLanguage();
        }
Esempio n. 50
0
		public void PaintPictureBox()
		{
			AssembledStyles styles = new AssembledStyles();
			Bitmap bm = new Bitmap(20, 30);
			ImageBox box = new ImageBox(styles.WithMargins(new Thickness(72.0 / 96.0 * 2.0))
				.WithBorders(new Thickness(72.0 / 96.0 * 3.0))
				.WithPads(new Thickness(72.0 / 96.0 * 7.0, 72.0 / 96.0 * 8.0, 72.0 / 96.0 * 11.0, 72.0 / 96.0 * 13.0)), bm);

			RootBox root = new RootBox(styles);
			BlockBox block = new BlockBox(styles, Color.Yellow, 2000, 4000);
			root.AddBox(block);
			root.AddBox(box);
			LayoutInfo transform = MakeLayoutInfo();
			root.Layout(transform);
			Assert.That(box.Height, Is.EqualTo(30 + 2*2+3*2+8+13));
			Assert.That(box.Width, Is.EqualTo(20 + 2*2 +3*2 + 7 + 11));
			Assert.That(box.Ascent, Is.EqualTo(box.Height));

			PaintTransform ptrans = new PaintTransform(2, 4, 96, 96, 10, 40, 96, 96);
			MockGraphics graphics = new MockGraphics();
			root.Paint(graphics, ptrans);
			Assert.That(graphics.LastRenderPictureArgs, Is.Not.Null);
			Assert.That(graphics.LastRenderPictureArgs.Picture, Is.EqualTo(box.Picture));
			Assert.That(graphics.LastRenderPictureArgs.X, Is.EqualTo(2-10 + 2 + 3 + 7));
			Assert.That(graphics.LastRenderPictureArgs.Y, Is.EqualTo(4 - 40 + block.Height + 2 + 3 + 8));
			Assert.That(graphics.LastRenderPictureArgs.Cx, Is.EqualTo(20));
			Assert.That(graphics.LastRenderPictureArgs.Cy, Is.EqualTo(30));
			int hmWidth = box.Picture.Width;
			int hmHeight = box.Picture.Height;
			Assert.That(graphics.LastRenderPictureArgs.XSrc, Is.EqualTo(0));
			Assert.That(graphics.LastRenderPictureArgs.YSrc, Is.EqualTo(hmHeight));
			Assert.That(graphics.LastRenderPictureArgs.CxSrc, Is.EqualTo(hmWidth));
			Assert.That(graphics.LastRenderPictureArgs.CySrc, Is.EqualTo(-hmHeight));
			Assert.That(graphics.LastRenderPictureArgs.RcWBounds.left, Is.EqualTo(2 - 10 + 2 + 3 + 7));
			Assert.That(graphics.LastRenderPictureArgs.RcWBounds.top, Is.EqualTo(4 - 40 + block.Height + 2 + 3 + 8));
			Assert.That(graphics.LastRenderPictureArgs.RcWBounds.right, Is.EqualTo(2 - 10 + 2 + 3 + 7 + 20));
			Assert.That(graphics.LastRenderPictureArgs.RcWBounds.bottom, Is.EqualTo(4 - 40 + block.Height + 2 + 3 + 8 + 30));
		}
Esempio n. 51
0
		protected void SetImageBox(ImageBox imageBox)
		{
			var message = new DicomMessage(null, (DicomAttributeCollection)imageBox.DicomAttributeProvider)
			{
				RequestedSopClassUid = this.ColorMode == ColorMode.Color ? SopClass.BasicColorImageBoxSopClassUid : SopClass.BasicGrayscaleImageBoxSopClassUid,
				RequestedSopInstanceUid = imageBox.SopInstanceUid.UID
			};

			this.Client.SendNSetRequest(GetPresentationContextId(this.AssociationParameters), this.Client.NextMessageID(), message);
			_eventObject = EventObject.ImageBox;
			Platform.Log(LogLevel.Debug, "Setting image box {0}...", _numberOfImageBoxesSent);
		}
Esempio n. 52
0
        public override void UpdateData()
        {
            DisposeControls();
            if (SelectedItem.ImagesPaths.IsNonEmpty())
            {
                //Ensure only one poster is checked
                bool check = false;
                foreach (Poster p in SelectedItem.ImagesPaths)
                {
                    if (!check && p.Checked)
                        check = true;
                    else if (check)
                        p.Checked = false;
                }

                int index = 0;
                foreach (Poster p in SelectedItem.ImagesPaths)
                {
                    ImageBox imgBox = new ImageBox();
                    imgBox.ImgPoster = p;
                    imgBox.Size = new Size(180, this.picsPanel.Height - 20);
                    imgBox.Location = new Point(180 * index, 0);
                    imgBox.index = index;
                    imgBox.IsSelected = p.Checked;
                    imgBox.OnMouseDownEvent += new MouseEventHandler(imgBox_OnMouseDownEvent);
                    imgBox.OnCheckChanged += new EventHandler(OnCheckChanged);
                    imgBox.OnPictureDeleted += new EventHandler(imageBox1_OnPictureDeleted);
                    imgBox.OnPictureChanged += new EventHandler(imageBox1_OnPictureChanged);
                    this.picsPanel.Controls.Add(imgBox);
                    index++;
                }
            }
            else
                imageBox1.ImgPoster = null;
            UpdateMainPoster();
        }
        private void InitializeWidget(LayoutOrientation orientation)
        {
            sceneBackgroundPanel = new Panel();
            sceneBackgroundPanel.Name = "sceneBackgroundPanel";
            ImageBox_1 = new ImageBox();
            ImageBox_1.Name = "ImageBox_1";
            Button_1 = new Button();
            Button_1.Name = "Button_1";
            ImageBox_7 = new ImageBox();
            ImageBox_7.Name = "ImageBox_7";
            ImageBox_8 = new ImageBox();
            ImageBox_8.Name = "ImageBox_8";
            ImageBox_9 = new ImageBox();
            ImageBox_9.Name = "ImageBox_9";
            ImageBox_10 = new ImageBox();
            ImageBox_10.Name = "ImageBox_10";
            ImageBox_4 = new ImageBox();
            ImageBox_4.Name = "ImageBox_4";

            // sceneBackgroundPanel
            sceneBackgroundPanel.BackgroundColor = new UIColor(0f / 255f, 0f / 255f, 0f / 255f, 255f / 255f);

            // ImageBox_1
            ImageBox_1.Image = new ImageAsset("/Application/assets/new/newUI/authoredHeader.png");
            ImageBox_1.ImageScaleType = ImageScaleType.Center;

            // Button_1
            Button_1.IconImage = new ImageAsset("/Application/assets/new/featureBtns/colorRed.png");
            Button_1.Style = ButtonStyle.Custom;
            Button_1.CustomImage = new CustomButtonImageSettings()
            {
                BackgroundNormalImage = new ImageAsset("/Application/assets/new/featureBtns/colorRed.png"),
                BackgroundPressedImage = new ImageAsset("/Application/assets/new/featureBtns/colorBlue.png"),
                BackgroundDisabledImage = null,
                BackgroundNinePatchMargin = new NinePatchMargin(42, 27, 42, 27),
            };
            Button_1.BackgroundFilterColor = new UIColor(255f / 255f, 255f / 255f, 255f / 255f, 0f / 255f);

            // ImageBox_7
            ImageBox_7.Image = new ImageAsset("/Application/assets/new/featureBtns/animationRed.png");
            ImageBox_7.ImageScaleType = ImageScaleType.Center;

            // ImageBox_8
            ImageBox_8.Image = new ImageAsset("/Application/assets/new/featureBtns/patternRed.png");
            ImageBox_8.ImageScaleType = ImageScaleType.Center;

            // ImageBox_9
            ImageBox_9.Image = new ImageAsset("/Application/assets/new/featureBtns/soundRed.png");
            ImageBox_9.ImageScaleType = ImageScaleType.Center;

            // ImageBox_10
            ImageBox_10.Image = new ImageAsset("/Application/assets/new/featureBtns/particleRed.png");
            ImageBox_10.ImageScaleType = ImageScaleType.Center;

            // ImageBox_4
            ImageBox_4.Image = new ImageAsset("/Application/assets/new/newUI/play.png");
            ImageBox_4.ImageScaleType = ImageScaleType.Center;

            // InfinityMode
            this.RootWidget.AddChildLast(sceneBackgroundPanel);
            this.RootWidget.AddChildLast(ImageBox_1);
            this.RootWidget.AddChildLast(Button_1);
            this.RootWidget.AddChildLast(ImageBox_7);
            this.RootWidget.AddChildLast(ImageBox_8);
            this.RootWidget.AddChildLast(ImageBox_9);
            this.RootWidget.AddChildLast(ImageBox_10);
            this.RootWidget.AddChildLast(ImageBox_4);

            SetWidgetLayout(orientation);

            UpdateLanguage();
        }
Esempio n. 54
0
			internal void OnFilmBoxCreated(DicomUid filmBoxUid, List<DicomUid> imageBoxUids)
			{
				_currentFilmBox.SopInstanceUid = filmBoxUid;

				// The SCP returns a list of imageBoxUids.  Create an imageBox for each UID.
				var imageBoxes = new List<ImageBox>();
				for (var i = 0; i < imageBoxUids.Count; i++)
				{
					var imageBox = new ImageBox(_currentFilmBox, _printItemQueue.Dequeue())
						{
							ImageBoxPosition = (ushort) (i+1),  // position is 1-based
							SopInstanceUid = imageBoxUids[i]
						};
					imageBoxes.Add(imageBox);

					// No more print items.  Stop creating imageBoxes
					if (_printItemQueue.Count == 0)
						break;
				}

				// start setting the first imageBox
				_currentFilmBox.SetImageBoxes(imageBoxes);
				var imageBoxToSet = _currentFilmBox.GetNextImageBox();
				imageBoxToSet.BeforeSet(this.PrintScu.ColorMode);
				this.PrintScu.SetImageBox(imageBoxToSet);
				imageBoxToSet.AfterSet();
			}
Esempio n. 55
0
			public void GetPixelData(ImageBox imageBox, ColorMode colorMode, out ushort rows, out ushort columns, out byte[] pixelData)
			{
				Platform.CheckMemberIsSet(GetPixelDataCallback, "GetPixelDataCallback");
				GetPixelDataCallback(imageBox, colorMode, out rows, out columns, out pixelData);
			}
        private void InitializeWidget(LayoutOrientation orientation)
        {
            ImageBox_1 = new ImageBox();
            ImageBox_1.Name = "ImageBox_1";
            Button_1 = new Button();
            Button_1.Name = "Button_1";
            Button_2 = new Button();
            Button_2.Name = "Button_2";

            // ImageBox_1
            ImageBox_1.Image = new ImageAsset("/Application/assets/images/UI/instructions7.png");
            ImageBox_1.ImageScaleType = ImageScaleType.Center;

            // Button_1
            Button_1.TextColor = new UIColor(255f / 255f, 255f / 255f, 255f / 255f, 255f / 255f);
            Button_1.TextFont = new UIFont(FontAlias.System, 48, FontStyle.Regular);
            Button_1.Style = ButtonStyle.Custom;
            Button_1.CustomImage = new CustomButtonImageSettings()
            {
                BackgroundNormalImage = new ImageAsset("/Application/assets/images/UI/redBtn.png"),
                BackgroundPressedImage = new ImageAsset("/Application/assets/images/UI/redBtnOver.png"),
                BackgroundDisabledImage = null,
                BackgroundNinePatchMargin = new NinePatchMargin(42, 27, 42, 27),
            };

            // Button_2
            Button_2.TextColor = new UIColor(0f / 255f, 0f / 255f, 0f / 255f, 255f / 255f);
            Button_2.TextFont = new UIFont(FontAlias.System, 48, FontStyle.Regular);
            Button_2.Style = ButtonStyle.Custom;
            Button_2.CustomImage = new CustomButtonImageSettings()
            {
                BackgroundNormalImage = new ImageAsset("/Application/assets/images/UI/blueBtn.png"),
                BackgroundPressedImage = new ImageAsset("/Application/assets/images/UI/blueBtnOver.png"),
                BackgroundDisabledImage = null,
                BackgroundNinePatchMargin = new NinePatchMargin(42, 27, 42, 27),
            };

            // Instructions7Panel
            this.BackgroundColor = new UIColor(0f / 255f, 0f / 255f, 0f / 255f, 255f / 255f);
            this.Clip = true;
            this.AddChildLast(ImageBox_1);
            this.AddChildLast(Button_1);
            this.AddChildLast(Button_2);

            SetWidgetLayout(orientation);

            UpdateLanguage();
        }
        public override void UpdateData()
        {
            DisposeControls();
            if (SelectedItem.BackdropImagePaths.IsNonEmpty())
            {
                //Ensure we doesn't have too many checked bd
                int check = 0;
                foreach (Poster p in SelectedItem.BackdropImagePaths)
                {
                    if (p.Checked && check < Config.Instance.MaxBdSaved)
                    {
                        check++;
                    }
                    else if (check >= Config.Instance.MaxBdSaved)
                        p.Checked = false;
                }
                if (!SelectedItem.BackdropImagePaths.Exists(p => p.Checked))
                    SelectedItem.BackdropImagePaths[0].Checked = true;

                int index = 0;
                bool select = false;
                foreach (Poster p in SelectedItem.BackdropImagePaths)
                {
                    ImageBox imgBox = new ImageBox();
                    imgBox.ImgPoster = p;
                    imgBox.Size = new Size(230, this.picsPanel.Height - 20);
                    imgBox.Location = new Point(230 * index, 0);
                    imgBox.index = index;
                    imgBox.IsChecked = p.Checked;
                    if (p.Checked && !select) { select = imgBox.IsSelected = true; }
                    imgBox.OnCheckChanged += new EventHandler(OnCheckChanged);
                    imgBox.OnPictureDeleted += new EventHandler(imgBox_OnPictureDeleted);
                    imgBox.OnPictureChanged += new EventHandler(imgBox_OnPictureChanged);
                    imgBox.OnMouseUpEvent += new MouseEventHandler(imgBox_MouseUp);
                    imgBox.OnMouseDownEvent += new MouseEventHandler(imgBox_MouseDown);
                    imgBox.OnMouseMoveEvent += new MouseEventHandler(imgBox_MouseMove);
                    this.picsPanel.Controls.Add(imgBox);
                    index++;
                    if (index > 15) break; //Don't need too many pics
                }
                UpdateMainPoster();
            }
            else
                imageBox1.ImgPoster = null;
        }
        private void InitializeWidget(LayoutOrientation orientation)
        {
            sceneBackgroundPanel = new Panel();
            sceneBackgroundPanel.Name = "sceneBackgroundPanel";
            playGame = new Button();
            playGame.Name = "playGame";
            ImageBox_1 = new ImageBox();
            ImageBox_1.Name = "ImageBox_1";

            // sceneBackgroundPanel
            sceneBackgroundPanel.BackgroundColor = new UIColor(0f / 255f, 0f / 255f, 0f / 255f, 255f / 255f);

            // playGame
            playGame.IconImage = null;
            playGame.Style = ButtonStyle.Custom;
            playGame.CustomImage = new CustomButtonImageSettings()
            {
                BackgroundNormalImage = new ImageAsset("/Application/assets/images/UI/play.png"),
                BackgroundPressedImage = null,
                BackgroundDisabledImage = null,
                BackgroundNinePatchMargin = new NinePatchMargin(42, 27, 42, 27),
            };

            // ImageBox_1
            ImageBox_1.Image = new ImageAsset("/Application/assets/images/UI/instructions8.png");
            ImageBox_1.ImageScaleType = ImageScaleType.Center;

            // instructions8
            this.RootWidget.AddChildLast(sceneBackgroundPanel);
            this.RootWidget.AddChildLast(playGame);
            this.RootWidget.AddChildLast(ImageBox_1);
            this.Showing += new EventHandler(onShowing);
            this.Shown += new EventHandler(onShown);

            SetWidgetLayout(orientation);

            UpdateLanguage();
        }
        private void InitializeWidget(LayoutOrientation orientation)
        {
            ImageBox_1 = new ImageBox();
            ImageBox_1.Name = "ImageBox_1";

            // ImageBox_1
            ImageBox_1.Image = new ImageAsset("/Application/assets/images/UI/instructions1.png");
            ImageBox_1.ImageScaleType = ImageScaleType.Center;

            // InstructionsPanel
            this.BackgroundColor = new UIColor(0f / 255f, 0f / 255f, 0f / 255f, 255f / 255f);
            this.Clip = true;
            this.AddChildLast(ImageBox_1);

            SetWidgetLayout(orientation);

            UpdateLanguage();
        }
        private void InitializeWidget(LayoutOrientation orientation)
        {
            sceneBackgroundPanel = new Panel();
            sceneBackgroundPanel.Name = "sceneBackgroundPanel";
            LevelSelectTitleText = new Label();
            LevelSelectTitleText.Name = "LevelSelectTitleText";
            ImageBox_1 = new ImageBox();
            ImageBox_1.Name = "ImageBox_1";
            PagePanel_1 = new PagePanel();
            PagePanel_1.Name = "PagePanel_1";
            StartButton = new Button();
            StartButton.Name = "StartButton";
            LevelNumberText = new Label();
            LevelNumberText.Name = "LevelNumberText";
            LevelTimeText = new Label();
            LevelTimeText.Name = "LevelTimeText";
            GradeText = new Label();
            GradeText.Name = "GradeText";
            ScoreText = new Label();
            ScoreText.Name = "ScoreText";
            BackButton = new Button();
            BackButton.Name = "BackButton";
            stats = new Label();
            stats.Name = "stats";
            howToSelect = new Label();
            howToSelect.Name = "howToSelect";
            cubeNumber = new Label();
            cubeNumber.Name = "cubeNumber";

            // sceneBackgroundPanel
            sceneBackgroundPanel.BackgroundColor = new UIColor(0f / 255f, 0f / 255f, 0f / 255f, 255f / 255f);

            // LevelSelectTitleText
            LevelSelectTitleText.TextColor = new UIColor(255f / 255f, 255f / 255f, 255f / 255f, 255f / 255f);
            LevelSelectTitleText.Font = new UIFont(FontAlias.System, 36, FontStyle.Regular);
            LevelSelectTitleText.LineBreak = LineBreak.Character;

            // ImageBox_1
            ImageBox_1.Image = new ImageAsset("/Application/assets/images/UI/statsBox.png");
            ImageBox_1.ImageScaleType = ImageScaleType.Center;

            // StartButton
            StartButton.IconImage = null;
            StartButton.Style = ButtonStyle.Custom;
            StartButton.CustomImage = new CustomButtonImageSettings()
            {
                BackgroundNormalImage = new ImageAsset("/Application/assets/images/UI/start.png"),
                BackgroundPressedImage = new ImageAsset("/Application/assets/images/UI/startOver.png"),
                BackgroundDisabledImage = null,
                BackgroundNinePatchMargin = new NinePatchMargin(42, 27, 42, 27),
            };

            // LevelNumberText
            LevelNumberText.TextColor = new UIColor(255f / 255f, 255f / 255f, 255f / 255f, 255f / 255f);
            LevelNumberText.Font = new UIFont(FontAlias.System, 32, FontStyle.Regular);
            LevelNumberText.LineBreak = LineBreak.Character;
            LevelNumberText.HorizontalAlignment = HorizontalAlignment.Right;

            // LevelTimeText
            LevelTimeText.TextColor = new UIColor(255f / 255f, 255f / 255f, 255f / 255f, 255f / 255f);
            LevelTimeText.Font = new UIFont(FontAlias.System, 24, FontStyle.Regular);
            LevelTimeText.LineBreak = LineBreak.Character;
            LevelTimeText.HorizontalAlignment = HorizontalAlignment.Right;

            // GradeText
            GradeText.TextColor = new UIColor(255f / 255f, 255f / 255f, 255f / 255f, 255f / 255f);
            GradeText.Font = new UIFont(FontAlias.System, 72, FontStyle.Regular);
            GradeText.LineBreak = LineBreak.Character;
            GradeText.HorizontalAlignment = HorizontalAlignment.Right;

            // ScoreText
            ScoreText.TextColor = new UIColor(255f / 255f, 255f / 255f, 255f / 255f, 255f / 255f);
            ScoreText.Font = new UIFont(FontAlias.System, 32, FontStyle.Regular);
            ScoreText.LineBreak = LineBreak.Character;
            ScoreText.HorizontalAlignment = HorizontalAlignment.Right;

            // BackButton
            BackButton.IconImage = null;
            BackButton.Style = ButtonStyle.Custom;
            BackButton.CustomImage = new CustomButtonImageSettings()
            {
                BackgroundNormalImage = new ImageAsset("/Application/assets/images/UI/back.png"),
                BackgroundPressedImage = new ImageAsset("/Application/assets/images/UI/backOver.png"),
                BackgroundDisabledImage = null,
                BackgroundNinePatchMargin = new NinePatchMargin(0, 0, 0, 0),
            };

            // stats
            stats.TextColor = new UIColor(255f / 255f, 255f / 255f, 255f / 255f, 255f / 255f);
            stats.Font = new UIFont(FontAlias.System, 30, FontStyle.Regular);
            stats.LineBreak = LineBreak.Character;
            stats.HorizontalAlignment = HorizontalAlignment.Right;

            // howToSelect
            howToSelect.TextColor = new UIColor(255f / 255f, 255f / 255f, 255f / 255f, 255f / 255f);
            howToSelect.Font = new UIFont(FontAlias.System, 24, FontStyle.Regular);
            howToSelect.LineBreak = LineBreak.Character;

            // cubeNumber
            cubeNumber.TextColor = new UIColor(255f / 255f, 255f / 255f, 255f / 255f, 255f / 255f);
            cubeNumber.Font = new UIFont(FontAlias.System, 32, FontStyle.Regular);
            cubeNumber.LineBreak = LineBreak.Character;

            // LevelSelectScene
            this.RootWidget.AddChildLast(sceneBackgroundPanel);
            this.RootWidget.AddChildLast(LevelSelectTitleText);
            this.RootWidget.AddChildLast(ImageBox_1);
            this.RootWidget.AddChildLast(PagePanel_1);
            this.RootWidget.AddChildLast(StartButton);
            this.RootWidget.AddChildLast(LevelNumberText);
            this.RootWidget.AddChildLast(LevelTimeText);
            this.RootWidget.AddChildLast(GradeText);
            this.RootWidget.AddChildLast(ScoreText);
            this.RootWidget.AddChildLast(BackButton);
            this.RootWidget.AddChildLast(stats);
            this.RootWidget.AddChildLast(howToSelect);
            this.RootWidget.AddChildLast(cubeNumber);

            SetWidgetLayout(orientation);

            UpdateLanguage();
        }