コード例 #1
0
        public IHttpActionResult PutColorSelection(long id, ColorSelection colorSelection)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            if (id != colorSelection.Id)
            {
                return(BadRequest());
            }

            db.Entry(colorSelection).State = EntityState.Modified;

            try
            {
                db.SaveChanges();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!ColorSelectionExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(StatusCode(HttpStatusCode.NoContent));
        }
コード例 #2
0
ファイル: AmbilightModes.cs プロジェクト: cha1n3aw/Ambilight
        private int GetSelectedColorsCount()
        {
            int count = 0;

            ColorSelection.Invoke((MethodInvoker) delegate { count = ColorSelection.Items.Count; });
            return(count);
        }
コード例 #3
0
ファイル: AmbilightModes.cs プロジェクト: cha1n3aw/Ambilight
        private object GetSelectedObject()
        {
            object obj = null;

            ColorSelection.Invoke((MethodInvoker) delegate { obj = ColorSelection.SelectedItem; });
            return(obj);
        }
コード例 #4
0
        internal void RemoveColor(ColorSelection part, T obj)
        {
            int nPart = (int)part;

            if (nPart >= 0 && nPart < m_ColorMaps.Length)
            {
                m_ColorMaps[nPart].Remove(obj);
            }
        }
コード例 #5
0
        public IHttpActionResult PostColorSelection(ColorSelection colorSelection)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            db.ColorSelections.Add(colorSelection);
            db.SaveChanges();

            return(CreatedAtRoute("DefaultApi", new { id = colorSelection.Id }, colorSelection));
        }
コード例 #6
0
        partial void SelectTitleColor(NSObject sender)
        {
            var button = sender as UIButton;

            _colorPicker.Title = "Select Color".Localize();
            _colorPicker.ModalPresentationStyle = UIModalPresentationStyle.FormSheet;
            _colorSelection            = (ColorSelection)((int)button.Tag);  // ColorSelection.TITLE;
            _colorPicker.SelectedColor = button.BackgroundColor;


            this.PresentModalViewController(_pickerNav, true);
        }
コード例 #7
0
        public IHttpActionResult GetColorSelection(long id)
        {
            //Todo: Add Authentication
            ColorSelection colorSelection = db.ColorSelections.Find(id);

            if (colorSelection == null)
            {
                return(NotFound());
            }

            return(Ok(colorSelection));
        }
コード例 #8
0
        public async Task <IActionResult> SetColourById(int serverId, [FromBody] ColorSelection colorSelection)
        {
            var server = await _repo.FindById(serverId);

            if (server == null)
            {
                return(new JsonResult(false));
            }
            server.RgbColor = colorSelection.Color;
            await _repo.UpdateRgbColour(server);

            return(new JsonResult(true));
        }
コード例 #9
0
        public IHttpActionResult DeleteColorSelection(int id)
        {
            ColorSelection colorSelection = db.ColorSelections.Find(id);

            if (colorSelection == null)
            {
                return(NotFound());
            }

            db.ColorSelections.Remove(colorSelection);
            db.SaveChanges();

            return(Ok(colorSelection));
        }
コード例 #10
0
        internal void SetColor(ColorSelection part, T obj, Color objColor)
        {
            int nPart = (int)part;

            if (nPart >= 0 && nPart < m_ColorMaps.Length)
            {
                m_ColorMaps[nPart].Remove(obj);

                if (!objColor.IsEmpty)
                {
                    m_ColorMaps[nPart].Add(obj, objColor);
                }
            }
        }
コード例 #11
0
        internal bool GetColor(ColorSelection part, T obj, out Color ObjColor)
        {
            ObjColor = Color.Empty;

            int nPart = (int)part;

            if (nPart >= 0 && nPart < m_ColorMaps.Length)
            {
                return(m_ColorMaps[nPart].TryGetValue(obj, out ObjColor));
            }
            else
            {
                return(false);
            }
        }
コード例 #12
0
        public CadanceDefinitionForm()
        {
            InitializeComponent();
            CurFacilityList = new List <FcFacility>();
            foreach (string c in Enum.GetNames(typeof(CustomUserInterface.ColorOptions)))
            {
                ColorSelection.Items.Add(c);
            }
            ColorSelection.SelectedIndex = 0;
            if (CommonData.CadenceEdit)
            {
                SensorCadance cadance = CreateDuplicateCadance(CommonData.Cadences[CommonData.CadenceSelected]);
                CurFacilityList = cadance.FacilityList;
                PopulateCadance();
                NumOptical.Text  = cadance.NumOptical.ToString();
                NumRadar.Text    = cadance.NumRadars.ToString();
                CadanceName.Text = cadance.Name;

                try
                {
                    if (cadance.CadenceColor != null)
                    {
                        ColorSelection.SelectedIndex = ColorSelection.FindStringExact(cadance.CadenceColor);
                    }
                    else
                    {
                        ColorSelection.SelectedIndex = ColorSelection.Items.Count - 1;
                    }
                }
                catch (Exception)
                {
                    ColorSelection.SelectedIndex = ColorSelection.Items.Count - 1;
                }
            }
            else
            {
                NumOptical.Text  = "0";
                NumRadar.Text    = "0";
                CadanceName.Text = "MyCadence";
            }
            SensorType.Items.Add("Optical");
            SensorType.Items.Add("Radar");
            SensorType.SelectedIndex   = 0;
            DefaultConstraints.Checked = true;
            DefineConstraints.Enabled  = false;

            _onStart = false;
        }
