/// <summary> /// Creates a Gtk.Widget that's used to configure the service. This /// will be used in the Synchronization Preferences. Preferences should /// not automatically be saved by a GConf Property Editor. Preferences /// should be saved when SaveConfiguration () is called. /// </summary> public override Gtk.Widget CreatePreferencesControl() { Gtk.Table table = new Gtk.Table(1, 2, false); table.RowSpacing = 5; table.ColumnSpacing = 10; // Read settings out of gconf string syncPath; if (GetConfigSettings(out syncPath) == false) { syncPath = string.Empty; } Label l = new Label(Catalog.GetString("_Folder Path:")); l.Xalign = 1; table.Attach(l, 0, 1, 0, 1, Gtk.AttachOptions.Fill, Gtk.AttachOptions.Expand | Gtk.AttachOptions.Fill, 0, 0); pathButton = new FileChooserButton(Catalog.GetString("Select Synchronization Folder..."), FileChooserAction.SelectFolder); l.MnemonicWidget = pathButton; pathButton.SetFilename(syncPath); table.Attach(pathButton, 1, 2, 0, 1, Gtk.AttachOptions.Expand | Gtk.AttachOptions.Fill, Gtk.AttachOptions.Expand | Gtk.AttachOptions.Fill, 0, 0); table.ShowAll(); return(table); }
FileChooserButton CreateTestDllButton() { var entry = new FileChooserButton(_("Open..."), FileChooserAction.Open); var testDll = GetVariable <string>("test_dll"); entry.SetFilename(testDll.Value); entry.SelectionChanged += delegate { testDll.Value = entry.Filename ?? testDll.Value; }; return(entry); }
private void LoadPreferences() { nameEntry.Text = Giver.Application.Preferences.UserName; fileLocationButton.SetFilename(Giver.Application.Preferences.ReceiveFileLocation); photoButton.Sensitive = false; webEntry.Sensitive = false; if (Giver.Application.Preferences.PhotoType.CompareTo(Giver.Preferences.Local) == 0) { localButton.Active = true; photoButton.Sensitive = true; /* * Logger.Debug("photo type is local"); * (Glade["local_radiobutton"] as RadioButton).Active = true; * Image photo = new Image(photoLocation); * (Glade["local_radiobutton"] as RadioButton).Image = photo; * //(Glade["photo_local_image"] as Image).SetFromIconName(photoLocation, IconSize.Button); * photoButton * localImage */ } else if (Giver.Application.Preferences.PhotoType.CompareTo(Giver.Preferences.Uri) == 0) { webButton.Active = true; webEntry.Text = Giver.Application.Preferences.PhotoLocation; webEntry.Sensitive = true; } else if (Giver.Application.Preferences.PhotoType.CompareTo(Giver.Preferences.Gravatar) == 0) { gravatarButton.Active = true; gravatarEntry.Text = Giver.Application.Preferences.PhotoLocation; } else { // make this none noneButton.Active = true; } int port = Giver.Application.Preferences.PortNumber; bool is_fixed = port >= 0; anyPortButton.Active = !is_fixed; fixedPortButton.Active = is_fixed; portNumberEntry.Sensitive = is_fixed; if (is_fixed) { portNumberEntry.Text = Giver.Application.Preferences.PortNumber.ToString(); } }
private SettingsUi(Builder builder) : base(builder.GetObject("SettingsUi").Handle) { builder.Autoconnect(this); _buttonOk.Activated += ButtonOk_Activated; _buttonOk.Clicked += ButtonOk_Activated; _buttonCancel.Activated += ButtonCancel_Activated; _buttonCancel.Clicked += ButtonCancel_Activated; _atlasDataChooser.FileSet += AtlasDataChooser_FileSet; if (Program.Settings.AtlasReactorData != null) { _atlasDataChooser.SetFilename(Program.Settings.AtlasReactorData); } VerifyAtlasDataFolder(); }
private void LoadInformation() { string ImageFilename = System.IO.Path.GetFileNameWithoutExtension(ExtensionMethods.ConvertPathSeparatorsToCurrentNativeSeparator(ExportTarget.ItemPath)); this.Title = $"Export Image | {ImageFilename}"; byte[] file = ExportTarget.Extract(); Image = new BLP(file); ExportFormatComboBox.Active = (int)Config.GetDefaultImageFormat(); MipLevelListStore.Clear(); foreach (string mipString in Image.GetMipMapLevelStrings()) { MipLevelListStore.AppendValues(true, mipString); } ExportDirectoryFileChooserButton.SetFilename(Config.GetDefaultExportDirectory()); }
private void LoadInformation() { this.Title = "Export Directory | " + ExportTarget.GetReferencedItemName(); ExportDirectoryFileChooserButton.SetFilename(Config.GetDefaultExportDirectory()); // Load all references foreach (ItemReference childReference in ExportTarget.ChildReferences) { // TODO: Support recursive folder export if (childReference.IsFile) { ItemExportListStore.AppendValues(true, childReference.GetReferencedItemName()); if (!this.ReferenceMapping.ContainsKey(childReference.GetReferencedItemName())) { this.ReferenceMapping.Add(childReference.GetReferencedItemName(), childReference); } } } }
private void InitUI() { try { //Tab1 VBox vboxTab1 = new VBox(false, _boxSpacing) { BorderWidth = (uint)_boxSpacing }; //Ord Entry entryOrd = new Entry(); BOWidgetBox boxLabel = new BOWidgetBox(resources.CustomResources.GetCustomResources(GlobalFramework.Settings["customCultureResourceDefinition"], "global_record_order"), entryOrd); vboxTab1.PackStart(boxLabel, false, false, 0); _crudWidgetList.Add(new GenericCRUDWidgetXPO(boxLabel, _dataSourceRow, "Ord", SettingsApp.RegexIntegerGreaterThanZero, true)); //Code Entry entryCode = new Entry(); BOWidgetBox boxCode = new BOWidgetBox(resources.CustomResources.GetCustomResources(GlobalFramework.Settings["customCultureResourceDefinition"], "global_record_code"), entryCode); vboxTab1.PackStart(boxCode, false, false, 0); _crudWidgetList.Add(new GenericCRUDWidgetXPO(boxCode, _dataSourceRow, "Code", SettingsApp.RegexIntegerGreaterThanZero, true)); //Designation Entry entryDesignation = new Entry(); BOWidgetBox boxDesignation = new BOWidgetBox(resources.CustomResources.GetCustomResources(GlobalFramework.Settings["customCultureResourceDefinition"], "global_designation"), entryDesignation); vboxTab1.PackStart(boxDesignation, false, false, 0); _crudWidgetList.Add(new GenericCRUDWidgetXPO(boxDesignation, _dataSourceRow, "Designation", SettingsApp.RegexAlfaNumeric, true)); //ButtonLabel Entry entryButtonLabel = new Entry(); BOWidgetBox boxButtonLabel = new BOWidgetBox(resources.CustomResources.GetCustomResources(GlobalFramework.Settings["customCultureResourceDefinition"], "global_button_name"), entryButtonLabel); vboxTab1.PackStart(boxButtonLabel, false, false, 0); _crudWidgetList.Add(new GenericCRUDWidgetXPO(boxButtonLabel, _dataSourceRow, "ButtonLabel", SettingsApp.RegexAlfaNumericExtended, false)); //ButtonImage FileChooserButton fileChooserButtonImage = new FileChooserButton(string.Empty, FileChooserAction.Open) { HeightRequest = 23 }; Image fileChooserImagePreviewButtonImage = new Image() { WidthRequest = _sizefileChooserPreview.Width, HeightRequest = _sizefileChooserPreview.Height }; Frame fileChooserFrameImagePreviewButtonImage = new Frame(); fileChooserFrameImagePreviewButtonImage.ShadowType = ShadowType.None; fileChooserFrameImagePreviewButtonImage.Add(fileChooserImagePreviewButtonImage); fileChooserButtonImage.SetFilename(((fin_articlefamily)DataSourceRow).ButtonImage); fileChooserButtonImage.Filter = Utils.GetFileFilterImages(); fileChooserButtonImage.SelectionChanged += (sender, eventArgs) => fileChooserImagePreviewButtonImage.Pixbuf = Utils.ResizeAndCropFileToPixBuf((sender as FileChooserButton).Filename, new System.Drawing.Size(fileChooserImagePreviewButtonImage.WidthRequest, fileChooserImagePreviewButtonImage.HeightRequest)); BOWidgetBox boxfileChooserButtonImage = new BOWidgetBox(resources.CustomResources.GetCustomResources(GlobalFramework.Settings["customCultureResourceDefinition"], "global_button_image"), fileChooserButtonImage); HBox hboxfileChooserAndimagePreviewButtonImage = new HBox(false, _boxSpacing); hboxfileChooserAndimagePreviewButtonImage.PackStart(boxfileChooserButtonImage, true, true, 0); hboxfileChooserAndimagePreviewButtonImage.PackStart(fileChooserFrameImagePreviewButtonImage, false, false, 0); vboxTab1.PackStart(hboxfileChooserAndimagePreviewButtonImage, false, false, 0); _crudWidgetList.Add(new GenericCRUDWidgetXPO(boxfileChooserButtonImage, _dataSourceRow, "ButtonImage", string.Empty, false)); //CommissionGroup XPOComboBox xpoComboBoxCommissionGroup = new XPOComboBox(DataSourceRow.Session, typeof(pos_usercommissiongroup), (DataSourceRow as fin_articlefamily).CommissionGroup, "Designation", null); BOWidgetBox boxCommissionGroup = new BOWidgetBox(resources.CustomResources.GetCustomResources(GlobalFramework.Settings["customCultureResourceDefinition"], "global_commission_group"), xpoComboBoxCommissionGroup); vboxTab1.PackStart(boxCommissionGroup, false, false, 0); _crudWidgetList.Add(new GenericCRUDWidgetXPO(boxCommissionGroup, DataSourceRow, "CommissionGroup", SettingsApp.RegexGuid, false)); //Printer XPOComboBox xpoComboBoxPrinter = new XPOComboBox(DataSourceRow.Session, typeof(sys_configurationprinters), (DataSourceRow as fin_articlefamily).Printer, "Designation", null); BOWidgetBox boxPrinter = new BOWidgetBox(resources.CustomResources.GetCustomResources(GlobalFramework.Settings["customCultureResourceDefinition"], "global_device_printer"), xpoComboBoxPrinter); vboxTab1.PackStart(boxPrinter, false, false, 0); _crudWidgetList.Add(new GenericCRUDWidgetXPO(boxPrinter, DataSourceRow, "Printer", SettingsApp.RegexGuid, false)); //Template XPOComboBox xpoComboBoxTemplate = new XPOComboBox(DataSourceRow.Session, typeof(sys_configurationprinterstemplates), (DataSourceRow as fin_articlefamily).Template, "Designation", null); BOWidgetBox boxTemplate = new BOWidgetBox(resources.CustomResources.GetCustomResources(GlobalFramework.Settings["customCultureResourceDefinition"], "global_ConfigurationPrintersTemplates"), xpoComboBoxTemplate); vboxTab1.PackStart(boxTemplate, false, false, 0); _crudWidgetList.Add(new GenericCRUDWidgetXPO(boxTemplate, DataSourceRow, "Template", SettingsApp.RegexGuid, false)); //Disabled CheckButton checkButtonDisabled = new CheckButton(resources.CustomResources.GetCustomResources(GlobalFramework.Settings["customCultureResourceDefinition"], "global_record_disabled")); if (_dialogMode == DialogMode.Insert) { checkButtonDisabled.Active = SettingsApp.BOXPOObjectsStartDisabled; } vboxTab1.PackStart(checkButtonDisabled, false, false, 0); _crudWidgetList.Add(new GenericCRUDWidgetXPO(checkButtonDisabled, _dataSourceRow, "Disabled")); //Append Tab _notebook.AppendPage(vboxTab1, new Label(resources.CustomResources.GetCustomResources(GlobalFramework.Settings["customCultureResourceDefinition"], "global_record_main_detail"))); } catch (System.Exception ex) { _log.Error(ex.Message, ex); } }
public PreferenceDialog() : base("main_preferences") { tag_button = new MenuButton(); LoadPreference(Preferences.METADATA_EMBED_IN_IMAGE); LoadPreference(Preferences.COLOR_MANAGEMENT_ENABLED); LoadPreference(Preferences.COLOR_MANAGEMENT_USE_X_PROFILE); LoadPreference(Preferences.SCREENSAVER_TAG); LoadPreference(Preferences.GNOME_SCREENSAVER_THEME); if (Global.PhotoDirectory == Preferences.Get <string> (Preferences.STORAGE_PATH)) { photosdir_chooser.CurrentFolderChanged += HandlePhotosdirChanged; photosdir_chooser.SetCurrentFolder(Global.PhotoDirectory); } else { photosdir_chooser.SetCurrentFolder(Global.PhotoDirectory); photosdir_chooser.Sensitive = false; } Gtk.CellRendererText name_cell = new Gtk.CellRendererText(); Gtk.CellRendererText desc_cell = new Gtk.CellRendererText(); use_x_profile_check.Sensitive = colormanagement_check.Active; display_combo.Sensitive = colormanagement_check.Active; display_combo.Model = new ProfileList(); display_combo.PackStart(desc_cell, false); display_combo.PackStart(name_cell, true); display_combo.SetCellDataFunc(name_cell, new CellLayoutDataFunc(ProfileList.ProfileNameDataFunc)); //FIXME int it_ = 0; foreach (Cms.Profile profile in FSpot.ColorManagement.Profiles) { if (profile.ProductName == Preferences.Get <string> (Preferences.COLOR_MANAGEMENT_DISPLAY_PROFILE)) { display_combo.Active = it_; } it_++; } display_combo.Changed += HandleDisplayChanged; destination_combo.Sensitive = colormanagement_check.Active; destination_combo.Model = new ProfileList(); destination_combo.PackStart(desc_cell, false); destination_combo.PackStart(name_cell, true); destination_combo.SetCellDataFunc(name_cell, new CellLayoutDataFunc(ProfileList.ProfileNameDataFunc)); destination_combo.Changed += HandleDestinationChanged; //FIXME it_ = 0; foreach (Cms.Profile profile in FSpot.ColorManagement.Profiles) { if (profile.ProductName == Preferences.Get <string> (Preferences.COLOR_MANAGEMENT_OUTPUT_PROFILE)) { destination_combo.Active = it_; } it_++; } TagMenu tagmenu = new TagMenu(null, MainWindow.Toplevel.Database.Tags); tagmenu.Populate(false); tag_button.Menu = tagmenu; tag_button.ShowAll(); tagselectionhbox.Add(tag_button); tagmenu.TagSelected += HandleTagMenuSelected; set_saver_button.Clicked += HandleUseFSpot; screensaverall_radio.Toggled += ToggleTagRadio; themenone_radio.Toggled += ToggleThemeRadio; themelist_combo = ComboBox.NewText(); theme_list = new Dictionary <string, string> (); string gtkrc = Path.Combine("gtk-2.0", "gtkrc"); string [] search = { Path.Combine(Global.HomeDirectory, ".themes"), "/usr/share/themes" }; foreach (string path in search) { if (Directory.Exists(path)) { foreach (string dir in Directory.GetDirectories(path)) { if (File.Exists(Path.Combine(dir, gtkrc)) && !theme_list.ContainsKey(Path.GetFileName(dir))) { theme_list.Add(Path.GetFileName(dir), Path.Combine(dir, gtkrc)); } } } } string active_theme = Preferences.Get <string> (Preferences.GTK_RC); int it = 0; foreach (string theme in theme_list.Keys) { themelist_combo.AppendText(Path.GetFileName(theme)); if (active_theme.Contains(Path.DirectorySeparatorChar + Path.GetFileName(theme) + Path.DirectorySeparatorChar)) { themelist_combo.Active = it; } it++; } theme_table.Attach(themelist_combo, 2, 3, 0, 1); themelist_combo.Changed += HandleThemeComboChanged; themelist_combo.Show(); theme_filechooser.Visible = themefile_label.Visible = FSpot.Utils.Log.Debugging; themelist_combo.Sensitive = theme_filechooser.Sensitive = themecustom_radio.Active; if (File.Exists(active_theme)) { theme_filechooser.SetFilename(Preferences.Get <string> (Preferences.GTK_RC)); } theme_filechooser.SelectionChanged += HandleThemeFileActivated; themecustom_radio.Active = (active_theme != String.Empty); #if GTK_2_12_2 restartlabel.Visible = false; #endif #if DEBUGTHEMES refreshtheme_button = true; #endif Preferences.SettingChanged += OnPreferencesChanged; this.Dialog.Destroyed += HandleDestroyed; }
private void InitUI() { try { //Init Local Vars _article = (_dataSourceRow as FIN_Article); if (_dialogMode != DialogMode.Insert) { //Get totalNumberOfFinanceDocuments to check if article has already used in Finance Documents, to protect name changes etc string sql = string.Format("SELECT COUNT(*) as Count FROM fin_documentfinancedetail WHERE Article = '{0}';", _article.Oid); var sqlResult = GlobalFramework.SessionXpo.ExecuteScalar(sql); _totalNumberOfFinanceDocuments = Convert.ToUInt16(sqlResult); } //::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: //Tab1 VBox vboxTab1 = new VBox(false, _boxSpacing) { BorderWidth = (uint)_boxSpacing }; //Ord Entry entryOrd = new Entry(); BOWidgetBox boxLabel = new BOWidgetBox(Resx.global_record_order, entryOrd); vboxTab1.PackStart(boxLabel, false, false, 0); _crudWidgetList.Add(new GenericCRUDWidgetXPO(boxLabel, _dataSourceRow, "Ord", SettingsApp.RegexIntegerGreaterThanZero, true)); //Code Entry entryCode = new Entry(); BOWidgetBox boxCode = new BOWidgetBox(Resx.global_record_code, entryCode); vboxTab1.PackStart(boxCode, false, false, 0); _crudWidgetList.Add(new GenericCRUDWidgetXPO(boxCode, _dataSourceRow, "Code", SettingsApp.RegexAlfaNumericArticleCode, true)); //CodeDealer Entry entryCodeDealer = new Entry(); BOWidgetBox boxCodeDealer = new BOWidgetBox(Resx.global_record_code_dealer, entryCodeDealer); vboxTab1.PackStart(boxCodeDealer, false, false, 0); _crudWidgetList.Add(new GenericCRUDWidgetXPO(boxCodeDealer, _dataSourceRow, "CodeDealer", SettingsApp.RegexAlfaNumeric, false)); //Designation Entry entryDesignation = new Entry(); BOWidgetBox boxDesignation = new BOWidgetBox(Resx.global_designation, entryDesignation); vboxTab1.PackStart(boxDesignation, false, false, 0); // Changed from RegexAlfaNumeric to RegexAlfaNumericExtended 2017-1011 _crudWidgetList.Add(new GenericCRUDWidgetXPO(boxDesignation, _dataSourceRow, "Designation", SettingsApp.RegexAlfaNumericExtended, true)); //ButtonLabel Entry entryButtonLabel = new Entry(); BOWidgetBox boxButtonLabel = new BOWidgetBox(Resx.global_button_name, entryButtonLabel); vboxTab1.PackStart(boxButtonLabel, false, false, 0); _crudWidgetList.Add(new GenericCRUDWidgetXPO(boxButtonLabel, _dataSourceRow, "ButtonLabel", SettingsApp.RegexAlfaNumericArticleButtonLabel, false)); //Family _xpoComboBoxFamily = new XPOComboBox(DataSourceRow.Session, typeof(FIN_ArticleFamily), (DataSourceRow as FIN_Article).Family, "Designation"); BOWidgetBox boxFamily = new BOWidgetBox(Resx.global_article_family, _xpoComboBoxFamily); vboxTab1.PackStart(boxFamily, false, false, 0); _crudWidgetList.Add(new GenericCRUDWidgetXPO(boxFamily, DataSourceRow, "Family", SettingsApp.RegexGuid, true)); //SubFamily _xpoComboBoxSubFamily = new XPOComboBox(DataSourceRow.Session, typeof(FIN_ArticleSubFamily), (DataSourceRow as FIN_Article).SubFamily, "Designation"); BOWidgetBox boxSubFamily = new BOWidgetBox(Resx.global_article_subfamily, _xpoComboBoxSubFamily); vboxTab1.PackStart(boxSubFamily, false, false, 0); _crudWidgetList.Add(new GenericCRUDWidgetXPO(boxSubFamily, DataSourceRow, "SubFamily", SettingsApp.RegexGuid, true)); //Type XPOComboBox xpoComboBoxType = new XPOComboBox(DataSourceRow.Session, typeof(FIN_ArticleType), (DataSourceRow as FIN_Article).Type, "Designation"); BOWidgetBox boxType = new BOWidgetBox(Resx.global_article_type, xpoComboBoxType); vboxTab1.PackStart(boxType, false, false, 0); _crudWidgetList.Add(new GenericCRUDWidgetXPO(boxType, DataSourceRow, "Type", SettingsApp.RegexGuid, true)); //ButtonImage FileChooserButton fileChooserButtonImage = new FileChooserButton(string.Empty, FileChooserAction.Open) { HeightRequest = 23 }; Image fileChooserImagePreviewButtonImage = new Image() { WidthRequest = _sizefileChooserPreview.Width, HeightRequest = _sizefileChooserPreview.Height }; Frame fileChooserFrameImagePreviewButtonImage = new Frame(); fileChooserFrameImagePreviewButtonImage.ShadowType = ShadowType.None; fileChooserFrameImagePreviewButtonImage.Add(fileChooserImagePreviewButtonImage); fileChooserButtonImage.SetFilename(((FIN_Article)DataSourceRow).ButtonImage); fileChooserButtonImage.Filter = Utils.GetFileFilterImages(); fileChooserButtonImage.SelectionChanged += (sender, eventArgs) => fileChooserImagePreviewButtonImage.Pixbuf = Utils.ResizeAndCropFileToPixBuf((sender as FileChooserButton).Filename, new System.Drawing.Size(fileChooserImagePreviewButtonImage.WidthRequest, fileChooserImagePreviewButtonImage.HeightRequest)); BOWidgetBox boxfileChooserButtonImage = new BOWidgetBox(Resx.global_button_image, fileChooserButtonImage); HBox hboxfileChooserAndimagePreviewButtonImage = new HBox(false, _boxSpacing); hboxfileChooserAndimagePreviewButtonImage.PackStart(boxfileChooserButtonImage, true, true, 0); hboxfileChooserAndimagePreviewButtonImage.PackStart(fileChooserFrameImagePreviewButtonImage, false, false, 0); vboxTab1.PackStart(hboxfileChooserAndimagePreviewButtonImage, false, false, 0); _crudWidgetList.Add(new GenericCRUDWidgetXPO(boxfileChooserButtonImage, _dataSourceRow, "ButtonImage", string.Empty, false)); //Favorite CheckButton checkButtonFavorite = new CheckButton(Resx.global_favorite); vboxTab1.PackStart(checkButtonFavorite, false, false, 0); _crudWidgetList.Add(new GenericCRUDWidgetXPO(checkButtonFavorite, _dataSourceRow, "Favorite")); //UseWeighingBalance CheckButton checkButtonUseWeighingBalance = new CheckButton(Resx.global_use_weighing_balance); vboxTab1.PackStart(checkButtonUseWeighingBalance, false, false, 0); _crudWidgetList.Add(new GenericCRUDWidgetXPO(checkButtonUseWeighingBalance, _dataSourceRow, "UseWeighingBalance")); //Disabled CheckButton checkButtonDisabled = new CheckButton(Resx.global_record_disabled); if (_dialogMode == DialogMode.Insert) { checkButtonDisabled.Active = SettingsApp.BOXPOObjectsStartDisabled; } vboxTab1.PackStart(checkButtonDisabled, false, false, 0); _crudWidgetList.Add(new GenericCRUDWidgetXPO(checkButtonDisabled, _dataSourceRow, "Disabled")); //Append Tab _notebook.AppendPage(vboxTab1, new Label(Resx.global_record_main_detail)); //::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: //Tab2 _vboxTab2 = new VBox(false, _boxSpacing) { BorderWidth = (uint)_boxSpacing }; int col1width = 100, col2width = 90, col3width = col2width, col4width = 160; //hboxPrices Label labelPriceEmpty = new Label(string.Empty) { WidthRequest = col1width }; Label labelPriceNormal = new Label(Resx.article_normal_price) { WidthRequest = col2width }; Label labelPricePromotion = new Label(Resx.article_promotion_price) { WidthRequest = col3width }; Label labelPriceUsePromotionPrice = new Label(Resx.article_use_promotion_price) { WidthRequest = col4width }; labelPriceNormal.SetAlignment(0.0F, 0.5F); labelPricePromotion.SetAlignment(0.0F, 0.5F); labelPriceUsePromotionPrice.SetAlignment(0.0F, 0.5F); VBox vboxPrices = new VBox(false, _boxSpacing) { BorderWidth = (uint)_boxSpacing }; HBox hboxPrices = new HBox(false, _boxSpacing); hboxPrices.PackStart(labelPriceEmpty, true, true, 0); hboxPrices.PackStart(labelPriceNormal, false, false, 0); hboxPrices.PackStart(labelPricePromotion, false, false, 0); hboxPrices.PackStart(labelPriceUsePromotionPrice, false, false, 0); //PackIt VBox vboxPrices.PackStart(hboxPrices, false, false, 0); //Get PriceType Collection : Require Criteria to exclude SettingsApp.XpoOidUndefinedRecord, else we get a Price0 here CriteriaOperator criteriaOperator = CriteriaOperator.Parse(string.Format("(Disabled IS NULL OR Disabled <> 1) OR (Oid <> '{0}')", SettingsApp.XpoOidUndefinedRecord)); XPCollection xpcConfigurationPriceType = new XPCollection(DataSourceRow.Session, typeof(FIN_ConfigurationPriceType), criteriaOperator); xpcConfigurationPriceType.Sorting = FrameworkUtils.GetXPCollectionDefaultSortingCollection(); //Define Max 5 Rows : 5 Prices int priceTypeCount = (xpcConfigurationPriceType.Count > 5) ? 5 : xpcConfigurationPriceType.Count; //Loop and Render Columns for (int i = 0; i < priceTypeCount; i++) { int priceTypeIndex = ((FIN_ConfigurationPriceType)xpcConfigurationPriceType[i]).EnumValue; //FieldNames string fieldNamePriceNormal = string.Format("Price{0}", priceTypeIndex); string fieldNamePricePromotion = string.Format("Price{0}Promotion", priceTypeIndex); string fieldNamePriceUsePromotionPrice = string.Format("Price{0}UsePromotionPrice", priceTypeIndex); //PriceType Label labelPriceType = new Label(((FIN_ConfigurationPriceType)xpcConfigurationPriceType[i]).Designation) { WidthRequest = col1width }; labelPriceType.SetAlignment(0.0F, 0.5F); //Entrys Entry entryPriceNormal = new Entry() { WidthRequest = col2width }; Entry entryPricePromotion = new Entry() { WidthRequest = col3width }; _crudWidgetList.Add(new GenericCRUDWidgetXPO(entryPriceNormal, _dataSourceRow, fieldNamePriceNormal, SettingsApp.RegexDecimalGreaterEqualThanZero, true)); _crudWidgetList.Add(new GenericCRUDWidgetXPO(entryPricePromotion, _dataSourceRow, fieldNamePricePromotion, SettingsApp.RegexDecimalGreaterEqualThanZero, true)); //UsePromotion CheckButton checkButtonUsePromotion = new CheckButton(string.Empty) { WidthRequest = col4width }; _crudWidgetList.Add(new GenericCRUDWidgetXPO(checkButtonUsePromotion, _dataSourceRow, fieldNamePriceUsePromotionPrice)); //PackIt hboxPrices = new HBox(false, _boxSpacing); hboxPrices.PackStart(labelPriceType, true, true, 0); hboxPrices.PackStart(entryPriceNormal, false, false, 0); hboxPrices.PackStart(entryPricePromotion, false, false, 0); hboxPrices.PackStart(checkButtonUsePromotion, false, false, 0); //PackIt VBox vboxPrices.PackStart(hboxPrices, false, false, 0); } _vboxTab2.PackStart(vboxPrices, false, false, 0); //PVPVariable CheckButton checkButtonPVPVariable = new CheckButton(Resx.global_variable_price); _vboxTab2.PackStart(checkButtonPVPVariable, false, false, 0); _crudWidgetList.Add(new GenericCRUDWidgetXPO(checkButtonPVPVariable, _dataSourceRow, "PVPVariable")); //PriceWithVat CheckButton checkButtonPriceWithVat = new CheckButton(Resx.global_price_with_vat); _vboxTab2.PackStart(checkButtonPriceWithVat, false, false, 0); _crudWidgetList.Add(new GenericCRUDWidgetXPO(checkButtonPriceWithVat, _dataSourceRow, "PriceWithVat")); //Discount Entry entryDiscount = new Entry(); BOWidgetBox boxDiscount = new BOWidgetBox(Resx.global_discount, entryDiscount); _vboxTab2.PackStart(boxDiscount, false, false, 0); _crudWidgetList.Add(new GenericCRUDWidgetXPO(boxDiscount, _dataSourceRow, "Discount", SettingsApp.RegexPercentage, false)); //Class XPOComboBox xpoComboBoxClass = new XPOComboBox(DataSourceRow.Session, typeof(FIN_ArticleClass), (DataSourceRow as FIN_Article).Class, "Designation"); BOWidgetBox boxClass = new BOWidgetBox(Resx.global_article_class, xpoComboBoxClass); _vboxTab2.PackStart(boxClass, false, false, 0); _crudWidgetList.Add(new GenericCRUDWidgetXPO(boxClass, DataSourceRow, "Class", SettingsApp.RegexGuid, true)); //Normal App Mode if (SettingsApp.AppMode == AppOperationMode.Default) { //VatOnTable _xpoComboBoxVatOnTable = new XPOComboBox(DataSourceRow.Session, typeof(FIN_ConfigurationVatRate), (DataSourceRow as FIN_Article).VatOnTable, "Designation"); BOWidgetBox boxVatOnTable = new BOWidgetBox(Resx.global_vat_on_table, _xpoComboBoxVatOnTable); _vboxTab2.PackStart(boxVatOnTable, false, false, 0); _crudWidgetList.Add(new GenericCRUDWidgetXPO(boxVatOnTable, DataSourceRow, "VatOnTable", SettingsApp.RegexGuid, true)); } //VatDirectSelling _xpoComboBoxVatDirectSelling = new XPOComboBox(DataSourceRow.Session, typeof(FIN_ConfigurationVatRate), (DataSourceRow as FIN_Article).VatDirectSelling, "Designation"); BOWidgetBox boxVatDirectSelling = new BOWidgetBox(Resx.global_vat_direct_selling, _xpoComboBoxVatDirectSelling); _vboxTab2.PackStart(boxVatDirectSelling, false, false, 0); _crudWidgetList.Add(new GenericCRUDWidgetXPO(boxVatDirectSelling, DataSourceRow, "VatDirectSelling", SettingsApp.RegexGuid, true)); //VatExemptionReason _xpoComboBoxVatExemptionReason = new XPOComboBox(DataSourceRow.Session, typeof(FIN_ConfigurationVatExemptionReason), (DataSourceRow as FIN_Article).VatExemptionReason, "Designation"); BOWidgetBox boxVatExemptionReason = new BOWidgetBox(Resx.global_vat_exemption_reason, _xpoComboBoxVatExemptionReason); _vboxTab2.PackStart(boxVatExemptionReason, false, false, 0); _crudWidgetList.Add(new GenericCRUDWidgetXPO(boxVatExemptionReason, DataSourceRow, "VatExemptionReason", SettingsApp.RegexGuid, true)); //Append Tab _notebook.AppendPage(_vboxTab2, new Label(Resx.dialog_edit_article_tab2_label)); //::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: //Tab3 VBox vboxTab3 = new VBox(false, _boxSpacing) { BorderWidth = (uint)_boxSpacing }; //BarCode Entry entryBarCode = new Entry(); BOWidgetBox boxBarCode = new BOWidgetBox(Resx.global_barcode, entryBarCode); vboxTab3.PackStart(boxBarCode, false, false, 0); _crudWidgetList.Add(new GenericCRUDWidgetXPO(boxBarCode, _dataSourceRow, "BarCode", SettingsApp.RegexEan12andEan4, false)); //Accounting Entry entryAccounting = new Entry(); BOWidgetBox boxAccounting = new BOWidgetBox(Resx.global_accounting, entryAccounting); vboxTab3.PackStart(boxAccounting, false, false, 0); _crudWidgetList.Add(new GenericCRUDWidgetXPO(boxAccounting, _dataSourceRow, "Accounting", SettingsApp.RegexDecimal, false)); //Tare Entry entryTare = new Entry(); BOWidgetBox boxTare = new BOWidgetBox(Resx.global_tare, entryTare); vboxTab3.PackStart(boxTare, false, false, 0); _crudWidgetList.Add(new GenericCRUDWidgetXPO(boxTare, _dataSourceRow, "Tare", SettingsApp.RegexDecimal, false)); //Weight Entry entryWeight = new Entry(); BOWidgetBox boxWeight = new BOWidgetBox(Resx.global_weight, entryWeight); vboxTab3.PackStart(boxWeight, false, false, 0); _crudWidgetList.Add(new GenericCRUDWidgetXPO(boxWeight, _dataSourceRow, "Weight", SettingsApp.RegexDecimal, false)); //DefaultQuantity Entry entryDefaultQuantity = new Entry(); BOWidgetBox boxDefaultQuantity = new BOWidgetBox(Resx.global_article_default_quantity, entryDefaultQuantity); vboxTab3.PackStart(boxDefaultQuantity, false, false, 0); _crudWidgetList.Add(new GenericCRUDWidgetXPO(boxDefaultQuantity, _dataSourceRow, "DefaultQuantity", SettingsApp.RegexDecimal, false)); //UnitMeasure XPOComboBox xpoComboBoxUnitMeasure = new XPOComboBox(DataSourceRow.Session, typeof(CFG_ConfigurationUnitMeasure), (DataSourceRow as FIN_Article).UnitMeasure, "Designation"); BOWidgetBox boxUnitMeasure = new BOWidgetBox(Resx.global_unit_measure, xpoComboBoxUnitMeasure); vboxTab3.PackStart(boxUnitMeasure, false, false, 0); _crudWidgetList.Add(new GenericCRUDWidgetXPO(boxUnitMeasure, DataSourceRow, "UnitMeasure", SettingsApp.RegexGuid, true)); //UnitSize XPOComboBox xpoComboBoxUnitSize = new XPOComboBox(DataSourceRow.Session, typeof(CFG_ConfigurationUnitSize), (DataSourceRow as FIN_Article).UnitSize, "Designation"); BOWidgetBox boxUnitSize = new BOWidgetBox(Resx.global_unit_size, xpoComboBoxUnitSize); vboxTab3.PackStart(boxUnitSize, false, false, 0); _crudWidgetList.Add(new GenericCRUDWidgetXPO(boxUnitSize, DataSourceRow, "UnitSize", SettingsApp.RegexGuid, true)); //Printer XPOComboBox xpoComboBoxPrinter = new XPOComboBox(DataSourceRow.Session, typeof(SYS_ConfigurationPrinters), (DataSourceRow as FIN_Article).Printer, "Designation"); BOWidgetBox boxPrinter = new BOWidgetBox(Resx.global_device_printer, xpoComboBoxPrinter); vboxTab3.PackStart(boxPrinter, false, false, 0); _crudWidgetList.Add(new GenericCRUDWidgetXPO(boxPrinter, DataSourceRow, "Printer", SettingsApp.RegexGuid, false)); //Template XPOComboBox xpoComboBoxTemplate = new XPOComboBox(DataSourceRow.Session, typeof(SYS_ConfigurationPrintersTemplates), (DataSourceRow as FIN_Article).Template, "Designation"); BOWidgetBox boxTemplate = new BOWidgetBox(Resx.global_ConfigurationPrintersTemplates, xpoComboBoxTemplate); vboxTab3.PackStart(boxTemplate, false, false, 0); _crudWidgetList.Add(new GenericCRUDWidgetXPO(boxTemplate, DataSourceRow, "Template", SettingsApp.RegexGuid, false)); if (GlobalApp.ScreenSize.Width > 800 && GlobalApp.ScreenSize.Height > 600) { //CommissionGroup XPOComboBox xpoComboBoxCommissionGroup = new XPOComboBox(DataSourceRow.Session, typeof(POS_UserCommissionGroup), (DataSourceRow as FIN_Article).CommissionGroup, "Designation"); BOWidgetBox boxCommissionGroup = new BOWidgetBox(Resx.global_commission_group, xpoComboBoxCommissionGroup); vboxTab3.PackStart(boxCommissionGroup, false, false, 0); _crudWidgetList.Add(new GenericCRUDWidgetXPO(boxCommissionGroup, DataSourceRow, "CommissionGroup", SettingsApp.RegexGuid, false)); //DiscountGroup XPOComboBox xpoComboBoxDiscountGroup = new XPOComboBox(DataSourceRow.Session, typeof(ERP_CustomerDiscountGroup), (DataSourceRow as FIN_Article).DiscountGroup, "Designation"); BOWidgetBox boxDiscountGroup = new BOWidgetBox(Resx.global_discount_group, xpoComboBoxDiscountGroup); vboxTab3.PackStart(boxDiscountGroup, false, false, 0); _crudWidgetList.Add(new GenericCRUDWidgetXPO(boxDiscountGroup, DataSourceRow, "DiscountGroup", SettingsApp.RegexGuid, false)); } //Append Tab _notebook.AppendPage(vboxTab3, new Label(Resx.dialog_edit_article_tab3_label)); //::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: //Enable/Disable Components entryDesignation.Sensitive = (_totalNumberOfFinanceDocuments > 0) ? false : true; //Show or Hide vboxTab2 if (_article.Type != null) { _vboxTab2.Visible = _article.Type.HavePrice; } //Assign Initial Value for Family DefineInitialValueForXpoComboBoxFamily(); //Call UI Update for VatExemptionReason UpdateUIVatExemptionReason(); //Events _xpoComboBoxFamily.Changed += xpoComboBoxFamily_Changed; xpoComboBoxType.Changed += xpoComboBoxType_Changed; _xpoComboBoxVatDirectSelling.Changed += xpoComboBoxVatDirectSelling_Changed; if (_xpoComboBoxVatOnTable != null) { _xpoComboBoxVatOnTable.Changed += xpoComboBoxVatDirectSelling_Changed; } } catch (System.Exception ex) { _log.Error(ex.Message, ex); } }
private void InitUI() { BOWidgetBox boxValue = null; BOWidgetBox ComboboxValue = null; try { cfg_configurationpreferenceparameter dataSourceRow = (cfg_configurationpreferenceparameter)_dataSourceRow; //Define Label for Value string valueLabel = (resources.CustomResources.GetCustomResources(GlobalFramework.Settings["customCultureResourceDefinition"], dataSourceRow.ResourceString) != null) ? resources.CustomResources.GetCustomResources(GlobalFramework.Settings["customCultureResourceDefinition"], dataSourceRow.ResourceString) : "LABEL NOT DEFINED IN Field [ResourceString]"; //Define RegEx for Value string valueRegEx = "REGULAR EXPRESSION NOT DEFINED IN Field [RegEx]"; if (dataSourceRow.RegEx != null) { //Try to get Value object objectValueRegEx = FrameworkUtils.GetFieldValueFromType(typeof(SettingsApp), dataSourceRow.RegEx); if (objectValueRegEx != null) { valueRegEx = objectValueRegEx.ToString(); } } //Define Label for Value bool valueRequired = (dataSourceRow.Required) ? dataSourceRow.Required : false; //Override Db Regex with ConfigurationSystemCountry RegExZipCode and RegExFiscalNumber if (dataSourceRow.Token == "COMPANY_POSTALCODE") { valueRegEx = SettingsApp.ConfigurationSystemCountry.RegExZipCode; } if (dataSourceRow.Token == "COMPANY_FISCALNUMBER") { valueRegEx = SettingsApp.ConfigurationSystemCountry.RegExFiscalNumber; } //Tab1 VBox vboxTab1 = new VBox(false, _boxSpacing) { BorderWidth = (uint)_boxSpacing }; //Ord Entry entryOrd = new Entry(); BOWidgetBox boxLabel = new BOWidgetBox(resources.CustomResources.GetCustomResources(GlobalFramework.Settings["customCultureResourceDefinition"], "global_record_order"), entryOrd); vboxTab1.PackStart(boxLabel, false, false, 0); _crudWidgetList.Add(new GenericCRUDWidgetXPO(boxLabel, _dataSourceRow, "Ord", SettingsApp.RegexIntegerGreaterThanZero, true)); //Code Entry entryCode = new Entry(); BOWidgetBox boxCode = new BOWidgetBox(resources.CustomResources.GetCustomResources(GlobalFramework.Settings["customCultureResourceDefinition"], "global_record_code"), entryCode); vboxTab1.PackStart(boxCode, false, false, 0); _crudWidgetList.Add(new GenericCRUDWidgetXPO(boxCode, _dataSourceRow, "Code", SettingsApp.RegexIntegerGreaterThanZero, true)); //Token Entry entryToken = new Entry(); BOWidgetBox boxToken = new BOWidgetBox(resources.CustomResources.GetCustomResources(GlobalFramework.Settings["customCultureResourceDefinition"], "global_token"), entryToken); vboxTab1.PackStart(boxToken, false, false, 0); _crudWidgetList.Add(new GenericCRUDWidgetXPO(boxToken, _dataSourceRow, "Token", SettingsApp.RegexAlfaNumericExtended, true)); //Get InputType PreferenceParameterInputType inputType = (PreferenceParameterInputType)Enum.Parse(typeof(PreferenceParameterInputType), dataSourceRow.InputType.ToString(), true); Entry entryValue = new Entry(); switch (inputType) { case PreferenceParameterInputType.Text: case PreferenceParameterInputType.TextPassword: boxValue = new BOWidgetBox(valueLabel, entryValue); vboxTab1.PackStart(boxValue, false, false, 0); // Turn entry into a TextPassword, curently we not use it, until we can turn Visibility = false into TreeView Cell if (inputType.Equals(PreferenceParameterInputType.TextPassword)) { entryValue.Visibility = false; } _crudWidgetList.Add(new GenericCRUDWidgetXPO(boxValue, _dataSourceRow, "Value", valueRegEx, valueRequired)); // ValueTip if (!string.IsNullOrEmpty(dataSourceRow.ValueTip)) { entryValue.TooltipText = string.Format(resources.CustomResources.GetCustomResources(GlobalFramework.Settings["customCultureResourceDefinition"], "global_prefparam_value_tip_format"), dataSourceRow.ValueTip); } break; case PreferenceParameterInputType.Multiline: EntryMultiline entryMultiline = new EntryMultiline(); entryMultiline.Value.Text = dataSourceRow.Value; entryMultiline.ScrolledWindow.BorderWidth = 1; entryMultiline.HeightRequest = 122; Label labelMultiline = new Label(resources.CustomResources.GetCustomResources(GlobalFramework.Settings["customCultureResourceDefinition"], "global_notes")); boxValue = new BOWidgetBox(valueLabel, entryMultiline); vboxTab1.PackStart(boxValue, false, false, 0); _crudWidgetList.Add(new GenericCRUDWidgetXPO(boxValue, _dataSourceRow, "Value", valueRegEx, valueRequired)); // Override Default Window Height _windowHeight = _windowHeightForTextComponent + 100; break; case PreferenceParameterInputType.CheckButton: CheckButton checkButtonValue = new CheckButton(valueLabel); vboxTab1.PackStart(checkButtonValue, false, false, 0); _crudWidgetList.Add(new GenericCRUDWidgetXPO(checkButtonValue, _dataSourceRow, "Value")); // Override Default Window Height _windowHeight = _windowHeightForTextComponent - 20; break; //Mudar a lingua da Aplicação - Não é genérico //IN009296 BackOffice - Mudar a língua da aplicação case PreferenceParameterInputType.ComboBox: string getCultureFromDB; try { string sql = "SELECT value FROM cfg_configurationpreferenceparameter where token = 'CULTURE';"; getCultureFromDB = GlobalFramework.SessionXpo.ExecuteScalar(sql).ToString(); } catch { getCultureFromDB = GlobalFramework.Settings["customCultureResourceDefinition"]; } string[] getCulturesValues = new string[8]; getCulturesValues[0] = "pt-PT"; getCulturesValues[1] = "pt-AO"; getCulturesValues[2] = "pt-BR"; getCulturesValues[3] = "pt-MZ"; getCulturesValues[4] = "en-GB"; getCulturesValues[5] = "en-US"; getCulturesValues[6] = "fr-FR"; getCulturesValues[7] = "es-ES"; string[] getCulturesLabels = new string[8]; getCulturesLabels[0] = "Português(Portugal)"; getCulturesLabels[1] = "Português(Angola)"; getCulturesLabels[2] = "Português(Brasil)"; getCulturesLabels[3] = "Português(Moçambique)"; getCulturesLabels[4] = "English(GB)"; getCulturesLabels[5] = "English(USA)"; getCulturesLabels[6] = "Françes"; getCulturesLabels[7] = "Espanol"; TreeIter iter; TreeStore store = new TreeStore(typeof(string), typeof(string)); for (int i = 0; i < getCulturesLabels.Length; i++) { iter = store.AppendValues(getCulturesValues.GetValue(i), getCulturesLabels.GetValue(i)); } ComboBox xpoComboBoxInputType = new ComboBox(getCulturesLabels); xpoComboBoxInputType.Model.GetIterFirst(out iter); int cbox = 0; do { GLib.Value thisRow = new GLib.Value(); xpoComboBoxInputType.Model.GetValue(iter, 0, ref thisRow); //if ((thisRow.Val as string).Equals(getCultureFromDB)) if (getCulturesValues[cbox] == getCultureFromDB) { xpoComboBoxInputType.SetActiveIter(iter); break; } cbox++; } while (xpoComboBoxInputType.Model.IterNext(ref iter)); ComboboxValue = new BOWidgetBox(resources.CustomResources.GetCustomResources(GlobalFramework.Settings["customCultureResourceDefinition"], "global_language"), xpoComboBoxInputType); vboxTab1.PackStart(ComboboxValue, false, false, 0); entryValue.Text = getCulturesValues[xpoComboBoxInputType.Active]; entryValue.Visibility = false; xpoComboBoxInputType.Changed += delegate { entryValue.Text = getCulturesValues[xpoComboBoxInputType.Active]; //GlobalFramework.CurrentCulture = new System.Globalization.CultureInfo(getCulturesValues[xpoComboBoxInputType.Active]); //GlobalFramework.Settings["customCultureResourceDefinition"] = getCulturesValues[xpoComboBoxInputType.Active]; //CustomResources.UpdateLanguage(getCulturesValues[xpoComboBoxInputType.Active]); //_crudWidgetList.Add(new GenericCRUDWidgetXPO(boxValue, _dataSourceRow, "Value", string.Empty, false)); }; boxValue = new BOWidgetBox(valueLabel, entryValue); _crudWidgetList.Add(new GenericCRUDWidgetXPO(boxValue, _dataSourceRow, "Value", string.Empty, false)); break; case PreferenceParameterInputType.FilePicker: case PreferenceParameterInputType.DirPicker: //FilePicker FileChooserAction fileChooserAction = (inputType.Equals(PreferenceParameterInputType.FilePicker)) ? FileChooserAction.Open : FileChooserAction.SelectFolder; FileChooserButton fileChooser = new FileChooserButton(string.Empty, fileChooserAction) { HeightRequest = 23 }; if (inputType.Equals(PreferenceParameterInputType.FilePicker)) { fileChooser.SetFilename(dataSourceRow.Value); fileChooser.Filter = Utils.GetFileFilterImages(); } else { fileChooser.SetCurrentFolder(dataSourceRow.Value); } boxValue = new BOWidgetBox(valueLabel, fileChooser); vboxTab1.PackStart(boxValue, false, false, 0); _crudWidgetList.Add(new GenericCRUDWidgetXPO(boxValue, _dataSourceRow, "Value", string.Empty, false)); break; default: break; } //Append Tab _notebook.AppendPage(vboxTab1, new Label(resources.CustomResources.GetCustomResources(GlobalFramework.Settings["customCultureResourceDefinition"], "global_record_main_detail"))); //::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: //Disable Components entryToken.Sensitive = false; //Protect PreferenceParameterInputType : Disable if is COMPANY_FISCALNUMBER or Other Sensitive Data cfg_configurationpreferenceparameter parameter = (_dataSourceRow as cfg_configurationpreferenceparameter); if (entryValue != null) { entryValue.Sensitive = ( parameter.Token != "COMPANY_NAME" && parameter.Token != "COMPANY_BUSINESS_NAME" && parameter.Token != "COMPANY_COUNTRY" && parameter.Token != "COMPANY_COUNTRY" && parameter.Token != "COMPANY_COUNTRY_CODE2" && parameter.Token != "COMPANY_FISCALNUMBER" && parameter.Token != "SYSTEM_CURRENCY" //&& parameter.Token != "COMPANY_CIVIL_REGISTRATION" //&& parameter.Token != "COMPANY_CIVIL_REGISTRATION_ID" ); } } catch (System.Exception ex) { _log.Error(ex.Message, ex); } }
private void InitUI() { try { //Tab1 VBox vboxTab1 = new VBox(false, _boxSpacing) { BorderWidth = (uint)_boxSpacing }; //Ord Entry entryOrd = new Entry(); BOWidgetBox boxLabel = new BOWidgetBox(Resx.global_record_order, entryOrd); vboxTab1.PackStart(boxLabel, false, false, 0); _crudWidgetList.Add(new GenericCRUDWidgetXPO(boxLabel, _dataSourceRow, "Ord", SettingsApp.RegexIntegerGreaterThanZero, true)); //Code Entry entryCode = new Entry(); BOWidgetBox boxCode = new BOWidgetBox(Resx.global_record_code, entryCode); vboxTab1.PackStart(boxCode, false, false, 0); _crudWidgetList.Add(new GenericCRUDWidgetXPO(boxCode, _dataSourceRow, "Code", SettingsApp.RegexIntegerGreaterThanZero, true)); //Designation Entry entryDesignation = new Entry(); BOWidgetBox boxDesignation = new BOWidgetBox(Resx.global_designation, entryDesignation); vboxTab1.PackStart(boxDesignation, false, false, 0); _crudWidgetList.Add(new GenericCRUDWidgetXPO(boxDesignation, _dataSourceRow, "Designation", SettingsApp.RegexAlfaNumeric, true)); //ButtonLabel Entry entryButtonLabel = new Entry(); BOWidgetBox boxButtonLabel = new BOWidgetBox(Resx.global_button_name, entryButtonLabel); vboxTab1.PackStart(boxButtonLabel, false, false, 0); _crudWidgetList.Add(new GenericCRUDWidgetXPO(boxButtonLabel, _dataSourceRow, "ButtonLabel", SettingsApp.RegexAlfaNumericExtended, false)); //Family XPOComboBox xpoComboBoxFamily = new XPOComboBox(DataSourceRow.Session, typeof(FIN_ArticleFamily), (DataSourceRow as FIN_ArticleSubFamily).Family, "Designation"); BOWidgetBox boxFamily = new BOWidgetBox(Resx.global_families, xpoComboBoxFamily); vboxTab1.PackStart(boxFamily, false, false, 0); _crudWidgetList.Add(new GenericCRUDWidgetXPO(boxFamily, DataSourceRow, "Family", SettingsApp.RegexGuid, true)); //ButtonImage FileChooserButton fileChooserButtonImage = new FileChooserButton(string.Empty, FileChooserAction.Open) { HeightRequest = 23 }; Image fileChooserImagePreviewButtonImage = new Image() { WidthRequest = _sizefileChooserPreview.Width, HeightRequest = _sizefileChooserPreview.Height }; Frame fileChooserFrameImagePreviewButtonImage = new Frame(); fileChooserFrameImagePreviewButtonImage.ShadowType = ShadowType.None; fileChooserFrameImagePreviewButtonImage.Add(fileChooserImagePreviewButtonImage); fileChooserButtonImage.SetFilename(((FIN_ArticleSubFamily)DataSourceRow).ButtonImage); fileChooserButtonImage.Filter = Utils.GetFileFilterImages(); fileChooserButtonImage.SelectionChanged += (sender, eventArgs) => fileChooserImagePreviewButtonImage.Pixbuf = Utils.ResizeAndCropFileToPixBuf((sender as FileChooserButton).Filename, new System.Drawing.Size(fileChooserImagePreviewButtonImage.WidthRequest, fileChooserImagePreviewButtonImage.HeightRequest)); BOWidgetBox boxfileChooserButtonImage = new BOWidgetBox(Resx.global_button_image, fileChooserButtonImage); HBox hboxfileChooserAndimagePreviewButtonImage = new HBox(false, _boxSpacing); hboxfileChooserAndimagePreviewButtonImage.PackStart(boxfileChooserButtonImage, true, true, 0); hboxfileChooserAndimagePreviewButtonImage.PackStart(fileChooserFrameImagePreviewButtonImage, false, false, 0); vboxTab1.PackStart(hboxfileChooserAndimagePreviewButtonImage, false, false, 0); _crudWidgetList.Add(new GenericCRUDWidgetXPO(boxfileChooserButtonImage, _dataSourceRow, "ButtonImage", string.Empty, false)); //Disabled CheckButton checkButtonDisabled = new CheckButton(Resx.global_record_disabled); if (_dialogMode == DialogMode.Insert) { checkButtonDisabled.Active = SettingsApp.BOXPOObjectsStartDisabled; } vboxTab1.PackStart(checkButtonDisabled, false, false, 0); _crudWidgetList.Add(new GenericCRUDWidgetXPO(checkButtonDisabled, _dataSourceRow, "Disabled")); //Append Tab _notebook.AppendPage(vboxTab1, new Label(Resx.global_record_main_detail)); //::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: //Tab2 VBox vboxTab2 = new VBox(false, _boxSpacing) { BorderWidth = (uint)_boxSpacing }; //CommissionGroup XPOComboBox xpoComboBoxCommissionGroup = new XPOComboBox(DataSourceRow.Session, typeof(POS_UserCommissionGroup), (DataSourceRow as FIN_ArticleSubFamily).CommissionGroup, "Designation"); BOWidgetBox boxCommissionGroup = new BOWidgetBox(Resx.global_commission_group, xpoComboBoxCommissionGroup); vboxTab2.PackStart(boxCommissionGroup, false, false, 0); _crudWidgetList.Add(new GenericCRUDWidgetXPO(boxCommissionGroup, DataSourceRow, "CommissionGroup", SettingsApp.RegexGuid, false)); //Printer XPOComboBox xpoComboBoxPrinter = new XPOComboBox(DataSourceRow.Session, typeof(SYS_ConfigurationPrinters), (DataSourceRow as FIN_ArticleSubFamily).Printer, "Designation"); BOWidgetBox boxPrinter = new BOWidgetBox(Resx.global_device_printer, xpoComboBoxPrinter); vboxTab2.PackStart(boxPrinter, false, false, 0); _crudWidgetList.Add(new GenericCRUDWidgetXPO(boxPrinter, DataSourceRow, "Printer", SettingsApp.RegexGuid, false)); //Template XPOComboBox xpoComboBoxTemplate = new XPOComboBox(DataSourceRow.Session, typeof(SYS_ConfigurationPrintersTemplates), (DataSourceRow as FIN_ArticleSubFamily).Template, "Designation"); BOWidgetBox boxTemplate = new BOWidgetBox(Resx.global_ConfigurationPrintersTemplates, xpoComboBoxTemplate); vboxTab2.PackStart(boxTemplate, false, false, 0); _crudWidgetList.Add(new GenericCRUDWidgetXPO(boxTemplate, DataSourceRow, "Template", SettingsApp.RegexGuid, false)); //DiscountGroup XPOComboBox xpoComboBoxDiscountGroup = new XPOComboBox(DataSourceRow.Session, typeof(ERP_CustomerDiscountGroup), (DataSourceRow as FIN_ArticleSubFamily).DiscountGroup, "Designation"); BOWidgetBox boxDiscountGroup = new BOWidgetBox(Resx.global_discount_group, xpoComboBoxDiscountGroup); vboxTab2.PackStart(boxDiscountGroup, false, false, 0); _crudWidgetList.Add(new GenericCRUDWidgetXPO(boxDiscountGroup, DataSourceRow, "DiscountGroup", SettingsApp.RegexGuid, false)); //VatOnTable XPOComboBox xpoComboBoxVatOnTable = new XPOComboBox(DataSourceRow.Session, typeof(FIN_ConfigurationVatRate), (DataSourceRow as FIN_ArticleSubFamily).VatOnTable, "Designation"); BOWidgetBox boxVatOnTable = new BOWidgetBox(Resx.global_vat_on_table, xpoComboBoxVatOnTable); vboxTab2.PackStart(boxVatOnTable, false, false, 0); _crudWidgetList.Add(new GenericCRUDWidgetXPO(boxVatOnTable, DataSourceRow, "VatOnTable", SettingsApp.RegexGuid, false)); //VatDirectSelling XPOComboBox xpoComboBoxVatDirectSelling = new XPOComboBox(DataSourceRow.Session, typeof(FIN_ConfigurationVatRate), (DataSourceRow as FIN_ArticleSubFamily).VatDirectSelling, "Designation"); BOWidgetBox boxVatDirectSelling = new BOWidgetBox(Resx.global_vat_direct_selling, xpoComboBoxVatDirectSelling); vboxTab2.PackStart(boxVatDirectSelling, false, false, 0); _crudWidgetList.Add(new GenericCRUDWidgetXPO(boxVatDirectSelling, DataSourceRow, "VatDirectSelling", SettingsApp.RegexGuid, false)); //Append Tab _notebook.AppendPage(vboxTab2, new Label(Resx.dialog_edit_articlesubfamily_tab2_label)); } catch (System.Exception ex) { _log.Error(ex.Message, ex); } }
private void InitUI() { BOWidgetBox boxValue = null; try { CFG_ConfigurationPreferenceParameter dataSourceRow = (CFG_ConfigurationPreferenceParameter)_dataSourceRow; //Define Label for Value string valueLabel = (Resx.ResourceManager.GetString(dataSourceRow.ResourceString) != null) ? Resx.ResourceManager.GetString(dataSourceRow.ResourceString) : "LABEL NOT DEFINED IN Field [ResourceString]"; //Define RegEx for Value string valueRegEx = "REGULAR EXPRESSION NOT DEFINED IN Field [RegEx]"; if (dataSourceRow.RegEx != null) { //Try to get Value object objectValueRegEx = FrameworkUtils.GetFieldValueFromType(typeof(SettingsApp), dataSourceRow.RegEx); if (objectValueRegEx != null) { valueRegEx = objectValueRegEx.ToString(); } } //Define Label for Value bool valueRequired = (dataSourceRow.Required) ? dataSourceRow.Required : false; //Override Db Regex with ConfigurationSystemCountry RegExZipCode and RegExFiscalNumber if (dataSourceRow.Token == "COMPANY_POSTALCODE") { valueRegEx = SettingsApp.ConfigurationSystemCountry.RegExZipCode; } if (dataSourceRow.Token == "COMPANY_FISCALNUMBER") { valueRegEx = SettingsApp.ConfigurationSystemCountry.RegExFiscalNumber; } //Tab1 VBox vboxTab1 = new VBox(false, _boxSpacing) { BorderWidth = (uint)_boxSpacing }; //Ord Entry entryOrd = new Entry(); BOWidgetBox boxLabel = new BOWidgetBox(Resx.global_record_order, entryOrd); vboxTab1.PackStart(boxLabel, false, false, 0); _crudWidgetList.Add(new GenericCRUDWidgetXPO(boxLabel, _dataSourceRow, "Ord", SettingsApp.RegexIntegerGreaterThanZero, true)); //Code Entry entryCode = new Entry(); BOWidgetBox boxCode = new BOWidgetBox(Resx.global_record_code, entryCode); vboxTab1.PackStart(boxCode, false, false, 0); _crudWidgetList.Add(new GenericCRUDWidgetXPO(boxCode, _dataSourceRow, "Code", SettingsApp.RegexIntegerGreaterThanZero, true)); //Token Entry entryToken = new Entry(); BOWidgetBox boxToken = new BOWidgetBox(Resx.global_token, entryToken); vboxTab1.PackStart(boxToken, false, false, 0); _crudWidgetList.Add(new GenericCRUDWidgetXPO(boxToken, _dataSourceRow, "Token", SettingsApp.RegexAlfaNumericExtended, true)); //Get InputType PreferenceParameterInputType inputType = (PreferenceParameterInputType)Enum.Parse(typeof(PreferenceParameterInputType), dataSourceRow.InputType.ToString(), true); Entry entryValue = new Entry(); switch (inputType) { case PreferenceParameterInputType.Text: case PreferenceParameterInputType.TextPassword: boxValue = new BOWidgetBox(valueLabel, entryValue); vboxTab1.PackStart(boxValue, false, false, 0); // Turn entry into a TextPassword, curently we not use it, until we can turn Visibility = false into TreeView Cell if (inputType.Equals(PreferenceParameterInputType.TextPassword)) { entryValue.Visibility = false; } _crudWidgetList.Add(new GenericCRUDWidgetXPO(boxValue, _dataSourceRow, "Value", valueRegEx, valueRequired)); // ValueTip if (!string.IsNullOrEmpty(dataSourceRow.ValueTip)) { entryValue.TooltipText = string.Format(Resx.global_prefparam_value_tip_format, dataSourceRow.ValueTip); } break; case PreferenceParameterInputType.Multiline: EntryMultiline entryMultiline = new EntryMultiline(); entryMultiline.Value.Text = dataSourceRow.Value; entryMultiline.ScrolledWindow.BorderWidth = 1; entryMultiline.HeightRequest = 122; Label labelMultiline = new Label(Resx.global_notes); boxValue = new BOWidgetBox(valueLabel, entryMultiline); vboxTab1.PackStart(boxValue, false, false, 0); _crudWidgetList.Add(new GenericCRUDWidgetXPO(boxValue, _dataSourceRow, "Value", valueRegEx, valueRequired)); // Override Default Window Height _windowHeight = _windowHeightForTextComponent + 100; break; case PreferenceParameterInputType.CheckButton: CheckButton checkButtonValue = new CheckButton(valueLabel); vboxTab1.PackStart(checkButtonValue, false, false, 0); _crudWidgetList.Add(new GenericCRUDWidgetXPO(checkButtonValue, _dataSourceRow, "Value")); // Override Default Window Height _windowHeight = _windowHeightForTextComponent - 20; break; case PreferenceParameterInputType.ComboBox: break; case PreferenceParameterInputType.FilePicker: case PreferenceParameterInputType.DirPicker: //FilePicker FileChooserAction fileChooserAction = (inputType.Equals(PreferenceParameterInputType.FilePicker)) ? FileChooserAction.Open : FileChooserAction.SelectFolder; FileChooserButton fileChooser = new FileChooserButton(string.Empty, fileChooserAction) { HeightRequest = 23 }; if (inputType.Equals(PreferenceParameterInputType.FilePicker)) { fileChooser.SetFilename(dataSourceRow.Value); fileChooser.Filter = Utils.GetFileFilterImages(); } else { fileChooser.SetCurrentFolder(dataSourceRow.Value); } boxValue = new BOWidgetBox(valueLabel, fileChooser); vboxTab1.PackStart(boxValue, false, false, 0); _crudWidgetList.Add(new GenericCRUDWidgetXPO(boxValue, _dataSourceRow, "Value", string.Empty, false)); break; default: break; } //Append Tab _notebook.AppendPage(vboxTab1, new Label(Resx.global_record_main_detail)); //::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: //Disable Components entryToken.Sensitive = false; //Protect PreferenceParameterInputType : Disable if is COMPANY_FISCALNUMBER or Other Sensitive Data CFG_ConfigurationPreferenceParameter parameter = (_dataSourceRow as CFG_ConfigurationPreferenceParameter); if (entryValue != null) { entryValue.Sensitive = ( parameter.Token != "COMPANY_NAME" && parameter.Token != "COMPANY_BUSINESS_NAME" && parameter.Token != "COMPANY_COUNTRY" && parameter.Token != "COMPANY_COUNTRY" && parameter.Token != "COMPANY_COUNTRY_CODE2" && parameter.Token != "COMPANY_FISCALNUMBER" && parameter.Token != "SYSTEM_CURRENCY" //&& parameter.Token != "COMPANY_CIVIL_REGISTRATION" //&& parameter.Token != "COMPANY_CIVIL_REGISTRATION_ID" ); } } catch (System.Exception ex) { _log.Error(ex.Message, ex); } }
private void OnReset(object o, EventArgs args) { chooser.SetFilename(source.DefaultBaseDirectory); }
private void InitUI() { try { //Tab1 VBox vboxTab1 = new VBox(false, _boxSpacing) { BorderWidth = (uint)_boxSpacing }; //Ord Entry entryOrd = new Entry(); BOWidgetBox boxLabel = new BOWidgetBox(Resx.global_record_order, entryOrd); vboxTab1.PackStart(boxLabel, false, false, 0); _crudWidgetList.Add(new GenericCRUDWidgetXPO(boxLabel, _dataSourceRow, "Ord", SettingsApp.RegexIntegerGreaterThanZero, true)); //Code Entry entryCode = new Entry(); BOWidgetBox boxCode = new BOWidgetBox(Resx.global_record_code, entryCode); vboxTab1.PackStart(boxCode, false, false, 0); _crudWidgetList.Add(new GenericCRUDWidgetXPO(boxCode, _dataSourceRow, "Code", SettingsApp.RegexIntegerGreaterThanZero, true)); //Designation Entry entryDesignation = new Entry(); BOWidgetBox boxDesignation = new BOWidgetBox(Resx.global_designation, entryDesignation); vboxTab1.PackStart(boxDesignation, false, false, 0); _crudWidgetList.Add(new GenericCRUDWidgetXPO(boxDesignation, _dataSourceRow, "Designation", SettingsApp.RegexAlfaNumericExtended, true)); //FileTemplate FileChooserButton fileChooserFileTemplate = new FileChooserButton(string.Empty, FileChooserAction.Open) { HeightRequest = 23 }; Image fileChooserImagePreviewFileTemplate = new Image() { WidthRequest = _sizefileChooserPreview.Width, HeightRequest = _sizefileChooserPreview.Height }; Frame fileChooserFrameImagePreviewFileTemplate = new Frame(); fileChooserFrameImagePreviewFileTemplate.ShadowType = ShadowType.None; fileChooserFrameImagePreviewFileTemplate.Add(fileChooserImagePreviewFileTemplate); fileChooserFileTemplate.SetFilename(((SYS_ConfigurationPrintersTemplates)DataSourceRow).FileTemplate); fileChooserFileTemplate.Filter = Utils.GetFileFilterTemplates(); fileChooserFileTemplate.SelectionChanged += (sender, eventArgs) => fileChooserImagePreviewFileTemplate.Pixbuf = Utils.ResizeAndCropFileToPixBuf((sender as FileChooserButton).Filename, new System.Drawing.Size(fileChooserImagePreviewFileTemplate.WidthRequest, fileChooserImagePreviewFileTemplate.HeightRequest)); BOWidgetBox boxfileChooserFileTemplate = new BOWidgetBox(Resx.global_file, fileChooserFileTemplate); HBox hboxfileChooserAndimagePreviewFileTemplate = new HBox(false, _boxSpacing); hboxfileChooserAndimagePreviewFileTemplate.PackStart(boxfileChooserFileTemplate, true, true, 0); hboxfileChooserAndimagePreviewFileTemplate.PackStart(fileChooserFrameImagePreviewFileTemplate, false, false, 0); vboxTab1.PackStart(hboxfileChooserAndimagePreviewFileTemplate, false, false, 0); _crudWidgetList.Add(new GenericCRUDWidgetXPO(boxfileChooserFileTemplate, _dataSourceRow, "FileTemplate", string.Empty, false)); //FinancialTemplate CheckButton checkButtonFinancialTemplate = new CheckButton(Resx.global_financialtemplate); vboxTab1.PackStart(checkButtonFinancialTemplate, false, false, 0); _crudWidgetList.Add(new GenericCRUDWidgetXPO(checkButtonFinancialTemplate, _dataSourceRow, "FinancialTemplate")); //Disabled CheckButton checkButtonDisabled = new CheckButton(Resx.global_record_disabled); if (_dialogMode == DialogMode.Insert) { checkButtonDisabled.Active = SettingsApp.BOXPOObjectsStartDisabled; } vboxTab1.PackStart(checkButtonDisabled, false, false, 0); _crudWidgetList.Add(new GenericCRUDWidgetXPO(checkButtonDisabled, _dataSourceRow, "Disabled")); //Append Tab _notebook.AppendPage(vboxTab1, new Label(Resx.global_record_main_detail)); } catch (System.Exception ex) { _log.Error(ex.Message, ex); } }