private void ClearLastExecutedAction() { if (ParentLayout != null) { ParentLayout.ClearLastExecutedAction(); } }
private void DownloadFile(object parameter) { try { if (parameter != null) { var downloadingDocument = parameter as DocumentModel; if (downloadingDocument.DocUrl != null) { FTPHelper.DownloadFile(downloadingDocument.DocUrl); MessageBox.Show($"Document has been downloaded to '{Environment.ExpandEnvironmentVariables(@"%USERPROFILE%\Downloads")}'", "Download Succes", MessageBoxButton.OK, MessageBoxImage.Information); } else { MessageBox.Show("Invalid FTP Path for the document download", "Invalid Path", MessageBoxButton.OK, MessageBoxImage.Error); } } } catch (Exception ex) { App.Current.Dispatcher.Invoke((Action) delegate { ParentLayout.ShowMessageAsync("Error", ex.Message, MessageDialogStyle.Affirmative, new MetroDialogSettings() { ColorScheme = MetroDialogColorScheme.Accented }); }); } }
private void SelectFile(object parameter) { try { App.Current.Dispatcher.Invoke((Action) delegate { OpenFileDialog fileDialog = new OpenFileDialog(); //fileDialog.Filter = "Excel Sheets (*.xlsx)|*.xlsx|Excel Old(*.xls)|*xls"; if (fileDialog.ShowDialog() == true) { FilePath = fileDialog.FileName; } }); } catch (Exception ex) { App.Current.Dispatcher.Invoke((Action) delegate { ParentLayout.ShowMessageAsync("Error", ex.Message, MessageDialogStyle.Affirmative, new MetroDialogSettings() { ColorScheme = MetroDialogColorScheme.Accented }); }); } }
public override void AddTexture(string texture) { Console.WriteLine("TextureMaps AddTexture"); int index = ParentLayout.AddTexture(texture); TextureRef textureRef = new TextureRef(); textureRef.ID = (short)index; textureRef.Name = texture; TextureMaps = TextureMaps.AddToArray(textureRef); TextureTransforms = TextureTransforms.AddToArray(new BxlytTextureTransform()); }
public virtual bool Close(FormClosingMode closeMode) { //if (LifeTimeState == LifeTimeState.Closing) // return; if (closeMode != FormClosingMode.NoSave) { if (closeMode == FormClosingMode.SaveWithConfirmation) { if (!BaseActionPanel.ConfirmCancel(BusinessObject, FindForm())) { return(false); } ClearLastExecutedAction(); } else if (!Post()) { return(false); } } //сохраняем все переводы, если мы в режиме правки if (BaseSettings.TranslationMode && DCManager != null && DCManager.HasChanges) { if (!DCManager.SaveTranslations()) { return(false); } //ttForm.DCManager.Release(); } SaveGridLayout(); Release(); var form = FindForm(); if (form != null && form != BaseFormManager.MainForm) { form.Close(); return(true); } if (ParentLayout != null) { ParentLayout.Dispose(); } Dispose(); return(true); }
public override void AddTexture(string texture) { int index = ParentLayout.AddTexture(texture); TextureRef textureRef = new TextureRef(); textureRef.ID = (short)index; textureRef.Name = texture; TextureMaps = TextureMaps.AddToArray(textureRef); TexCoordGens.Add(new TexCoordGenEntry() { Type = TexCoordGenTypes.GX_TG_MTX2x4, MatrixSource = TexCoordGenMatrixSource.GX_DTTMTX9 + (TexCoordGens.Count * 4), Source = TexCoordGenSource.GX_TG_TEX0 }); TextureTransforms = TextureTransforms.AddToArray(new BxlytTextureTransform()); }
private async Task DeleteProject() { if (SelectedProject != null) { if (MessageBox.Show($"Are you sure you want to delete {SelectedProject.Title} ?", "Delete Record", MessageBoxButton.YesNo, MessageBoxImage.Warning) != MessageBoxResult.Yes) { return; } CanDeleteProject = false; try { HttpResponseMessage result = await apiHelper.DeleteProject(ParentLayout.LoggedInUser.Token, SelectedProject.ID).ConfigureAwait(false); if (result.IsSuccessStatusCode) { await GetProjects(); await ParentLayout.GetProjects(); ClearFields(); } else { MessageBox.Show("Error in deleting Project", "Error", MessageBoxButton.OK, MessageBoxImage.Error); } CanDeleteProject = true; } catch (Exception ex) { MessageBox.Show(ex.Message, "Error", MessageBoxButton.OK, MessageBoxImage.Error); CanDeleteProject = true; } } else { MessageBox.Show("Please select a Project to be deleted", "Select Project", MessageBoxButton.OK, MessageBoxImage.Warning); } }
private async Task CreateProject() { try { List <KeyValuePair <string, string> > values = new List <KeyValuePair <string, string> > { new KeyValuePair <string, string>("Title", Title), new KeyValuePair <string, string>("Project Type", TypeText), new KeyValuePair <string, string>("Project Status", StatusText), new KeyValuePair <string, string>("Firm", FirmText), new KeyValuePair <string, string>("Address", Address) }; if (FieldValidation.ValidateFields(values)) { if (Contractors.Where(c => c.IsChecked).Count() <= 0) { MessageBox.Show("Please add atleast 1 Contractor to the Project", "Add Contractor", MessageBoxButton.OK, MessageBoxImage.Warning); } else if (Suppliers.Where(c => c.IsChecked).Count() <= 0) { MessageBox.Show("Please add atleast 1 Supplier to the Project", "Add Supplier", MessageBoxButton.OK, MessageBoxImage.Warning); } else { CanSaveProject = false; List <ProjectContractorsModel> projectContractors = new List <ProjectContractorsModel>(); List <ProjectSuppliersModel> projectSuppliers = new List <ProjectSuppliersModel>(); Contractors.Where(s => s.IsChecked).ToList().ForEach(s => projectContractors.Add( new ProjectContractorsModel { ProjectID = ID, ContractorID = s.ID, })); Suppliers.Where(s => s.IsChecked).ToList().ForEach(s => projectSuppliers.Add( new ProjectSuppliersModel { ProjectID = ID, SupplierID = s.ID, })); ProjectModel projectData = new ProjectModel() { Title = Title, Description = Description, ProjectTypeID = SelectedType?.ID, Type = SelectedType == null ? new TypeModel { Title = TypeText, CreatedBy = ParentLayout.LoggedInUser.Name } : null, ProjectStatusID = SelectedStatus?.ID, Status = SelectedStatus == null ? new StatusModel { Title = StatusText, CreatedBy = ParentLayout.LoggedInUser.Name } : null, FirmID = SelectedFirm?.ID, Firm = SelectedFirm == null ? new FirmModel { Name = FirmText, CreatedBy = ParentLayout.LoggedInUser.Name } : null, StartDate = StartDate, DueDate = DueDate, Address = Address, TeamID = SelectedTeam?.ID, Contractors = projectContractors, Suppliers = projectSuppliers }; HttpResponseMessage result = null; if (isUpdate) { projectData.ID = ID; projectData.CreatedBy = SelectedProject.CreatedBy; projectData.CreatedOn = SelectedProject.CreatedOn; projectData.ModifiedBy = ParentLayout.LoggedInUser.Name; projectData.ModifiedOn = DateTime.Now; result = await apiHelper.PutProject(ParentLayout.LoggedInUser.Token, projectData).ConfigureAwait(false); } else { projectData.CreatedBy = ParentLayout.LoggedInUser.Name; projectData.CreatedOn = DateTime.Now; result = await apiHelper.PostProject(ParentLayout.LoggedInUser.Token, projectData).ConfigureAwait(false); } if (result.IsSuccessStatusCode) { MessageBox.Show($"Project Saved Successfully", "Success", MessageBoxButton.OK, MessageBoxImage.Information); await GetProjects(); await ParentLayout.GetProjects(); IsUpdate = false; ClearFields(); await GetContractors(); await GetSuppliers(); await GetTypes(); await GetStatuses(); await GetFirms(); } else { MessageBox.Show("Error in saving Project", "Error", MessageBoxButton.OK, MessageBoxImage.Error); } CanSaveProject = true; } } } catch (Exception ex) { MessageBox.Show(ex.Message, "Error", MessageBoxButton.OK, MessageBoxImage.Error); CanSaveProject = true; } }