コード例 #13
0
        public LineSetting()
        {
            Name = NameTool.Line;
            if (Settings[Name] == null)
            {
                var color = new ColorSelection(new Point(170, 8), new Size(90, 36));
                color.LabelText = "Цвет: ";
                color.Color     = Color.Red;

                var slider = new Slider(new Point(260, 0), new Size(200, 50), "Размер:", 1, 50);
                slider.Format    = SliderFormat.Pixel;
                slider.BackColor = Color.FromArgb(38, 38, 38);
                slider.Value     = 1;

                Settings[Name] = new Control[] { color, slider };
            }
        }
コード例 #14
0
        private static void GenerateDefaultWorkspace(ApplicationUser user)
        {
            WorkspaceContext db = new WorkspaceContext();
            String           WHITECOLORSTRING = "255,255,255,1";
            Workspace        initWorkspace    = new Workspace();

            initWorkspace.UserId   = user.Email;
            initWorkspace.s        = 1;
            initWorkspace.Filename = Guid.NewGuid().ToString();
            db.Workspaces.Add(initWorkspace);

            ColorSelection initColorSelection = new ColorSelection();

            initColorSelection.WorkspaceId         = initWorkspace.Id;
            initColorSelection.InternalColorString = WHITECOLORSTRING;
            initColorSelection.InternalHSL         = "0,0,0";
            initColorSelection.Favorite            = false;
            db.ColorSelections.Add(initColorSelection);

            for (int i = 0; i < 10; i++)
            {
                initColorSelection                     = new ColorSelection();
                initColorSelection.WorkspaceId         = initWorkspace.Id;
                initColorSelection.InternalColorString = WHITECOLORSTRING;
                initColorSelection.InternalHSL         = "0,0,0";
                initColorSelection.Favorite            = true;
                db.ColorSelections.Add(initColorSelection);
            }
            db.SaveChanges();

            Grid initGrid = new Grid();

            initGrid.WorkspaceId      = initWorkspace.Id;
            initGrid.Width            = 10;
            initGrid.Height           = 10;
            initGrid.HorizontalWeight = 1;
            initGrid.VerticalWeight   = 1;
            initGrid.s = 1;
            initGrid.InternalTopLeftColorString     = WHITECOLORSTRING;
            initGrid.InternalTopRightColorString    = WHITECOLORSTRING;
            initGrid.InternalBottomLeftColorString  = WHITECOLORSTRING;
            initGrid.InternalBottomRightColorString = WHITECOLORSTRING;
            initGrid.Filename = Guid.NewGuid().ToString();
            db.Grids.Add(initGrid);
            db.SaveChanges();
        }
コード例 #15
0
        private void FiltersGrid_CellMouseDown(object sender, DataGridViewCellMouseEventArgs e)
        {
            if (e.RowIndex < 0 || e.ColumnIndex != FiltersGrid.Columns[Columns.Value].Index)
            {
                return;
            }

            DataGridViewRow row = FiltersGrid.Rows[e.RowIndex];

            if (row.Cells[Columns.Action].Value != null && row.Cells[Columns.Action].Value.ToString() == SettingsController.RowArguments.Colour.ToString())
            {
                if (ColorSelection.ShowDialog() == DialogResult.OK)
                {
                    Color  c   = ColorSelection.Color;
                    string hex = "#" + c.R.ToString("X2") + c.G.ToString("X2") + c.B.ToString("X2");
                    row.Cells[Columns.Value].Style.BackColor = c;
                }
            }
        }
コード例 #16
0
ファイル: Program.cs プロジェクト: simo-andreev/ColourizmusS
        public static void Main(string[] args)
        {
            Application.Init();
            ColorSelectionDialog colorSelectionDialog = new ColorSelectionDialog("Colourizmus S+");

            colorSelectionDialog.Close       += CloseProgram;
            colorSelectionDialog.DeleteEvent += CloseProgram;

            colorSelectionDialog.OkButton.Clicked += CopyToClipboard;

            colorSelectionDialog.CancelButton.Hide();
            colorSelectionDialog.OkButton.Label = "Copy to clipboard";

            _colorSelection = colorSelectionDialog.ColorSelection;
            _colorSelection.ColorChanged += CopyToClipboard;

            colorSelectionDialog.Show();
            Application.Run();
        }
