Beispiel #1
0
        void LoadUI()
        {
            main_window = new UI_Window(this);
            {
                grid = new UI_Grid(new Point(15, 15), 470, 405);
                grid.AddColumn("Data", 150, true); grid.AddColumn("IC", 70, true); grid.AddColumn("PH", 70, true);
                grid.AddColumn("Grau alc", 70, true); grid.AddColumn("Densitat produccio", 70, true); grid.AddColumn("Id", 50, true);
                grid.GetElement().Click += new System.EventHandler(this.AnaliticaClick);
                grid.SetFont("Courier New", 8.5f);
                main_window.AddElement(grid);

                data_text = new UI_Text(new Point(500, 20), 30, 120, "Data:");
                data_text.SetFont("Courier New", 8.5f);
                main_window.AddElement(data_text);

                data_dataselect = new UI_DateSelect(new Point(503, 40), 200, 100);
                data_dataselect.SetFont("Courier New", 8.5f);
                main_window.AddElement(data_dataselect);

                intensitat_colorant_text = new UI_Text(new Point(500, 80), 200, 30, "Intensitat colorant:");
                intensitat_colorant_text.SetFont("Courier New", 8.5f);
                main_window.AddElement(intensitat_colorant_text);

                intensitat_colorant_text_input = new UI_MaskedTextInput(new Point(503, 100), 200, 30);
                intensitat_colorant_text_input.SetFont("Courier New", 8.5f);
                main_window.AddElement(intensitat_colorant_text_input);

                ph_text = new UI_Text(new Point(740, 80), 255, 30, "pH:");
                ph_text.SetFont("Courier New", 8.5f);
                main_window.AddElement(ph_text);

                ph_text_input = new UI_MaskedTextInput(new Point(743, 100), 100, 30);
                ph_text_input.SetFont("Courier New", 8.5f);
                main_window.AddElement(ph_text_input);

                grau_text = new UI_Text(new Point(500, 140), 255, 30, "Grau alc:");
                grau_text.SetFont("Courier New", 8.5f);
                main_window.AddElement(grau_text);

                grau_text_input = new UI_MaskedTextInput(new Point(503, 160), 100, 30);
                grau_text_input.SetFont("Courier New", 8.5f);
                main_window.AddElement(grau_text_input);

                densitat_text = new UI_Text(new Point(740, 140), 255, 30, "Densitat prod:");
                densitat_text.SetFont("Courier New", 8.5f);
                main_window.AddElement(densitat_text);

                densitat_text_input = new UI_MaskedTextInput(new Point(743, 160), 100, 30);
                densitat_text_input.SetFont("Courier New", 8.5f);
                main_window.AddElement(densitat_text_input);

                estat_sanitari_text = new UI_Text(new Point(500, 200), 255, 30, "Estat sanitari:");
                estat_sanitari_text.SetFont("Courier New", 8.5f);
                main_window.AddElement(estat_sanitari_text);

                estat_sanitari_text_input = new UI_MaskedTextInput(new Point(503, 220), 450, 30);
                estat_sanitari_text_input.SetFont("Courier New", 8.5f);
                main_window.AddElement(estat_sanitari_text_input);

                observacions_text = new UI_Text(new Point(500, 260), 255, 30, "Observacions:");
                observacions_text.SetFont("Courier New", 8.5f);
                main_window.AddElement(observacions_text);

                observacions_text_input = new UI_TextInput(new Point(503, 290), 450, 130);
                observacions_text_input.SetFont("Courier New", 8.5f);
                main_window.AddElement(observacions_text_input);

                elimina_button = new UI_Button(new Point(353, 431), 160, 25, "Elimina analítica");
                elimina_button.GetElement().Click += new System.EventHandler(this.Elimina);
                elimina_button.AddImage(principal.imageList1, 3);
                elimina_button.SetFont("Courier New", 8.5f);
                main_window.AddElement(elimina_button);

                actualitza_button = new UI_Button(new Point(163, 431), 180, 25, "Actualitza analítica");
                actualitza_button.GetElement().Click += new System.EventHandler(this.Actualitza);
                actualitza_button.AddImage(principal.imageList1, 8);
                actualitza_button.SetFont("Courier New", 8.5f);
                main_window.AddElement(actualitza_button);

                crea_button = new UI_Button(new Point(14, 431), 140, 25, "Crea analítica");
                crea_button.GetElement().Click += new System.EventHandler(this.Crea);
                crea_button.AddImage(principal.imageList1, 6);
                crea_button.SetFont("Courier New", 8.5f);
                main_window.AddElement(crea_button);

                accepta_button = new UI_Button(new Point(840, 431), 120, 25, "Desa i surt");
                accepta_button.GetElement().Click += new System.EventHandler(this.Accepta);
                accepta_button.AddImage(principal.imageList1, 2);
                accepta_button.SetFont("Courier New", 8.5f);
                accepta_button.SetColor(Color.Cornsilk);
                main_window.AddElement(accepta_button);
            }
        }
        public void LoadUI()
        {
            // UI

            // General Map UI Input
            map_win = new UI_Window(this);
            {
                text_input_lat = new UI_MaskedTextInput(new Point(16, 535), 92, 50);
                text_input_lat.GetElement().Anchor = (System.Windows.Forms.AnchorStyles.Left | System.Windows.Forms.AnchorStyles.Bottom);
                text_input_lat.SetFont("Courier New", 8.5f);
                map_win.AddElement(text_input_lat);

                text_input_lon = new UI_MaskedTextInput(new Point(123, 535), 92, 50);
                text_input_lon.GetElement().Anchor = (System.Windows.Forms.AnchorStyles.Left | System.Windows.Forms.AnchorStyles.Bottom);
                text_input_lon.SetFont("Courier New", 8.5f);
                map_win.AddElement(text_input_lon);

                search_button_coor = new UI_Button(new Point(15, 510), 201, 23, "Cerca coordenades");
                search_button_coor.GetElement().Anchor = (System.Windows.Forms.AnchorStyles.Left | System.Windows.Forms.AnchorStyles.Bottom);
                search_button_coor.GetElement().Click += new System.EventHandler(this.SearchLatLon);
                search_button_coor.SetFont("Courier New", 8.5f);
                map_win.AddElement(search_button_coor);

                lat_text = new UI_Text(new Point(16, 560), 193, 40, "Lat");
                lat_text.GetElement().Anchor = (System.Windows.Forms.AnchorStyles.Left | System.Windows.Forms.AnchorStyles.Bottom);
                lat_text.SetFont("Courier New", 8.5f);
                map_win.AddElement(lat_text);

                lon_text = new UI_Text(new Point(123, 560), 193, 40, "Lon");
                lon_text.GetElement().Anchor = (System.Windows.Forms.AnchorStyles.Left | System.Windows.Forms.AnchorStyles.Bottom);
                lon_text.SetFont("Courier New", 8.5f);
                map_win.AddElement(lon_text);

                search_button_name = new UI_Button(new Point(15, 453), 201, 23, "Cerca nom");
                search_button_name.GetElement().Anchor = (System.Windows.Forms.AnchorStyles.Left | System.Windows.Forms.AnchorStyles.Bottom);
                search_button_name.GetElement().Click += new System.EventHandler(this.SearchName);
                search_button_name.SetFont("Courier New", 8.5f);
                map_win.AddElement(search_button_name);

                text_input_nom = new UI_MaskedTextInput(new Point(16, 478), 200, 50);
                text_input_nom.GetElement().Anchor = (System.Windows.Forms.AnchorStyles.Left | System.Windows.Forms.AnchorStyles.Bottom);
                text_input_nom.SetFont("Courier New", 8.5f);
                map_win.AddElement(text_input_nom);

                mapsat_button = new UI_Button(new Point(630, 550), 160, 25, "Canvia a Mapa");
                mapsat_button.GetElement().Anchor = (System.Windows.Forms.AnchorStyles.Right | System.Windows.Forms.AnchorStyles.Bottom);
                mapsat_button.GetElement().Click += new System.EventHandler(this.SwitchMapSat);
                mapsat_button.AddImage(imageList1, 12);
                mapsat_button.SetFont("Courier New", 8.5f);
                map_win.AddElement(mapsat_button);

                imprimir_button = new UI_Button(new Point(523, 550), 100, 25, "Imprimir");
                imprimir_button.GetElement().Anchor = (System.Windows.Forms.AnchorStyles.Right | System.Windows.Forms.AnchorStyles.Bottom);
                imprimir_button.GetElement().Click += new System.EventHandler(this.ImprimirMapa);
                imprimir_button.AddImage(imageList1, 7);
                imprimir_button.SetFont("Courier New", 8.5f);
                map_win.AddElement(imprimir_button);

                imprimir_quadern_camp_button = new UI_Button(new Point(312, 550), 205, 25, "Imprimir quadern de camp");
                imprimir_quadern_camp_button.GetElement().Anchor = (System.Windows.Forms.AnchorStyles.Right | System.Windows.Forms.AnchorStyles.Bottom);
                imprimir_quadern_camp_button.GetElement().Click += new System.EventHandler(this.ImprimirQuadernCamp);
                imprimir_quadern_camp_button.AddImage(imageList1, 5);
                imprimir_quadern_camp_button.SetFont("Courier New", 8.5f);
                map_win.AddElement(imprimir_quadern_camp_button);

                editor_parceles_ultim_guardat = new UI_Text(new Point(520, 505), 100, 25, "");
                editor_parceles_ultim_guardat.GetElement().Anchor = (System.Windows.Forms.AnchorStyles.Right | System.Windows.Forms.AnchorStyles.Bottom);
                editor_parceles_ultim_guardat.SetFont("Courier New", 8.5f);
                map_win.AddElement(editor_parceles_ultim_guardat);

                personal_button = new UI_Button(new Point(216, 550), 90, 25, "Personal");
                personal_button.GetElement().Anchor = (System.Windows.Forms.AnchorStyles.Right | System.Windows.Forms.AnchorStyles.Bottom);
                personal_button.GetElement().Click += new System.EventHandler(this.ObreFinestraPersonal);
                personal_button.AddImage(imageList1, 1);
                personal_button.SetFont("Courier New", 8.5f);
                map_win.AddElement(personal_button);

                maquinaria_button = new UI_Button(new Point(102, 550), 110, 25, "Maquinaria");
                maquinaria_button.GetElement().Anchor = (System.Windows.Forms.AnchorStyles.Right | System.Windows.Forms.AnchorStyles.Bottom);
                maquinaria_button.GetElement().Click += new System.EventHandler(this.ObreFinestraMaquinaria);
                maquinaria_button.AddImage(imageList1, 10);
                maquinaria_button.SetFont("Courier New", 8.5f);
                map_win.AddElement(maquinaria_button);

                brou_button = new UI_Button(new Point(30, 550), 65, 25, "Brou");
                brou_button.GetElement().Anchor = (System.Windows.Forms.AnchorStyles.Right | System.Windows.Forms.AnchorStyles.Bottom);
                brou_button.GetElement().Click += new System.EventHandler(this.ObreFinestraAdobats);
                brou_button.AddImage(imageList1, 11);
                brou_button.SetFont("Courier New", 8.5f);
                map_win.AddElement(brou_button);
            }
            ui_manager.AddUIWindow(map_win);

            // Starting Window
            main_win = new UI_Window(this);
            {
                // Propietaris - Finques
                propietaris_text = new UI_Text(new Point(15, 15), 193, 40, "Propietari: ");
                propietaris_text.GetElement().Anchor = (System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left);
                propietaris_text.SetFont("Courier New", 8.5f);
                main_win.AddElement(propietaris_text);

                seleccio_propietari_noms_combobox = new UI_ComboBox(new Point(15, 35), 200, 80);
                seleccio_propietari_noms_combobox.GetElement().Anchor = (System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left);
                seleccio_propietari_noms_combobox.SetDrowDownVisibleItems(30);
                seleccio_propietari_noms_combobox.DropDown(new System.EventHandler(this.ActualitzaLlistaPropietariEvent));
                seleccio_propietari_noms_combobox.ItemSelected(new System.EventHandler(this.SeleccionaPropietariEvent));
                seleccio_propietari_noms_combobox.SetFont("Courier New", 8.5f);
                main_win.AddElement(seleccio_propietari_noms_combobox);

                finques_text = new UI_Text(new Point(15, 65), 193, 40, "Finca: ");
                finques_text.GetElement().Anchor = (System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left);
                finques_text.SetFont("Courier New", 8.5f);
                main_win.AddElement(finques_text);

                seleccio_finca_noms_combobox = new UI_ComboBox(new Point(15, 84), 200, 100);
                seleccio_finca_noms_combobox.GetElement().Anchor = (System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left);
                seleccio_finca_noms_combobox.SetDrowDownVisibleItems(30);
                seleccio_finca_noms_combobox.DropDown(new System.EventHandler(this.ActualitzaLlistaFinquesEvent));
                seleccio_finca_noms_combobox.ItemSelected(new System.EventHandler(this.SeleccionaFincaEvent));
                seleccio_finca_noms_combobox.SetFont("Courier New", 8.5f);
                main_win.AddElement(seleccio_finca_noms_combobox);

                propietari_finca_neteja = new UI_Button(new Point(15, 110), 60, 22, "Neteja");
                propietari_finca_neteja.GetElement().Click += new System.EventHandler(this.NetejaPropietariFinca);
                propietari_finca_neteja.SetFont("Courier New", 8.5f);
                main_win.AddElement(propietari_finca_neteja);

                divisor_propietari_finca = new UI_Panel(new Point(18, 135), 195, 1);
                divisor_propietari_finca.SetColor(Color.Black);
                main_win.AddElement(divisor_propietari_finca);

                // Varietat
                varietat_text = new UI_Text(new Point(15, 145), 193, 40, "Varietat: ");
                varietat_text.GetElement().Anchor = (System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left);
                varietat_text.SetFont("Courier New", 8.5f);
                main_win.AddElement(varietat_text);

                seleccio_varietat_noms_combobox = new UI_ComboBox(new Point(15, 164), 200, 100);
                seleccio_varietat_noms_combobox.GetElement().Anchor = (System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left);
                seleccio_varietat_noms_combobox.SetDrowDownVisibleItems(30);
                seleccio_varietat_noms_combobox.DropDown(new System.EventHandler(this.ActualitzaLlistaVarietatsEvent));
                seleccio_varietat_noms_combobox.ItemSelected(new System.EventHandler(this.SeleccionaVarietatEvent));
                seleccio_varietat_noms_combobox.SetFont("Courier New", 8.5f);
                main_win.AddElement(seleccio_varietat_noms_combobox);

                varietat_neteja = new UI_Button(new Point(15, 190), 60, 22, "Neteja");
                varietat_neteja.GetElement().Click += new System.EventHandler(this.NetejaVarietat);
                varietat_neteja.SetFont("Courier New", 8.5f);
                main_win.AddElement(varietat_neteja);

                divisor_varietat = new UI_Panel(new Point(18, 215), 195, 1);
                divisor_varietat.SetColor(Color.Black);
                main_win.AddElement(divisor_varietat);

                // Treballs
                treballs_text = new UI_Text(new Point(15, 225), 100, 40, "Treballs: ");
                treballs_text.SetFont("Courier New", 8.5f);
                main_win.AddElement(treballs_text);

                seleccio_treball_noms_combobox = new UI_ComboBox(new Point(15, 245), 200, 100);
                seleccio_treball_noms_combobox.GetElement().Anchor = (System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left);
                seleccio_treball_noms_combobox.SetDrowDownVisibleItems(30);
                seleccio_treball_noms_combobox.DropDown(new System.EventHandler(this.ActualitzaLlistaTreballsEvent));
                seleccio_treball_noms_combobox.ItemSelected(new System.EventHandler(this.SeleccionaTreballEvent));
                seleccio_treball_noms_combobox.SetFont("Courier New", 8.5f);
                main_win.AddElement(seleccio_treball_noms_combobox);

                treball_neteja = new UI_Button(new Point(15, 270), 60, 22, "Neteja");
                treball_neteja.GetElement().Click += new System.EventHandler(this.NetejaTreball);
                treball_neteja.SetFont("Courier New", 8.5f);
                main_win.AddElement(treball_neteja);

                divisor_treball = new UI_Panel(new Point(18, 295), 195, 1);
                divisor_treball.SetColor(Color.Black);
                main_win.AddElement(divisor_treball);

                // Any vinya
                any_vinya_text = new UI_Text(new Point(15, 305), 100, 40, "Any: ");
                any_vinya_text.SetFont("Courier New", 8.5f);
                main_win.AddElement(any_vinya_text);

                a_vinya_text = new UI_Text(new Point(110, 332), 100, 40, "a");
                a_vinya_text.SetFont("Courier New", 8.5f);
                main_win.AddElement(a_vinya_text);

                any_comença = new UI_MaskedTextInput(new Point(16, 325), 92, 40, "1900");
                any_comença.OnLostFocus(ActualitzaLlistaParcelesEvent);
                any_comença.SetFont("Courier New", 8.5f);
                main_win.AddElement(any_comença);

                any_acaba = new UI_MaskedTextInput(new Point(125, 325), 90, 40, DateTime.Now.Year.ToString());
                any_acaba.OnLostFocus(ActualitzaLlistaParcelesEvent);
                any_acaba.SetFont("Courier New", 8.5f);
                main_win.AddElement(any_acaba);

                divisor_any_vinya = new UI_Panel(new Point(18, 350), 195, 1);
                divisor_any_vinya.SetColor(Color.Black);
                main_win.AddElement(divisor_any_vinya);

                // Parceles
                llista_parceles_text = new UI_Text(new Point(15, 355), 200, 30, "Parceles:");
                llista_parceles_text.SetFont("Courier New", 8.5f);
                main_win.AddElement(llista_parceles_text);

                llista_parceles_llista = new UI_ListBox(new Point(15, 375), 200, 80);
                llista_parceles_llista.GetElement().Click += new System.EventHandler(this.ParcelaClick);
                llista_parceles_llista.GetElement().Anchor = (System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left | System.Windows.Forms.AnchorStyles.Bottom);
                llista_parceles_llista.SetFont("Courier New", 8.5f);
                main_win.AddElement(llista_parceles_llista);

                // Editor parceles
                editor_parceles_panel = new UI_Panel(new Point(229, 0), 380, 30);
                editor_parceles_panel.GetElement().Anchor = (System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left);
                main_win.AddElement(editor_parceles_panel);
                {
                    editor_parceles_crea_button = new UI_Button(new Point(5, 3), 120, 25, "Crea parcela");
                    editor_parceles_crea_button.SetColor(Color.Cornsilk);
                    editor_parceles_crea_button.GetElement().Click += new System.EventHandler(this.CreaParcela);
                    editor_parceles_crea_button.SetFont("Courier New", 8.5f);
                    editor_parceles_panel.AddElement(editor_parceles_crea_button);

                    editor_parceles_elimina_button = new UI_Button(new Point(130, 3), 120, 25, "Elimina parcela");
                    editor_parceles_elimina_button.SetColor(Color.Cornsilk);
                    editor_parceles_elimina_button.GetElement().Click += new System.EventHandler(this.EliminaParcela);
                    editor_parceles_elimina_button.SetFont("Courier New", 8.5f);
                    editor_parceles_panel.AddElement(editor_parceles_elimina_button);

                    editor_parceles_guarda_button = new UI_Button(new Point(255, 3), 120, 25, "Guarda canvis");
                    editor_parceles_guarda_button.SetColor(Color.Cornsilk);
                    editor_parceles_guarda_button.GetElement().Click += new System.EventHandler(this.GuardaCanvis);
                    editor_parceles_guarda_button.SetFont("Courier New", 8.5f);
                    editor_parceles_panel.AddElement(editor_parceles_guarda_button);
                }
                editor_parceles_panel.SetVisible(false);

                // Parceles / Partes seleccionades / Analitiques
                parceles_seleccionades_panel = new UI_Panel(new Point(630, 0), 190, 480);
                parceles_seleccionades_panel.GetElement().Anchor = (System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right | System.Windows.Forms.AnchorStyles.Bottom);
                {
                    afegir_partes_button = new UI_Button(new Point(5, 5), 160, 30, "Afegir partes");
                    afegir_partes_button.SetColor(Color.Cornsilk);
                    afegir_partes_button.GetElement().Click += new System.EventHandler(this.ObreFormPartes);
                    afegir_partes_button.SetFont("Courier New", 8.5f);
                    afegir_partes_button.AddImage(imageList1, 0);
                    parceles_seleccionades_panel.AddElement(afegir_partes_button);

                    elimina_parte_button = new UI_Button(new Point(5, 37), 160, 30, "Elimina parte");
                    elimina_parte_button.SetColor(Color.Cornsilk);
                    elimina_parte_button.GetElement().Click += new System.EventHandler(this.EliminaParte);
                    elimina_parte_button.SetEnabled(false);
                    elimina_parte_button.AddImage(imageList1, 3);
                    elimina_parte_button.SetFont("Courier New", 8.5f);
                    parceles_seleccionades_panel.AddElement(elimina_parte_button);

                    visualitza_analitiques_button = new UI_Button(new Point(5, 71), 160, 40, "Analítiques");
                    visualitza_analitiques_button.SetColor(Color.Cornsilk);
                    visualitza_analitiques_button.GetElement().Click += new System.EventHandler(this.ObreFormVisualitzaAnalitiques);
                    visualitza_analitiques_button.AddImage(imageList1, 11);
                    visualitza_analitiques_button.SetFont("Courier New", 8.5f);
                    parceles_seleccionades_panel.AddElement(visualitza_analitiques_button);

                    parceles_selecionades_text = new UI_Text(new Point(2, 140), 100, 30, "Parceles seleccionades:");
                    parceles_selecionades_text.SetFont("Courier New", 8.5f);
                    parceles_seleccionades_panel.AddElement(parceles_selecionades_text);

                    parceles_seleccionades_listbox = new UI_ListBox(new Point(0, 160), 170, 150);
                    parceles_seleccionades_listbox.GetElement().Anchor = (System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right);
                    parceles_seleccionades_listbox.SetAutoSize(true);
                    parceles_seleccionades_listbox.SetFont("Courier New", 8.5f);
                    parceles_seleccionades_panel.AddElement(parceles_seleccionades_listbox);

                    ha_parceles_seleccionades_text = new UI_Text(new Point(2, 310), 100, 30, "Ha totals:");
                    ha_parceles_seleccionades_text.SetFont("Courier New", 8.5f);
                    parceles_seleccionades_panel.AddElement(ha_parceles_seleccionades_text);

                    ha_valor_parceles_seleccionades_text = new UI_Text(new Point(82, 310), 150, 30, "0");
                    ha_valor_parceles_seleccionades_text.SetFont("Courier New", 8.5f);
                    parceles_seleccionades_panel.AddElement(ha_valor_parceles_seleccionades_text);

                    partes_seleccionats_text = new UI_Text(new Point(2, 340), 100, 10, "Partes:");
                    partes_seleccionats_text.SetFont("Courier New", 8.5f);
                    parceles_seleccionades_panel.AddElement(partes_seleccionats_text);

                    partes_seleccionats_listbox = new UI_ListBox(new Point(0, 360), 170, 150);
                    partes_seleccionats_listbox.GetElement().Anchor = (System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right | System.Windows.Forms.AnchorStyles.Bottom);
                    partes_seleccionats_listbox.SetAutoSize(true);
                    partes_seleccionats_listbox.GetElement().Click       += new System.EventHandler(ClickParte);
                    partes_seleccionats_listbox.GetElement().DoubleClick += new System.EventHandler(ObreFormInfoPartes);
                    partes_seleccionats_listbox.SetFont("Courier New", 8.5f);
                    parceles_seleccionades_panel.AddElement(partes_seleccionats_listbox);
                }
                main_win.AddElement(parceles_seleccionades_panel);
                parceles_seleccionades_panel.SetVisible(false);
            }
            ui_manager.AddUIWindow(main_win);

            // Finestra confirmacio canvis guardats
            guarda_canvis_win = new UI_Window(this);
            {
                guarda_canvis_panel = new UI_Panel(new Point(400, 220), 230, 70);
                guarda_canvis_panel.SetColor(Color.Cornsilk);
                guarda_canvis_panel.GetElement().Anchor = (System.Windows.Forms.AnchorStyles.None);
                guarda_canvis_panel.GetElement().Dock   = System.Windows.Forms.DockStyle.None;
                guarda_canvis_panel.SetFont("Courier New", 8.5f);
                guarda_canvis_win.AddElement(guarda_canvis_panel);

                guarda_canvis_text = new UI_Text(new Point(5, 7), 25, 100, "Canvis guardats correctament");
                guarda_canvis_text.SetTextSize(12);
                guarda_canvis_text.SetFont("Courier New", 8.5f);
                guarda_canvis_panel.AddElement(guarda_canvis_text);

                guarda_canvis_button = new UI_Button(new Point(58, 35), 120, 30, "D'acord");
                guarda_canvis_button.GetElement().Click += new System.EventHandler(this.ConfirmaGuardaCanvis);
                guarda_canvis_button.SetFont("Courier New", 8.5f);
                guarda_canvis_panel.AddElement(guarda_canvis_button);
            }
            ui_manager.AddUIWindow(guarda_canvis_win);
            guarda_canvis_win.SetVisible(false);

            // Always on bottom
            gmap.SendToBack();
        }
        public void LoadUI()
        {
            main_window = new UI_Window(this);
            {
                propietari_text = new UI_Text(new Point(20, 15), 200, 30, "Propietari:");
                propietari_text.SetFont("Courier New", 8.5f);
                main_window.AddElement(propietari_text);

                finca_text = new UI_Text(new Point(400, 15), 200, 30, "Finca:");
                finca_text.SetFont("Courier New", 8.5f);
                main_window.AddElement(finca_text);

                propietari_nom_text = new UI_Text(new Point(120, 15), 200, 30, "TOMAS DEOSDAT OMEDES");
                propietari_nom_text.SetFont("Courier New", 8.5f);
                main_window.AddElement(propietari_nom_text);

                finca_nom_text = new UI_Text(new Point(456, 15), 200, 30, "FINCA1");
                finca_nom_text.SetFont("Courier New", 8.5f);
                main_window.AddElement(finca_nom_text);

                treballs_text = new UI_Text(new Point(20, 50), 80, 100, "Treball:");
                treballs_text.SetFont("Courier New", 8.5f);
                main_window.AddElement(treballs_text);

                treballs_combobox = new UI_ComboBox(new Point(25, 70), 180, 40);
                treballs_combobox.SetFont("Courier New", 8.5f);
                main_window.AddElement(treballs_combobox);

                data_text = new UI_Text(new Point(240, 50), 30, 100, "Data:");
                data_text.SetFont("Courier New", 8.5f);
                main_window.AddElement(data_text);

                data_dataselect = new UI_DateSelect(new Point(242, 70), 200, 100);
                data_dataselect.SetFont("Courier New", 8.5f);
                main_window.AddElement(data_dataselect);

                descripcio_text = new UI_Text(new Point(20, 110), 100, 80, "Descripció:");
                descripcio_text.SetFont("Courier New", 8.5f);
                main_window.AddElement(descripcio_text);

                descripcio_text_input = new UI_TextInput(new Point(22, 130), 421, 70);
                descripcio_text_input.SetFont("Courier New", 8.5f);
                main_window.AddElement(descripcio_text_input);

                eficacia_text = new UI_Text(new Point(460, 110), 100, 40, "Eficacia:");
                eficacia_text.SetFont("Courier New", 8.5f);
                main_window.AddElement(eficacia_text);

                eficacia_combobox = new UI_ComboBox(new Point(460, 130), 150, 30);
                eficacia_combobox.SetFont("Courier New", 8.5f);
                main_window.AddElement(eficacia_combobox);

                adob_text = new UI_Text(new Point(660, 110), 100, 40, "Adob:");
                adob_text.SetFont("Courier New", 8.5f);
                main_window.AddElement(adob_text);

                adob_combobox = new UI_ComboBox(new Point(660, 130), 150, 30);
                adob_combobox.SetFont("Courier New", 8.5f);
                main_window.AddElement(adob_combobox);

                personal_text = new UI_Text(new Point(460, 160), 160, 40, "Personal:");
                personal_text.SetFont("Courier New", 8.5f);
                main_window.AddElement(personal_text);

                personal_combobox = new UI_ComboBox(new Point(460, 180), 150, 30);
                personal_combobox.SetFont("Courier New", 8.5f);
                main_window.AddElement(personal_combobox);

                maquinaria_text = new UI_Text(new Point(660, 160), 160, 40, "Maquinaria:");
                maquinaria_text.SetFont("Courier New", 8.5f);
                main_window.AddElement(maquinaria_text);

                maquinaria_combobox = new UI_ComboBox(new Point(660, 180), 150, 30);
                maquinaria_combobox.SetFont("Courier New", 8.5f);
                main_window.AddElement(maquinaria_combobox);

                unitats_text = new UI_Text(new Point(20, 212), 100, 80, "Unitats:");
                unitats_text.SetFont("Courier New", 8.5f);
                main_window.AddElement(unitats_text);

                unitats_mesura_combobox = new UI_ComboBox(new Point(140, 230), 50, 30);
                unitats_mesura_combobox.SetFont("Courier New", 8.5f);
                main_window.AddElement(unitats_mesura_combobox);

                estat_panel = new UI_Panel(new Point(255, 230), 380, 30);
                estat_panel.SetFont("Courier New", 8.5f);
                main_window.AddElement(estat_panel);

                pendent_check = new UI_RadioButton(new Point(0, 0), "Pendent");
                pendent_check.SetFont("Courier New", 8.5f);
                estat_panel.AddElement(pendent_check);
                proces_check = new UI_RadioButton(new Point(120, 0), "Procés");
                proces_check.SetFont("Courier New", 8.5f);
                estat_panel.AddElement(proces_check);
                acabat_check = new UI_RadioButton(new Point(240, 0), "Acabat");
                acabat_check.SetFont("Courier New", 8.5f);
                estat_panel.AddElement(acabat_check);

                fertirrigacio_checkbox = new UI_CheckBox(new Point(640, 225), 130, 30, "Fertirrigacio");
                fertirrigacio_checkbox.SetFont("Courier New", 8.5f);
                main_window.AddElement(fertirrigacio_checkbox);

                unitats_text_input = new UI_MaskedTextInput(new Point(22, 230), 100, 70);
                unitats_text_input.SetFont("Courier New", 8.5f);
                main_window.AddElement(unitats_text_input);

                remove_treball_button = new UI_Button(new Point(160, 475), 130, 25, "Elimina parte");
                remove_treball_button.AddImage(principal.imageList1, 3);
                remove_treball_button.SetFont("Courier New", 8.5f);
                remove_treball_button.GetElement().Click += new System.EventHandler(this.EliminaLineaParte);
                main_window.AddElement(remove_treball_button);

                modifica_treball_button = new UI_Button(new Point(21, 475), 130, 25, "Modifica parte");
                modifica_treball_button.AddImage(principal.imageList1, 8);
                modifica_treball_button.SetFont("Courier New", 8.5f);
                modifica_treball_button.GetElement().Click += new System.EventHandler(this.ModificaParteSeleccionat);
                main_window.AddElement(modifica_treball_button);

                grid = new UI_Grid(new Point(22, 260), 870, 200);
                grid.AddColumn("Treball", 70, true); grid.AddColumn("Descripció", 300); grid.AddColumn("Unitats", 200); grid.AddColumn("tblLinea", 0, true, false);
                grid.AddColumn("Unitat Metrica", 130, true); grid.AddColumn("Estat", 200, true); grid.AddColumn("Parcela viti", 100, true); grid.AddColumn("Ha", 60, true);
                grid.AddColumn("Fertirrigació", 100, true); grid.AddColumn("Eficacia tractament", 70, true);
                grid.AddColumn("Aplicador", 100, true); grid.AddColumn("Maquinaria", 100, true); grid.AddColumn("Adob", 100, true);
                grid.GetElement().Click += new System.EventHandler(this.LineaParteClick);
                grid.SetFont("Courier New", 8.5f);
                main_window.AddElement(grid);

                accepta_button = new UI_Button(new Point(773, 475), 120, 25, "Desa i surt");
                accepta_button.AddImage(principal.imageList1, 2);
                accepta_button.SetFont("Courier New", 8.5f);
                accepta_button.SetColor(Color.Cornsilk);
                accepta_button.GetElement().Click += new System.EventHandler(this.Accepta);
                main_window.AddElement(accepta_button);
            }
        }
        public void LoadUI()
        {
            main_window = new UI_Window(this);
            {
                treballs_text = new UI_Text(new Point(20, 10), 30, 100, "Treball:");
                treballs_text.SetFont("Courier New", 8.5f);
                main_window.AddElement(treballs_text);

                treballs_combobox = new UI_ComboBox(new Point(25, 30), 180, 40);
                treballs_combobox.SetFont("Courier New", 8.5f);
                main_window.AddElement(treballs_combobox);

                data_text = new UI_Text(new Point(240, 10), 30, 100, "Data:");
                data_text.SetFont("Courier New", 8.5f);
                main_window.AddElement(data_text);

                data_dataselect = new UI_DateSelect(new Point(242, 30), 200, 100);
                data_dataselect.SetFont("Courier New", 8.5f);
                main_window.AddElement(data_dataselect);

                estat_panel = new UI_Panel(new Point(25, 60), 380, 40);
                main_window.AddElement(estat_panel);

                pendent_check = new UI_RadioButton(new Point(0, 0), "Pendent");
                pendent_check.SetFont("Courier New", 8.5f);
                estat_panel.AddElement(pendent_check);
                proces_check = new UI_RadioButton(new Point(120, 0), "Procés");
                proces_check.SetFont("Courier New", 8.5f);
                estat_panel.AddElement(proces_check);
                acabat_check = new UI_RadioButton(new Point(240, 0), "Acabat");
                acabat_check.SetFont("Courier New", 8.5f);
                estat_panel.AddElement(acabat_check);


                descripcio_text = new UI_Text(new Point(20, 100), 100, 30, "Descripció:");
                descripcio_text.SetFont("Courier New", 8.5f);
                main_window.AddElement(descripcio_text);

                descripcio_text_input = new UI_TextInput(new Point(22, 120), 421, 70);
                descripcio_text_input.SetFont("Courier New", 8.5f);
                main_window.AddElement(descripcio_text_input);

                add_treball_button = new UI_Button(new Point(463, 120), 30, 30, "+");
                add_treball_button.SetFont("Courier New", 8.5f);
                add_treball_button.GetElement().Click += new System.EventHandler(this.AfegeigParte);
                main_window.AddElement(add_treball_button);

                remove_treball_button = new UI_Button(new Point(463, 160), 30, 30, "-");
                remove_treball_button.SetFont("Courier New", 8.5f);
                remove_treball_button.GetElement().Click += new System.EventHandler(this.EliminaParte);
                main_window.AddElement(remove_treball_button);

                grid = new UI_Grid(new Point(22, 210), 970, 350);

                List <object> unitats    = new List <object>();
                List <object> maquinaria = new List <object>();
                List <object> aplicadors = new List <object>();
                List <object> adobs      = new List <object>();

                for (int i = 0; i < propietaris_manager.GetUnitatsMetriques().Count; i++)
                {
                    unitats.Add(propietaris_manager.GetUnitatsMetriques()[i]);
                }

                for (int i = 0; i < propietaris_manager.GetMaquinaria().Count; i++)
                {
                    maquinaria.Add(propietaris_manager.GetMaquinaria()[i]);
                }

                for (int i = 0; i < propietaris_manager.GetPersonal().Count; i++)
                {
                    aplicadors.Add(propietaris_manager.GetPersonal()[i]);
                }

                for (int i = 0; i < propietaris_manager.GetAdobs().Count; i++)
                {
                    adobs.Add(propietaris_manager.GetAdobs()[i]);
                }

                grid.AddColumn("Treball", 50, true); grid.AddColumn("Descripció", 500); grid.AddColumn("Unitats", 130, false); grid.AddColumn("tblLinea", 0, true, false);
                grid.AddComboBoxColumn("Unitat Metrica", 130, unitats); grid.AddColumn("Parcela viti", 100, true); grid.AddColumn("Ha", 60, true);
                grid.AddCheckBoxColumn("Fertirrigació", 100, false); grid.AddComboBoxColumn("Eficacia tractament", 150, false, "0", "1", "2", "3");
                grid.AddComboBoxColumn("Aplicador", 100, aplicadors); grid.AddComboBoxColumn("Maquinaria", 100, maquinaria);
                grid.AddComboBoxColumn("Adob", 100, adobs);
                grid.SetFont("Courier New", 8.5f);
                main_window.AddElement(grid);

                accepta_button = new UI_Button(new Point(20, 575), 150, 25, "Desa i surt");
                accepta_button.GetElement().Click += new System.EventHandler(this.Accepta);
                accepta_button.AddImage(principal.imageList1, 2);
                accepta_button.SetFont("Courier New", 8.5f);
                accepta_button.SetColor(Color.Cornsilk);
                main_window.AddElement(accepta_button);
            }
        }