예제 #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;
    }
예제 #2
0
파일: BcfFile.cs 프로젝트: pix3lot/BCFier
 public void RemoveComment(Comment comment, Markup issue)
 {
     issue.Comment.Remove(comment);
       HasBeenSaved = false;
 }
예제 #3
0
        private void OnAddComment(object sender, ExecutedRoutedEventArgs e)
        {
            try
              {

            if (SelectedBcf() == null)
              return;
            var values = (object[])e.Parameter;
            var view = values[0] as ViewPoint;
            var issue = values[1] as Markup;
            var content = values[2].ToString();
            var status = (values[3] == null) ? "" : values[3].ToString();
            var verbalStatus = values[4].ToString();
            if (issue == null)
            {
              MessageBox.Show("No Issue selected", "Error", MessageBoxButton.OK, MessageBoxImage.Error);
              return;
            }

              Comment c = new Comment();
              c.Guid = Guid.NewGuid().ToString();
              c.Comment1 = content;
              c.Topic = new CommentTopic();
              c.Topic.Guid = issue.Topic.Guid;
              c.Date = DateTime.Now;
              c.VerbalStatus = verbalStatus;
              c.Status = status;
              c.Author = Utils.GetUsername();

            c.Viewpoint = new CommentViewpoint();
            c.Viewpoint.Guid = (view != null) ? view.Guid : "";

              issue.Comment.Add(c);

              SelectedBcf().HasBeenSaved = false;

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