コード例 #17
0
    private ColorType GetColorType(ColorSelection colorSelection, ColorPicker colorPicker)
    {
        switch (colorSelection)
        {
        case ColorSelection.Slime:
            return(colorPicker.Slime);

        case ColorSelection.Salmon:
            return(colorPicker.Salmon);

        case ColorSelection.Marine:
            return(colorPicker.Marine);

        case ColorSelection.Dusk:
            return(colorPicker.Dusk);

        default:
            throw new ArgumentOutOfRangeException(nameof(colorSelection), colorSelection, null);
        }
    }
コード例 #18
0
        public void SetBackgroundColor(ColorSelection color, string customColor)
        {
            RemoveEventHandlers();
            //reset the combo box -choose actual color, or custom if none of the combobox items match
            if (color == ColorSelection.Custom)
            {
                cmbColour.Text      = ColorSelection.Custom.ToString();
                txtBGColour.Enabled = true;
                txtBGColour.Text    = customColor;
            }
            else if (color == ColorSelection.Default)
            {
                cmbColour.Text = ColorSelection.Default.ToString();
            }
            else
            {
                cmbColour.Text = color.ToString();
            }

            AddEventHandlers();
        }
コード例 #19
0
        public RectangleSetting(NameTool name = NameTool.Rectangle)
        {
            Name = name;
            if (Settings[Name] == null)
            {
                var borderColor = new ColorSelection(new Point(170, 8), new Size(90, 36));
                borderColor.LabelText = "Рамка:";
                borderColor.Color     = Color.Crimson;

                var fillColor = new ColorSelection(new Point(260, 8), new Size(110, 36));
                fillColor.LabelText = "Заливка:";
                fillColor.Color     = Color.Yellow;

                var slider = new Slider(new Point(370, 0), new Size(200, 50), "Размер:", 0, 100);
                slider.Format    = SliderFormat.Pixel;
                slider.BackColor = Color.FromArgb(38, 38, 38);
                slider.Value     = 5;

                Settings[Name] = new Control[] { slider, borderColor, fillColor };
            }
        }
コード例 #20
0
        public menuSelector_Settings()
        {
            atTop_Color    = true;
            atBottom_Color = false;

            atTop_Music    = true;
            atBottom_Music = false;

            selector_color        = new Rect();
            selector_color.X      = 25;
            selector_color.Y      = 105;
            selector_color.Height = 15;
            selector_color.Width  = 15;

            selector_music        = new Rect();
            selector_music.X      = 345;
            selector_music.Y      = 105;
            selector_music.Height = 15;
            selector_music.Width  = 15;

            selection_color = ColorSelection.DarkOrange;
            selection_music = MusicSelection.Song1;
        }
コード例 #21
0
        /// <summary>

        /// Shows a dialog box to select a color

        /// </summary>

        /// <returns>The color.</returns>

        static public QuickGTKColor SelectColor()

        {
            ColorSelection ret = null;

            ColorSelectionDialog cdia = new ColorSelectionDialog("Select color");

            cdia.Response += delegate(object o, ResponseArgs resp)

            {
                if (resp.ResponseId == ResponseType.Ok)

                {
                    ret = cdia.ColorSelection; //.CurrentColor;
                }
            };

            cdia.Run();

            cdia.Destroy();

            return(new QuickGTKColor(ret));
        }
コード例 #22
0
ファイル: AmbilightModes.cs プロジェクト: cha1n3aw/Ambilight
 private ComboBox.ObjectCollection GetObjects()
 {
     ComboBox.ObjectCollection obj = null;
     ColorSelection.Invoke((MethodInvoker) delegate { obj = ColorSelection.Items; });
     return(obj);
 }
コード例 #23
0
ファイル: HomeController.cs プロジェクト: baffo88/Funblades
        public ActionResult Index()
        {
            ViewData.Model = getNews();
            ViewData["col"] = new ColorSelection();

            return View();
        }
コード例 #24
0
 public QuickGTKColor(ColorSelection acs)
 {
     cs = acs;
 }
コード例 #25
0
 public InkSample()
 {
     this.InitializeComponent();
     inkCanvas.InkPresenter.InputDeviceTypes = CoreInputDeviceTypes.Mouse | CoreInputDeviceTypes.Touch | CoreInputDeviceTypes.Pen;
     ColorSelection = new ColorSelection(inkCanvas);
 }
