private void EmailPDF_Click(object sender, RoutedEventArgs e) { PDFExport pdf = new PDFExport(); string filename; Stone stone = StonesView.GetCurrentSelectedStone(); if (stone.MediaType == 2) { MessageBox.Show("You can't create PDF for a video"); return; } if (stone != null) { filename = pdf.CreateRawPDFinTemp(stone); if (!String.IsNullOrWhiteSpace(filename)) { List <string> files = new List <string>(); files.Add(stone.FullFilePath); files.Add(filename); SharingUtils.OpenNewEmailWithOutlook(files); } } }
private void ViewOrderBy(object sender, RoutedEventArgs e) { //TODO fix the radio button beheivier string tag = (string)((MenuItem)sender).Tag; switch (tag) { case "name": StonesView.SortProperty = 1; break; case "date": StonesView.SortProperty = 2; break; case "type": StonesView.SortProperty = 3; break; case "size": StonesView.SortProperty = 4; break; case "weight": StonesView.SortProperty = 5; break; default: break; } StonesView.RefreshView(); }
private void ViewSaveAsMenu_Click(object sender, RoutedEventArgs e) { string file = StonesView.GetCurrentSelectedStoneFilename(); if (!String.IsNullOrEmpty(file)) { StonesView.PreformSaveAsOfStone(file); } }
private void ViewRenameMenu_Click(object sender, RoutedEventArgs e) { string file = StonesView.GetCurrentSelectedStoneFilename(); if (!String.IsNullOrEmpty(file)) { StonesView.OpenRenameDialogAndPreformRename(file); } }
private void Window_Loaded(object sender, RoutedEventArgs e) { try { logger.Info("logging v2"); ActivationManager am = new ActivationManager(); am.PresistActivation(); // am.IsExipred(); logger.Info("get capture instance"); Capture capture = Capture.GetInstance(); logger.Info("set the device to the wpf"); capture.SetCaptureDeviceWPFControl(videoElement); //folder view logger.Info("open the categories"); StonesView.ViewControl = ViewControl; DirectoryManager dm = DirectoryManager.GetInstance(); string path = dm.GetHomeFolder(); FolderBrowser fb = FolderBrowser.GetInstance(); logger.Info("set working folder"); fb.SetFolderControl(this.FolderBrowserTree); fb.AddItemClickEvents(); fb.Init(path); StonesView.StoneInfoDisplayControl = StoneInfo; StonesView.InitStonesView(); logger.Info("Init stone view"); StonesView.LoadImagesToImageView(path); logger.Info("loading images"); if (SettingsManager.ReadBoolSetting("RunFirstTime")) { //TODO add here things to run the first time //Options options = new Options(); //options.Owner = this; //options.Show(); SettingsManager.WriteBoolSetting("RunFirstTime", false); } CaptureMovieProcessFlow flow = CaptureMovieProcessFlow.GetInstance(); flow.TextBlock = this.MovieFlowTimerText; flow.CaptureFacede = capture; } catch (Exception ex) { MessageBox.Show(ex.Message); MessageBox.Show(ex.StackTrace); throw; } }
private void ViewDeleteMenu_Click(object sender, RoutedEventArgs e) { string file = StonesView.GetCurrentSelectedStoneFilename(); //TODO add the stone file name if (!String.IsNullOrEmpty(file) && (MessageBox.Show("Are you sure you want to delete this stone", "Delete", MessageBoxButton.YesNo) == MessageBoxResult.Yes)) { StonesView.PreformDeleteOfStone(file); } }
private void ViewPrintMenu_Click(object sender, RoutedEventArgs e) { //MessageBox.Show("Not worknig yet..."); if (StonesView.GetCurrentSelectedStones().Count > 0) { Print print = new Print(); print.ShowDialog(); } else { MessageBox.Show("No stones selected"); } }
private void ViewOrderByDirection(object sender, RoutedEventArgs e) { string tag = (string)((MenuItem)sender).Tag; if (tag == "asc") { StonesView.SortPropertyDirection = 1; } else { StonesView.SortPropertyDirection = 2; } StonesView.RefreshView(); }
private void ViewEmailMenu_Click(object sender, RoutedEventArgs e) { SharingUtils sharing = new SharingUtils(); List <string> files = StonesView.GetCurrentSelectedStoneFilenames(); if (files != null) { SharingUtils.OpenNewEmailWithOutlook(files); } else { MessageBox.Show("No stones selected"); } }
private void CreatePDF_Click(object sender, RoutedEventArgs e) { PDFExport pdf = new PDFExport(); Stone stone = StonesView.GetCurrentSelectedStone(); if (stone.MediaType == 2) { MessageBox.Show("You can't create PDF for a video"); return; } if (stone != null) { pdf.CreatePDFFile(stone); } }
private void SaveDiamond_Click(object sender, RoutedEventArgs e) { StonesRepository rep = new StonesRepository(FolderUponCaptureEvent); //Create the infoparts from input controls string filename = Path.Combine(FolderUponCaptureEvent, this.Filename.Text); filename = Path.ChangeExtension(filename, "jpg"); if (rep.IsStoneExists(filename) && this.EditMode == false) { MessageBoxResult result = MessageBox.Show("The filename already exists, do you want to override the existing file", "File exists", MessageBoxButton.YesNo); if (result == MessageBoxResult.No) { return; } } BitmapSource source = (BitmapSource)this.CapturedImage.Source; List <StoneInfoPart> infoparts = new List <StoneInfoPart>(); foreach (StackPanel panel in this.InfoPartsInputsContainer.Children) { StoneInfoPart infopart = new StoneInfoPart(); if (panel.Children.OfType <TextBox>().SingleOrDefault() != null) { infopart.Title = (string)panel.Children.OfType <TextBox>().SingleOrDefault().Tag; infopart.Value = panel.Children.OfType <TextBox>().SingleOrDefault().Text; infopart.TitleForReport = (string)panel.Children.OfType <Label>().SingleOrDefault().Content; } else if (panel.Children.OfType <ComboBox>().SingleOrDefault() != null) { infopart.Title = (string)panel.Children.OfType <ComboBox>().SingleOrDefault().Tag; infopart.Value = (string)((ComboBoxItem)panel.Children.OfType <ComboBox>().SingleOrDefault().SelectedItem).Tag; infopart.TitleForReport = (string)panel.Children.OfType <Label>().SingleOrDefault().Content; } infoparts.Add(infopart); } if (this.ValidateUserInput() == false) { MessageBox.Show("Filename,Stonetype,Stone Weight,Clarity and color are mendatory fields..."); return; } if (this.EditMode) { rep.UpdateStone(filename, infoparts); } else { rep.CreateANewStone(source, filename, infoparts); } //WebCam webcam = WebCam.GetInstance(); // webcam.Start(); StonesView.RefreshView(); this.Close(); }
private void ViewEditMenu_Click(object sender, RoutedEventArgs e) { StonesView.EditStoneItem(); }
private void SaveDiamond_Click(object sender, RoutedEventArgs e) { try { StonesRepository rep = new StonesRepository(FolderUponCaptureEvent); //Create the infoparts from input controls if (this.ValidateUserInput() == false) { MessageBox.Show("Filename,Stonetype,Stone Weight,Clarity and color are mendatory fields..."); return; } string filename = Path.Combine(FolderUponCaptureEvent, this.Filename.Text); filename = Path.ChangeExtension(filename, "mp4"); if (rep.IsStoneExists(filename) && this.EditMode == false) { MessageBoxResult result = MessageBox.Show("The filename already exists, do you want to override the existing file", "File exists", MessageBoxButton.YesNo); if (result == MessageBoxResult.No) { return; } } if (!String.IsNullOrWhiteSpace(TempFileName)) { ICAVConverter converter = new CAVConverter(); converter.SetLicenseKey("*****@*****.**", "62A80CE3A6DB3F755C8C7478D44332E5928296AC08E61FCCD052D464049EDDEFCE62B2ED069F1396AC27F7DA120E6A3FDE982ACA8B49A4E8735552303198E03250EFE9D36E9E5349D2E289FF18D6C919CAB81199B4B24B13ABDF70CBB53605C844B1ED2C4164D08B1B4392C526C3D49E4100C1399C052C986BA57392042AC468BF0DDFD7BA5B12AFC4F2FFC21F9DF83D75C054DC6DBC198B091AD0E8AFD49D7A8CBA1E6B1BEA6BE3E0A3B41DA51B79E0678A7B675D3183618229AF2D50650A8505E9EA106E8507156E53ECA07973D883152F3CF4A75EBA57576B50A56117E2B129C5734150D552B7519D28AA7368895C740444BFEC403C041F4BA207F1258786"); converter.LoadAVLib(AppDomain.CurrentDomain.BaseDirectory + LIBAV_PATH); converter.OutputOptions = new COutputOptions(); converter.OutputOptions.FrameSize = "640x480"; converter.OutputOptions.VideoBitrate = Convert.ToInt32(((ComboBoxItem)cmb_quality.SelectedItem).Tag); converter.OutputOptions.DisableAudio = true; converter.OutputOptions.FrameRate = "30"; //Set output video bitrate // converter.LogPath = @"c:\log.txt"; // converter.LogLevel = CLogLevel.cllDebug; try { converter.AddTask(TempFileName, filename); converter.StartAndWait(); } catch (Exception ex) { MessageBox.Show(ex.Message); throw; } // File.Move(TempFileName, filename); } List <StoneInfoPart> infoparts = new List <StoneInfoPart>(); foreach (StackPanel panel in this.InfoPartsInputsContainer.Children) { StoneInfoPart infopart = new StoneInfoPart(); if (panel.Children.OfType <TextBox>().SingleOrDefault() != null) { infopart.Title = (string)panel.Children.OfType <TextBox>().SingleOrDefault().Tag; infopart.Value = panel.Children.OfType <TextBox>().SingleOrDefault().Text; infopart.TitleForReport = (string)panel.Children.OfType <Label>().SingleOrDefault().Content; } else if (panel.Children.OfType <ComboBox>().SingleOrDefault() != null) { infopart.Title = (string)panel.Children.OfType <ComboBox>().SingleOrDefault().Tag; infopart.Value = (string)((ComboBoxItem)panel.Children.OfType <ComboBox>().SingleOrDefault().SelectedItem).Tag; infopart.TitleForReport = (string)panel.Children.OfType <Label>().SingleOrDefault().Content; } infoparts.Add(infopart); } if (this.EditMode) { rep.UpdateStone(filename, infoparts); } else { rep.CreateANewStoneMovie(filename, infoparts); } //WebCam webcam = WebCam.GetInstance(); // webcam.Start(); StonesView.RefreshView(); this.Close(); } catch (Exception ex) { MessageBox.Show(ex.Message); MessageBox.Show(ex.StackTrace); throw; } }
private void Window_Loaded(object sender, RoutedEventArgs e) { List <Stone> stones = StonesView.GetCurrentSelectedStones().Where(m => m.MediaType == 1).ToList <Stone>(); for (int i = 0; i < stones.Count; i += 2) { TableRow row = new TableRow(); TableCell cell1 = new TableCell(); Paragraph p1 = new Paragraph(); Image img1 = new Image(); BitmapImage src1 = new BitmapImage(); src1.BeginInit(); src1.UriSource = new Uri(stones[i].FullFilePath, UriKind.Absolute); src1.EndInit(); img1.Source = src1; TextBlock block1 = new TextBlock(); block1.Text = stones[i].CompositeDescription; block1.Style = (Style)FindResource("stoneDescription"); p1.Inlines.Add(img1); p1.Inlines.Add(block1); cell1.Blocks.Add(p1); row.Cells.Add(cell1); //check if we add the second cell to the current row if (i + 1 < stones.Count) { TableCell cell2 = new TableCell(); Paragraph p2 = new Paragraph(); Image img2 = new Image(); BitmapImage src2 = new BitmapImage(); src2.BeginInit(); src2.UriSource = new Uri(stones[i + 1].FullFilePath, UriKind.Absolute); src2.EndInit(); img2.Source = src2; TextBlock block2 = new TextBlock(); block2.Style = (Style)FindResource("stoneDescription"); block2.Text = stones[i + 1].CompositeDescription; p2.Inlines.Add(img2); p2.Inlines.Add(block2); cell2.Blocks.Add(p2); row.Cells.Add(cell2); } flowRowsContainer.Rows.Add(row); } }