Ejemplo n.º 1
0
        private void Button_OK(object sender, RoutedEventArgs e)
        {
            var view = new ViewPoint(!Issue.Viewpoints.Any());

            if (!Directory.Exists(Path.Combine(TempFolder, Issue.Topic.Guid)))
            {
                Directory.CreateDirectory(Path.Combine(TempFolder, Issue.Topic.Guid));
            }


            if (!string.IsNullOrEmpty(CommentBox.Text))
            {
                var c = new Comment
                {
                    Comment1     = CommentBox.Text,
                    Author       = Utils.GetUsername(),
                    Status       = comboStatuses.SelectedValue.ToString(),
                    VerbalStatus = VerbalStatus.Text,
                    Date         = DateTime.Now,
                    Viewpoint    = new CommentViewpoint {
                        Guid = view.Guid
                    }
                };
                Issue.Comment.Add(c);
            }
            //first save the image, then update path
            var path = Path.Combine(TempFolder, Issue.Topic.Guid, view.Snapshot);

            ImagingUtils.SaveImageSource(SnapshotImg.Source, path);
            view.SnapshotPath = path;

            //neede for UI binding
            Issue.Viewpoints.Add(view);

            var win = Window.GetWindow(this);

            if (win != null)
            {
                win.DialogResult = true;
            }
        }
Ejemplo n.º 2
0
        private void EditSnapshot_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                string editSnap = "mspaint";
                string tempImg  = Path.Combine(Path.GetTempPath(), "BCFier", Path.GetTempFileName() + ".png");
                ImagingUtils.SaveImageSource(SnapshotImg.Source, tempImg);

                if (!File.Exists(tempImg))
                {
                    MessageBox.Show("Snapshot is not a valit image, please try again.", "Error!", MessageBoxButton.OK, MessageBoxImage.Error);
                    return;
                }
                string customeditor = UserSettings.Get("editSnap");
                if (!string.IsNullOrEmpty(customeditor) && File.Exists(customeditor))
                {
                    editSnap = customeditor;
                }



                var paint     = new Process();
                var paintInfo = new ProcessStartInfo(editSnap, "\"" + tempImg + "\"");
                paintInfo.UseShellExecute = false;
                paint.StartInfo           = paintInfo;
                paint.Start();
                paint.WaitForExit();


                AddViewpoint(tempImg);
                File.Delete(tempImg);
            }
            catch (System.Exception ex1)
            {
                MessageBox.Show("exception: " + ex1);
            }
        }