コード例 #26
0
        ////////////////////////////////////////////////////////////////////////////////////////////////////
        /// <summary>   Gets the sample Request in this collection. </summary>
        ///
        /// <remarks>   Shivam, 02/18/2018. </remarks>
        ///
        /// <returns>
        ///     An enumerator that allows foreach to be used to process the sample Request in this
        ///     collection.
        /// </returns>
        ////////////////////////////////////////////////////////////////////////////////////////////////////
        // GET: api/SampleRequests
        public List <PublicSampleRequest> GetSampleRequests()
        {
            CloudStorageProvider imageStorage = new CloudStorageProvider(UserManager);
            var user = UserManager.FindById(User.Identity.GetUserId());
            List <SampleRequest> SampleRequests = db.SampleRequest.Where(st => st.Owner == user.UserName).ToList <SampleRequest>();


            List <PublicSampleRequest> _PublicSampleRequests = new List <PublicSampleRequest>();

            #region  List Public Sample Request
            foreach (var SampleRequest in SampleRequests)
            {
                PublicSampleRequest _PublicSampleRequest = new PublicSampleRequest();

                _PublicSampleRequest.Id             = SampleRequest.Id;
                _PublicSampleRequest.Owner          = SampleRequest.Owner;
                _PublicSampleRequest.ProjectName    = SampleRequest.ProjectName;
                _PublicSampleRequest.Notes          = SampleRequest.Notes;
                _PublicSampleRequest.Status         = SampleRequest.Status;
                _PublicSampleRequest.SubmissionDate = SampleRequest.SubmissionDate;
                _PublicSampleRequest.CreatedDate    = SampleRequest.CreatedDate;
                _PublicSampleRequest.ModifiedDate   = SampleRequest.ModifiedDate;

                //Get asset

                List <PublicRequestAsset> _PublicRequestAssets = new List <PublicRequestAsset>();
                #region  List Public Request Assets
                //foreach (SampleRequestAsset _SampleRequestAsset in SampleRequest.SampleRequestAsset.ToList()) Where(st => st.RequestId == _PublicSampleRequest.Id).
                foreach (SampleRequestAsset _SampleRequestAsset in db.SampleRequestAsset.Where(st => st.RequestId == _PublicSampleRequest.Id).ToList())
                {
                    PublicRequestAsset _PublicRequestAsset = new PublicRequestAsset();

                    switch (_SampleRequestAsset.AssetType)
                    {
                    case "Product":
                        _PublicRequestAsset.Id         = _SampleRequestAsset.Id;
                        _PublicRequestAsset.AssetId    = _SampleRequestAsset.AssetId;
                        _PublicRequestAsset.AssetTitle = _SampleRequestAsset.Notes;

                        Product product = db.Products.Find(_SampleRequestAsset.AssetId);
                        if (product != null)
                        {
                            string assetType = "Products";
                            product = imageStorage.getImage(user.UserName, assetType, product);
                            //product = imageStorage.getImage("Techmer", "ProductTemplates", product, true);

                            _PublicRequestAsset.Assetbackground = product.ProductTemplate.Image;
                        }
                        //_PublicRequestAsset.Assetbackground = "";
                        _PublicRequestAsset.AssetType = _SampleRequestAsset.AssetType;
                        _PublicRequestAssets.Add(_PublicRequestAsset);

                        break;

                    case "Grid":
                        Grid grid = db.Grids.Find(_SampleRequestAsset.AssetId);
                        //CloudStorageProvider imageStorage = new CloudStorageProvider(UserManager);
                        //var user = UserManager.FindById(User.Identity.GetUserId());
                        grid.Image = imageStorage.getImage(user.UserName, "Grids", grid);
                        _PublicRequestAsset.AssetId         = _SampleRequestAsset.AssetId;
                        _PublicRequestAsset.AssetTitle      = _SampleRequestAsset.Notes;
                        _PublicRequestAsset.Assetbackground = grid.Image;
                        _PublicRequestAsset.AssetType       = _SampleRequestAsset.AssetType;
                        _PublicRequestAssets.Add(_PublicRequestAsset);


                        break;

                    case "Color":
                        ColorSelection colorselection = db.ColorSelections.Find(_SampleRequestAsset.AssetId);
                        _PublicRequestAsset.AssetId         = _SampleRequestAsset.AssetId;
                        _PublicRequestAsset.AssetTitle      = _SampleRequestAsset.Notes;
                        _PublicRequestAsset.Assetbackground = colorselection.ColorStyle;
                        _PublicRequestAsset.AssetType       = _SampleRequestAsset.AssetType;
                        _PublicRequestAssets.Add(_PublicRequestAsset);
                        break;
                    }
                }
                _PublicSampleRequest.PublicRequestAssetlist = _PublicRequestAssets;

                #endregion

                _PublicSampleRequests.Add(_PublicSampleRequest);
            }

            #endregion


            return(_PublicSampleRequests);
        }