Example #1
0
        public static async Task <PetNotesModel> AddNewRecord()
        {
            PetNotesModel newRecord = new PetNotesModel()
            {
                PetNotesID     = PetNotesConfig.textboxProperties.DefaultPrefixName + _groupControlID,
                ControlGroupID = _groupControlID,
                Color          = PetNotesConfig.textboxProperties.Color,
                Notes          = string.Empty,
                IsActive       = true,
                Created        = DateTime.UtcNow,
                Modified       = null
            };

            _dataModel.Add(newRecord);
            return(newRecord);
        }
Example #2
0
        //Variables
        //Form data
        //Data

        public static void AddControl(PetNotesModel _data)
        {
            TextBox newTextbox = new TextBox()
            {
                Text        = _data.Notes,
                BorderStyle = BorderStyle.None,
                Multiline   = true,
                Name        = _data.PetNotesID,
                BackColor   = _data.Color,
                Size        = GetSizeByNoteStatus(_data.IsActive),
                Location    = new Point(PetNotesConfig.textboxProperties.X, PetNotesConfig.textboxProperties.Y)
            };

            newTextbox.TextChanged += new System.EventHandler(PetNotesTextbox_TextChanged);
            SharedControlManager.panelControl.Add(newTextbox);
            newTextbox.Focus();
        }
Example #3
0
        //public static async Task AddHeaderCollapseExpandButtons()
        //{
        //  foreach(var c in PetNotesDataAdapter._dataModel) {
        //        await AddControl(c);
        //        if (c.IsActive)
        //            PetNotesConfig.buttonProperties.Y += PetNotesConfig.textboxProperties.DefaultExpandedHeight + PetNotesConfig.panelProperties.DefaultPanelHeight;
        //        else
        //            PetNotesConfig.buttonProperties.Y += PetNotesConfig.textboxProperties.DefaultCollapseHeight + PetNotesConfig.panelProperties.DefaultPanelHeight;
        //    };
        //}


        public static void AddControl(PetNotesModel data)
        {
            Button newButton = new Button()
            {
                Name      = PetNotesConfig.buttonProperties.ExpandCollapsePrefixName + data.ControlGroupID,
                BackColor = System.Drawing.Color.Transparent,
                FlatStyle = System.Windows.Forms.FlatStyle.Flat,
                ForeColor = System.Drawing.Color.Black,
                Location  = new System.Drawing.Point(PetNotesConfig.buttonProperties.X, PetNotesConfig.buttonProperties.Y),
                Size      = new System.Drawing.Size(PetNotesConfig.buttonProperties.Width, PetNotesConfig.buttonProperties.Height),
                TabIndex  = 0,
                Text      = ChangeButtonTextBasedOnStatus(data.IsActive),
                UseVisualStyleBackColor = false
            };

            newButton.Click += new EventHandler(PetNotesExpandCollapse_Click);

            SharedControlManager.panelControl.Add(newButton);
        }