private void FrameOnTemplateChanged(object sender, EventArgs args) { if (Frame.Context == TemplateContext.ApplicationWindow && ((IModelOptionsNotifyIconOptions)Application.Model.Options).NotifyIcon) { var form = Frame.Template as XtraForm; if (form != null) { IContainer container = new Container(); var strip = new ContextMenuStrip(container); strip.Items.Add(GetMenuItem(CaptionHelper.GetLocalizedText(XpandSystemWindowsFormsModule.XpandWin, "Maximize"), (o, eventArgs) => changeFormVisibility(form))); strip.Items.Add(GetMenuItem(CaptionHelper.GetLocalizedText(XpandSystemWindowsFormsModule.XpandWin, "Minimize"), (o, eventArgs) => changeFormVisibility(form))); strip.Items.Add(GetMenuItem(CaptionHelper.GetLocalizedText(XpandSystemWindowsFormsModule.XpandWin, "LogOut"), (o, eventArgs) => ((IWinApplication)Application).LogOff())); strip.Items.Add(GetMenuItem(CaptionHelper.GetLocalizedText(XpandSystemWindowsFormsModule.XpandWin, "Exit"), (o, eventArgs) => Application.Exit())); var notifyIcon1 = new NotifyIcon(container) { Visible = true, ContextMenuStrip = strip }; setIcon(notifyIcon1); notifyIcon1.DoubleClick += (o, eventArgs) => changeFormVisibility(form); iconVisible = true; } } }
private void ReIndexAction_Execute(object sender, SimpleActionExecuteEventArgs e) { ObjectSpace.CommitChanges(); var index = e.CurrentObject as IElasticSearchIndex; if (index != null) { try { WaitScreen.Instance.Show(CaptionHelper.GetLocalizedText(ElasticSearchClient.MessageGroup, "ReIndexWaitScreenCaption"), CaptionHelper.GetLocalizedText(ElasticSearchClient.MessageGroup, "ReIndexWaitScreenText")); var rowCount = 0; using (var osp = new XPObjectSpaceProvider(Application.GetConnectionString(), null, true)) using (var objectspace = (XPObjectSpace)osp.CreateObjectSpace()) { index = objectspace.GetObject(index) as IElasticSearchIndex; if (index != null) { ElasticSearchClient.Instance.Reindex(index, (ci, i) => { if (i > 0) { rowCount += i; WaitScreen.Instance.Update(string.Format(CultureInfo.CurrentCulture, CaptionHelper.GetLocalizedText(ElasticSearchClient.MessageGroup, "ReIndexWaitScreenUpdateCaption"), ci.ESTypeName), string.Format(CultureInfo.CurrentCulture, CaptionHelper.GetLocalizedText(ElasticSearchClient.MessageGroup, "ReIndexWaitScreenUpdateText"), rowCount)); } }); } } } finally { WaitScreen.Instance.Hide(); } } View.Refresh(); }
public void Process(XafApplication application, IObjectSpace objectSpace) { var user = objectSpace.FindObject(XpandModuleBase.UserType, new GroupOperator(GroupOperatorType.Or, new BinaryOperator("UserName", UserName), new BinaryOperator("Email", Email)), true) as IAuthenticationStandardUser; if (user != null && !objectSpace.IsNewObject(user)) { throw new ArgumentException(CaptionHelper.GetLocalizedText(XpandSecurityModule.XpandSecurity, "AlreadyRegistered")); } var securityUserWithRoles = objectSpace.IsNewObject(user)? (ISecurityUserWithRoles)user : (ISecurityUserWithRoles)objectSpace.CreateObject(XpandModuleBase.UserType); User = securityUserWithRoles; var userTypeInfo = application.TypesInfo.FindTypeInfo(XpandModuleBase.UserType); var modelRegistration = (IModelRegistration)((IModelOptionsRegistration)application.Model.Options).Registration; AddRoles(modelRegistration, userTypeInfo, securityUserWithRoles, objectSpace); userTypeInfo.FindMember("UserName").SetValue(securityUserWithRoles, UserName); userTypeInfo.FindMember("IsActive").SetValue(securityUserWithRoles, modelRegistration.ActivateUser); modelRegistration.EmailMember.MemberInfo.SetValue(securityUserWithRoles, Email); var activationLinkMember = modelRegistration.ActivationIdMember; if (activationLinkMember != null) { activationLinkMember.MemberInfo.SetValue(securityUserWithRoles, Guid.NewGuid().ToString()); } securityUserWithRoles.CallMethod("SetPassword", new [] { typeof(string) }, Password); objectSpace.CommitChanges(); }
public override object Authenticate(IObjectSpace objectSpace) { Usuario usuario; if (AutoLogin) { usuario = objectSpace.FindObject <Usuario>(new BinaryOperator("UserName", "admin")); _logonParameters.ObjectSpace = objectSpace; _logonParameters.LoginUserName = usuario.UserName; _logonParameters.LoginEmpresa = usuario.EmpresaPredeterminada; } else { if (_logonParameters.UsuarioActual() == null) { throw new Exception(CaptionHelper.GetLocalizedText("Security", "UsuarioNotNull")); } if (_logonParameters.EmpresaActual() == null) { throw new Exception(CaptionHelper.GetLocalizedText("Security", "EmpresaNotNull")); } if (!_logonParameters.UsuarioActual().ComparePassword(_logonParameters.Password)) { throw new AuthenticationException(_logonParameters.UsuarioActual().UserName, SecurityExceptionLocalizer.GetExceptionMessage(SecurityExceptionId.PasswordsAreDifferent)); } usuario = objectSpace.GetObjectByKey <Usuario>(_logonParameters.UsuarioActualId); } return(usuario); }
private void FrameOnTemplateChanged(object sender, EventArgs args) { if (NotifyEnabled() && Frame.Context == TemplateContext.ApplicationWindow) { var form = Frame.Template as XtraForm; if (form != null) { _container = new Container(); var strip = new ContextMenuStrip(_container); strip.Items.Add(GetMenuItem(CaptionHelper.GetLocalizedText(XpandSystemWindowsFormsModule.XpandWin, "Maximize"), (o, eventArgs) => ChangeFormVisibility(form))); strip.Items.Add(GetMenuItem(CaptionHelper.GetLocalizedText(XpandSystemWindowsFormsModule.XpandWin, "Minimize"), (o, eventArgs) => ChangeFormVisibility(form))); var logoffAction = Frame.GetController <LogoffController>().LogoffAction; if (logoffAction.Active) { strip.Items.Add(GetMenuItem(CaptionHelper.GetLocalizedText(XpandSystemWindowsFormsModule.XpandWin, "LogOut"), (o, eventArgs) => Application.LogOff())); } strip.Items.Add(GetMenuItem(CaptionHelper.GetLocalizedText(XpandSystemWindowsFormsModule.XpandWin, "Exit"), (o, eventArgs) => { _trayExitAction.DoExecute(); })); _notifyIcon = new NotifyIcon(_container) { Visible = true, ContextMenuStrip = strip }; SetIcon(); _notifyIcon.DoubleClick += (o, eventArgs) => ChangeFormVisibility(form); } } }
protected virtual IObserver <ImportProgress> GetProgressObserver(ExcelImport excelImport, ProgressBarViewItemBase progressBarViewItem) { var progress = CreateProgressObserver(); BeginImport.OnNext((excelImport, progress)); var resultMessage = (CaptionHelper.GetLocalizedText(ExcelImporterLocalizationUpdater.ExcelImport, ExcelImporterLocalizationUpdater.ImportSucceded), CaptionHelper.GetLocalizedText(ExcelImporterLocalizationUpdater.ExcelImport, ExcelImporterLocalizationUpdater.ImportFailed)); var dataRowProgress = progress.OfType <ImportDataRowProgress>().Where(excelImport); var progressEnd = ProgressEnd(excelImport, progressBarViewItem, progress, resultMessage, Application.Model.BOModel.ToDictionary(c => c.TypeInfo.FullName, c => c.Caption)) .Publish().RefCount(); progress.OfType <ImportProgressStart>().Where(excelImport) .Do(OnStart).TakeUntil(progressEnd).Subscribe(); Observable .Interval(TimeSpan.FromMilliseconds(progressBarViewItem.PollingInterval)) .WithLatestFrom(dataRowProgress, (l, importProgress) => ((decimal)importProgress.Percentage)) .Select(Synchronize).Concat() .TakeUntil(progressEnd) .Do(progressBarViewItem) .Subscribe(); return(progress); }
protected override DXPopupMenu CreateMenu() { DXPopupMenu dXPopupMenu = base.CreateMenu(); string localizedString = Localizer.Active.GetLocalizedString(StringId.TextEditMenuDelete); foreach (DXMenuItem dXMenuItem in dXPopupMenu.Items) { if (dXMenuItem is TextEdit.DXMenuItemTextEdit && dXMenuItem.Caption == localizedString) { TextEdit.DXMenuItemTextEdit dXMenuItemTextEdit = (TextEdit.DXMenuItemTextEdit)dXMenuItem; dXMenuItemTextEdit.UpdateElement = new TextEdit.MenuItemUpdateElement(dXMenuItemTextEdit, new TextEdit.MenuItemUpdateHandler(this.UpdateDeleteMenuItem)); } } Image image = ImageLoader.Instance.GetImageInfo("MenuBar_Open").Image; TextEdit.DXMenuItemTextEdit dXMenuItemTextEdit2 = new TextEdit.DXMenuItemTextEdit(StringId.PictureEditOpenFileTitle, new EventHandler(this.OnOpenMenuItemSelected), image); dXMenuItemTextEdit2.Caption = CaptionHelper.GetLocalizedText("FileAttachments", "Editor_Open"); dXMenuItemTextEdit2.UpdateElement = new TextEdit.MenuItemUpdateElement(dXMenuItemTextEdit2, new TextEdit.MenuItemUpdateHandler(this.UpdateSaveOpenMenuItem)); dXMenuItemTextEdit2.BeginGroup = true; dXPopupMenu.Items.Add(dXMenuItemTextEdit2); image = ImageLoader.Instance.GetImageInfo("MenuBar_SaveTo").Image; dXMenuItemTextEdit2 = new TextEdit.DXMenuItemTextEdit(StringId.PictureEditSaveFileTitle, new EventHandler(this.OnSaveMenuItemSelected), image); dXMenuItemTextEdit2.Caption = CaptionHelper.GetLocalizedText("FileAttachments", "Editor_Save"); dXMenuItemTextEdit2.UpdateElement = new TextEdit.MenuItemUpdateElement(dXMenuItemTextEdit2, new TextEdit.MenuItemUpdateHandler(this.UpdateSaveOpenMenuItem)); dXPopupMenu.Items.Add(dXMenuItemTextEdit2); image = ImageLoader.Instance.GetImageInfo("MenuBar_Clear").Image; dXMenuItemTextEdit2 = new TextEdit.DXMenuItemTextEdit(StringId.DateEditClear, new EventHandler(this.OnClearMenuItemSelected), image); dXMenuItemTextEdit2.Caption = CaptionHelper.GetLocalizedText("FileAttachments", "Editor_Clear"); dXMenuItemTextEdit2.UpdateElement = new TextEdit.MenuItemUpdateElement(dXMenuItemTextEdit2, new TextEdit.MenuItemUpdateHandler(this.UpdateClearMenuItem)); dXPopupMenu.Items.Add(dXMenuItemTextEdit2); return(dXPopupMenu); }
private void CreateButtons(Panel panel) { ASPxButton child = DevExpress.ExpressApp.Web.RenderHelper.CreateASPxButton(); child.Text = CaptionHelper.GetLocalizedText("DialogButtons", "Apply"); panel.Controls.Add(child); }
void DeleteViewVariant(SingleChoiceActionExecuteEventArgs e) { ShowViewVariantView(e, controller => DeleteViewVariantCore(((IModelListViewViewClonable)_rootListView).DeleteViewOnDelete), detailView => { detailView.Caption = CaptionHelper.GetLocalizedText(XpandViewVariantsModule.ViewVariantsModelCategory, "DeleteView"); var viewVariant = ((ViewVariant)detailView.CurrentObject); viewVariant.ShowCaption = false; }); }
void ModifyViewVariant(SingleChoiceActionExecuteEventArgs e) { ShowViewVariantView(e, controller => ModifyViewVariantCore(controller.Frame), detailView => { detailView.Caption = CaptionHelper.GetLocalizedText(XpandViewVariantsModule.ViewVariantsModelCategory, "ModiyView"); var viewVariant = ((ViewVariant)detailView.CurrentObject); viewVariant.VariantCaption = _changeVariantController.ChangeVariantAction.SelectedItem.Caption; }); }
private string GetColumnMask() { string mask = _gridView.FocusedColumn.DisplayFormat.FormatString; mask = mask.Length > 3 ? mask.Substring(3, mask.Length - 4) : ""; var localizedText = CaptionHelper.GetLocalizedText(XpandSystemWindowsFormsModule.XpandWin, "SelectedItemSumFormatString"); return(string.Format(localizedText, mask)); }
private static bool PromptOnExit(IModelOptionsApplicationExit modelOptionsApplicationExit) { if (modelOptionsApplicationExit.PromptOnExit) { var promptOnExitTitle = CaptionHelper.GetLocalizedText(XpandSystemWindowsFormsModule.XpandWin, "PromptOnExitTitle"); var promptOnExitMessage = CaptionHelper.GetLocalizedText(XpandSystemWindowsFormsModule.XpandWin, "PromptOnExitMessage"); return(WinApplication.Messaging.GetUserChoice(promptOnExitMessage, promptOnExitTitle, MessageBoxButtons.YesNo) != DialogResult.Yes); } return(false); }
void RenameViewVariant(SingleChoiceActionExecuteEventArgs e) { ShowViewVariantView(e, controller => RenameViewVariantCore((ViewVariant)(controller).Frame.View.CurrentObject), detailView => { detailView.Caption = CaptionHelper.GetLocalizedText(XpandViewVariantsModule.XpandViewVariants, "RenameView"); var viewVariant = ((ViewVariant)detailView.CurrentObject); viewVariant.ViewCaption = GetViewCaption(); viewVariant.VariantCaption = _changeVariantController.ChangeVariantAction.SelectedItem.Caption; }); }
protected override void UpdateActionState(object objectToOpen) { base.UpdateActionState(objectToOpen); if ((Application.Model.Options as IModelOpenObjectOptions).ShowTypeNameInOpenObject) { string caption = Application.Model.ActionDesign.Actions["OpenObject"].Caption; string altcaption = CaptionHelper.GetLocalizedText("Texts", "OpenObjectWithCaption"); OpenObjectAction.Caption = objectToOpen == null ? caption : String.Format(altcaption, CaptionHelper.GetClassCaption(objectToOpen.GetType().FullName)); } }
protected Boolean IsExitEditModeAllowed() { if ((View.ViewEditMode == ViewEditMode.Edit) && !_canExitEditMode && _isObjectSpaceModified && !(_isWarningShown && _exitEditModeByCancel)) { var unsavedObjectWarning = CaptionHelper.GetLocalizedText(XpandSystemAspNetModule.XpandWeb, _exitEditModeByCancel ? "CancelAgain" : "UnSavedChanges"); DevExpress.ExpressApp.Web.ErrorHandling.Instance.SetPageError(new UserFriendlyException(unsavedObjectWarning)); _isWarningShown = true; return(false); } return(true); }
private void actionViewAuditTrail_CustomizePopupWindowParams(object sender, CustomizePopupWindowParamsEventArgs e) { IObjectSpace space = Application.CreateObjectSpace(); if (space is XPObjectSpace) { object audit = this.View.CurrentObject; AuditTrailDetails details = new AuditTrailDetails((space as XPObjectSpace).Session, audit); details.Name = String.Format(CaptionHelper.GetLocalizedText("Texts", "AuditTrailTitle"), CaptionHelper.GetClassCaption(XafTypesInfo.Instance.FindTypeInfo(audit.GetType()).Type.FullName)); e.View = Application.CreateDetailView(space, details); } }
private ActionExecutePermissionDescriptor CreateNewActionOperationPermissionDescriptor(Type type, String targetAction, bool executeFromType) { string reason = ""; if (executeFromType) { reason = string.Concat(reason, executeFromType ? string.Format(CaptionHelper.GetLocalizedText("Messages", "Execute") + CaptionHelper.GetLocalizedText("Messages", "IsInheritedFrom") + CaptionHelper.GetLocalizedText("Messages", "TargetAction"), CaptionHelper.GetClassCaption(type.FullName)) : ""); } ActionExecutePermissionDescriptor newPermissionDescriptor = new ActionExecutePermissionDescriptor(this, type, targetAction, executeFromType, reason); return(newPermissionDescriptor); }
EditorButton CreateButton(string imageName, string tooltip, string tag) { var detailButton = new EditorButton { ImageLocation = ImageLocation.MiddleCenter, Kind = ButtonPredefines.Glyph, Image = ImageLoader.Instance.GetImageInfo(imageName).Image, ToolTip = CaptionHelper.GetLocalizedText("Texts", tooltip), Tag = tag, Enabled = AllowEdit.ResultValue }; return(detailButton); }
void CloneView(SingleChoiceActionExecuteEventArgs singleChoiceActionExecuteEventArgs) { var objectSpace = Application.CreateObjectSpace(); DetailView detailView = Application.CreateDetailView(objectSpace, objectSpace.CreateObject <ViewCloner>()); detailView.ViewEditMode = ViewEditMode.Edit; detailView.Caption = CaptionHelper.GetLocalizedText(XpandViewVariantsModule.XpandViewVariants, "CreateViewCaption"); singleChoiceActionExecuteEventArgs.ShowViewParameters.CreatedView = detailView; singleChoiceActionExecuteEventArgs.ShowViewParameters.TargetWindow = TargetWindow.NewModalWindow; var dialogController = new DialogController(); dialogController.Accepting += (o, args) => CloneView((ViewCloner)((DialogController)o).Frame.View.CurrentObject); singleChoiceActionExecuteEventArgs.ShowViewParameters.Controllers.Add(dialogController); }
private void Exporting(SelectExportBookingParameters selectedExportParameters) { if (selectedExportParameters == null) { return; } if (selectedExportParameters.Employee == null) { MessageBox.Show(CaptionHelper.GetLocalizedText("Texts", "NO_EMPLOYEE_SELECTED"), CaptionHelper.GetLocalizedText("Texts", "Error"), MessageBoxButtons.OK, MessageBoxIcon.Information); return; } var firstDayOfMonth = selectedExportParameters.ExportStart.ToShortDateString(); var lastDayOfMonth = selectedExportParameters.ExportEnd.ToShortDateString(); var bookingCriteria = GroupOperator.And( new BinaryOperator("Employee", selectedExportParameters.Employee), new BinaryOperator("Date", firstDayOfMonth, BinaryOperatorType.GreaterOrEqual), new BinaryOperator("Date", lastDayOfMonth, BinaryOperatorType.LessOrEqual)); var bookings = new List <IBooking>(); if (selectedExportParameters.WithVacation) { bookings = _objectSpace.GetObjects <IBooking>(bookingCriteria) .ToList(); } else { bookings = _objectSpace.GetObjects <IBooking>(bookingCriteria) .Where(b => !b.IsVacation && !b.IsPublicHoliday) .ToList(); } if (!bookings.Any()) { return; } var saveFolder = SelectFolderToSaveBookingExport(); if (saveFolder != null) { BookingExporter.ExportJdcBookings(_objectSpace, saveFolder, bookings); } }
private void PromptOnExit(CancelEventArgs e) { var applicationExit = ((IModelOptionsApplicationExit)Application.Model.Options); if (applicationExit.PromptOnExit) { var promptOnExitTitle = CaptionHelper.GetLocalizedText(XpandSystemWindowsFormsModule.XpandWin, "PromptOnExitTitle"); var promptOnExitMessage = CaptionHelper.GetLocalizedText(XpandSystemWindowsFormsModule.XpandWin, "PromptOnExitMessage"); if (WinApplication.Messaging.GetUserChoice(promptOnExitMessage, promptOnExitTitle, MessageBoxButtons.YesNo) != DialogResult.Yes) { e.Cancel = true; } } }
void SetupGridView(GridListEditorBase columnViewEditor) { var gridView = columnViewEditor.GridView as XpandGridView; if ((gridView != null) && (columnViewEditor.DataSource != null)) { gridView.OptionsView.ShowIndicator = false; var errorMessages = new ErrorMessages(); foreach (object obj in ListHelper.GetList(columnViewEditor.DataSource)) { errorMessages.AddMessage("ErrorMessage", obj, CaptionHelper.GetLocalizedText("Messages", "ValidationErrorMessage")); } gridView.ErrorMessages = errorMessages; } }
public override IList <PopupWindowShowAction> GetStartupActions() { try { ElasticSearchClient.Instance?.RefreshNecessaryIndexes(Application, p => { Application.UpdateStatus("ElasticSearch RefreshIndexes", p.Name, string.Format(CultureInfo.CurrentCulture, CaptionHelper.GetLocalizedText(ElasticSearchClient.MessageGroup, "RefreshProgress"), p.Phase, p.Position, p.Maximum, p.Position / (double)p.Maximum)); }); } catch (Exception e) { Tracing.Tracer.LogError(CaptionHelper.GetLocalizedText(ElasticSearchClient.MessageGroup, "RefreshLogError")); Tracing.Tracer.LogError(e); } return(base.GetStartupActions()); }
private void AddButtons(ASPxGridLookup control) { EditButton clearButton = new EditButton(); clearButton.ToolTip = CaptionHelper.GetLocalizedText("DialogButtons", "Clear"); ASPxImageHelper.SetImageProperties(clearButton.Image, "Editor_Clear"); control.Buttons.Add(clearButton); if (newObjectViewController.NewObjectAction.Items.Count > 0) { EditButton addButton = new EditButton(); addButton.ToolTip = CaptionHelper.GetLocalizedText("DialogButtons", "Add"); ASPxImageHelper.SetImageProperties(addButton.Image, "Editor_Add"); control.Buttons.Add(addButton); } }
public static String Get_InheritedFrom(IDCMemberPermissions memberPermissions) { String result = ""; if (memberPermissions.Owner != null) { if (memberPermissions.Owner.AllowRead) { result = String.Concat(result, String.Format(CaptionHelper.GetLocalizedText("Messages", "Read") + CaptionHelper.GetLocalizedText("Messages", "IsInheritedFrom"), CaptionHelper.GetClassCaption(memberPermissions.Owner.TargetType.FullName))); } if (memberPermissions.Owner.AllowWrite) { result = String.Concat(result, String.Format(CaptionHelper.GetLocalizedText("Messages", "Write") + CaptionHelper.GetLocalizedText("Messages", "IsInheritedFrom"), CaptionHelper.GetClassCaption(memberPermissions.Owner.TargetType.FullName))); } } return(result); }
private void ElasticSearchFullReIndex_Execute(object sender, SimpleActionExecuteEventArgs e) { ObjectSpace.CommitChanges(); try { WaitScreen.Instance.Show(CaptionHelper.GetLocalizedText(ElasticSearchClient.MessageGroup, "ReIndexWaitScreenCaption"), CaptionHelper.GetLocalizedText(ElasticSearchClient.MessageGroup, "ReIndexWaitScreenText")); ElasticSearchClient.Instance.RefreshIndexes(Application, p => { WaitScreen.Instance.Update(p.Name, string.Format(CultureInfo.CurrentCulture, CaptionHelper.GetLocalizedText(ElasticSearchClient.MessageGroup, "RefreshProgress"), p.Phase, p.Position, p.Maximum, p.Position / (double)p.Maximum)); }); } finally { WaitScreen.Instance.Hide(); } View.Refresh(); }
public CambiarIdiomaController( ) { TargetWindowType = WindowType.Main; defaultLanguageCaption = CaptionHelper.DefaultLanguage; defaultCultureCaption = CaptionHelper.GetLocalizedText("Texts", "DefaultCulture"); StoreDefaultCulture( ); chooseLanguage = new SingleChoiceAction(this, "ChooseLanguage", PredefinedCategory.Tools); chooseLanguage.Items.Add(new ChoiceActionItem(defaultLanguageCaption, defaultLanguageCaption, defaultLanguageCaption)); chooseLanguage.Items.Add(new ChoiceActionItem("es-AR", "Español (Argentina)", "es-AR")); chooseLanguage.SelectedIndex = 0; chooseFormattingCulture = new SingleChoiceAction(this, "ChooseFormattingCulture", PredefinedCategory.Tools); chooseFormattingCulture.Items.Add(new ChoiceActionItem(defaultCultureCaption, defaultCultureCaption, systemUserLanguage)); chooseFormattingCulture.Items.Add(new ChoiceActionItem("es-AR", "Español (Argentina)", "es-AR")); chooseFormattingCulture.SelectedIndex = 0; }
void RenameView() { var objectSpace = Application.CreateObjectSpace(); var viewCloner = objectSpace.CreateObject <ViewCloner>(); viewCloner.Caption = Frame.GetController <ChangeVariantController>().ChangeVariantAction.SelectedItem.Caption; var detailView = Application.CreateDetailView(objectSpace, viewCloner); detailView.ViewEditMode = ViewEditMode.Edit; detailView.Caption = CaptionHelper.GetLocalizedText(XpandViewVariantsModule.XpandViewVariants, "RenameViewToolTip"); var parameters = new ShowViewParameters(detailView) { TargetWindow = TargetWindow.NewModalWindow }; var controller = new DialogController(); controller.AcceptAction.Execute += RenameViewActionOnExecute; parameters.Controllers.Add(controller); Application.ShowViewStrategy.ShowView(parameters, new ShowViewSource(null, null)); }
private void gridControl_HandleCreated(object sender, EventArgs e) { var gridControl = sender as GridControl; _xpandFilterControl = new Editors.XpandFilterControl { Height = 150, Dock = ((IModelListViewFilterControlSettings)View.Model).FilterControlPosition, SourceControl = gridControl, UseMenuForOperandsAndOperators = false, AllowAggregateEditing = FilterControlAllowAggregateEditing.AggregateWithCondition }; IFilterColumnCollectionHelper helper = new FilterColumnCollectionHelper(Application, ObjectSpace, View.ObjectTypeInfo); _xpandFilterControl.SetFilterColumnsCollection(new MemberInfoFilterColumnCollection(helper)); OnCustomAssignFilterControlSourceControl(e); gridControl = (GridControl)_xpandFilterControl.SourceControl; if (!gridControl.FormsUseDefaultLookAndFeel) { _xpandFilterControl.LookAndFeel.Assign(gridControl.LookAndFeel); } _xpandFilterControl.FilterCriteria = GetCriteriaFromView(); var accept = new SimpleButton { Text = CaptionHelper.GetLocalizedText(XpandSystemWindowsFormsModule.XpandWin, "AcceptFilter") }; accept.Click += ((o, args) => _xpandFilterControl.ApplyFilter()); accept.Dock = Forms.DockStyle.Bottom; _xpandFilterControl.Controls.Add(accept); if (gridControl.Parent != null) { gridControl.Parent.Controls.Add(_xpandFilterControl); } else { gridControl.ParentChanged += gridControl_ParentChanged; } OnFilterControlCreated(EventArgs.Empty); }
public void Save(IFileData fileData) { using (SaveFileDialog saveFileDialog = new SaveFileDialog()) { saveFileDialog.CreatePrompt = false; saveFileDialog.OverwritePrompt = true; string text = Path.GetExtension(fileData.FileName).TrimStart(new char[] { '.' }); string localizedText = CaptionHelper.GetLocalizedText("FileAttachments", "WordAll"); string localizedText2 = CaptionHelper.GetLocalizedText("FileAttachments", "WordFiles"); saveFileDialog.Filter = string.Concat(new string[] { text.ToUpper(), " ", localizedText2, " (*.", text, ")|*.", text, "|", localizedText, " ", localizedText2, " (*.*)|*.*" }); //IModelOptionsFileAttachments modelOptionsFileAttachments = base.Application.Model.Options as IModelOptionsFileAttachments; //saveFileDialog.InitialDirectory = modelOptionsFileAttachments.Attachments.DefaultDirectory; saveFileDialog.FileName = fileData.FileName; saveFileDialog.Title = CaptionHelper.GetLocalizedText("FileAttachments", "OverwritePromptCaption"); if (saveFileDialog.ShowDialog(Form.ActiveForm) == DialogResult.OK) { //modelOptionsFileAttachments.Attachments.DefaultDirectory = Path.GetDirectoryName(saveFileDialog.FileName); using (FileStream fileStream = new FileStream(saveFileDialog.FileName, FileMode.Create)) { fileData.SaveToStream(fileStream); } } } }