private void SetColot_Click(object param)
 {
     if ((string)param == "Text")
     {
         var             a           = ColorConverter.ConvertFromString(TextColor);
         ColorPickerTool colorPicker = new ColorPickerTool((Color)a);
         if (colorPicker.ShowDialog() == true)
         {
             TextColor = colorPicker.Color.ToString();
         }
     }
     else if ((string)param == "Name")
     {
         var             a           = ColorConverter.ConvertFromString(NameColor);
         ColorPickerTool colorPicker = new ColorPickerTool((Color)a);
         if (colorPicker.ShowDialog() == true)
         {
             NameColor = colorPicker.Color.ToString();
         }
     }
     else if ((string)param == "Back")
     {
         var             a           = ColorConverter.ConvertFromString(BackgroundColor);
         ColorPickerTool colorPicker = new ColorPickerTool((Color)a);
         if (colorPicker.ShowDialog() == true)
         {
             BackgroundColor = colorPicker.Color.ToString();
         }
     }
 }
Ejemplo n.º 2
0
        private void SelectBackground()
        {
            ColorPickerTool colorPickerTool = new ColorPickerTool(Background);

            if (colorPickerTool.ShowDialog() == true)
            {
                Background = colorPickerTool.Color;
            }
        }
Ejemplo n.º 3
0
 private void MenuItem_Click(object sender, RoutedEventArgs e)
 {
     if (sender is MenuItem item)
     {
         if (item.Tag is Color color)
         {
             ColorPickerTool tool = new ColorPickerTool(color);
             if (tool.ShowDialog() == true)
             {
                 item.Tag = tool.Color;
             }
         }
     }
 }
Ejemplo n.º 4
0
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);

            Bundle extras = Intent.Extras;

            spriteName = extras.GetString(GetString(Resource.String.bundle_sprite_name));
            int[] dimensions = extras.GetIntArray(
                GetString(Resource.String.bundle_sprite_dimensions));

            w = dimensions[0];
            h = dimensions[1];

            //SetContentView(Resource.Layout.make_sprite);

            SetContentView(Resource.Layout.activity_make_sprite); // Drawer layout

            drawButton = FindViewById <Button>(Resource.Id.drawButton);
            drawButton.GetLocationOnScreen(buttonLocs);
            drawButton.Touch += OnbuttonPush;
            //// Setup Drawer
            drawerLayout = FindViewById <DrawerLayout>(Resource.Id.drawer_make_sprite);
            ActionBarDrawerToggle toggle = new ActionBarDrawerToggle(this, drawerLayout, null,
                                                                     Resource.String.navigation_drawer_open,
                                                                     Resource.String.navigation_drawer_close);

            drawerLayout.AddDrawerListener(toggle);
            NavigationView navigationView = FindViewById <NavigationView>(Resource.Id.nav_view_create_sprite);

            navigationView.SetNavigationItemSelectedListener(this);

            canvasView = FindViewById <ImageView>(Resource.Id.imageView);
            cursorView = FindViewById <ImageView>(Resource.Id.cursorView);

            SetUpImage(ref this.canvas, ref this.mainSpriteDisplay, ref this.sourceBitmap, canvasView, w, h);

            commandHistory = new CommandHistory();
            //Seems redundant for now
            tools       = new Tool[4];
            tools[0]    = new PencilTool(commandHistory, sourceBitmap);
            tools[1]    = new EraserTool(commandHistory, sourceBitmap);
            tools[2]    = new FillTool(commandHistory, sourceBitmap);
            tools[3]    = new ColorPickerTool(commandHistory, sourceBitmap);
            currentTool = tools[0];

            FrameLayout spriteMainLayout = FindViewById <FrameLayout>(Resource.Id.make_sprite_main_layout);

            spriteMainLayout.Touch += OnSpriteCanvasTouched;

            SetupSideImageViews(Resource.Id.imageViewLeft, sourceBitmap);
            SetupSideImageViews(Resource.Id.imageViewTop, sourceBitmap);
            SetupSideImageViews(Resource.Id.imageViewRight, sourceBitmap);
            SetupSideImageViews(Resource.Id.imageViewBottom, sourceBitmap);

            canvas.DrawARGB(255, 255, 0, 255);

            curX = cursorView.GetX();
            curY = cursorView.GetY();


            SetupButtons();
        }