コード例 #1
0
        private void btnEditImage_Click(object sender, EventArgs e)
        {
            var diag = new ImageDialog(this, _edSvc.CurrentConnection, _sym, _image);

            diag.ShowDialog(this);
            OnResourceChanged();
        }
コード例 #2
0
ファイル: Form1.cs プロジェクト: JackoT-Bit/ImagetoVideo
 private void imageSelectButton_Click(object sender, EventArgs e)
 {
     if (ImageDialog.ShowDialog() == DialogResult.OK)
     {
         imagePath          = ImageDialog.FileName;
         imagePathText.Text = imagePath;
     }
 }
コード例 #3
0
        /// <summary>
        /// The <see cref="Control.Click"/> event handler for the
        /// <see cref="Button"/> <see cref="btnImage"/>.
        /// Shows a <see cref="ImageDialog"/> to define an umage stimulus
        /// that is added to all imported slides.
        /// </summary>
        /// <param name="sender">Source of the event.</param>
        /// <param name="e">An empty <see cref="EventArgs"/></param>
        private void btnImage_Click(object sender, EventArgs e)
        {
            ImageDialog dlg = new ImageDialog();

            if (dlg.ShowDialog() == DialogResult.OK)
            {
                VGImage image = dlg.NewImage;
                image.Canvas = Document.ActiveDocument.PresentationSize;
                this.cbbDesignedItem.Items.Add(image);
                this.cbbDesignedItem.SelectedItem = image;
            }
        }
コード例 #4
0
        private void buttonSlideBackground_Click(object sender, EventArgs e)
        {
            ImageDialog imd = new ImageDialog(ImgManager)
            {
                Background = Song.Parts[CurrentPartId].Slides[CurrentSlideId].Background
            };

            // Set "use background for all slides" checkbox to true if no or only one image used
            imd.UseForAll = Song.GetNumberOfBackgroundImages() <= 1;

            if (imd.ShowDialog(this) == DialogResult.OK)
            {
                if (imd.Background != null)
                {
                    if (imd.UseForAll)
                    {
                        foreach (SongPart t in Song.Parts)
                        {
                            foreach (SongSlide t1 in t.Slides)
                            {
                                t1.Background = imd.Background;
                            }
                        }
                    }
                    else
                    {
                        Song.Parts[CurrentPartId].Slides[CurrentSlideId].Background = imd.Background;
                    }
                }
                else
                {
                    if (imd.UseForAll)
                    {
                        foreach (SongPart t in Song.Parts)
                        {
                            foreach (SongSlide t1 in t.Slides)
                            {
                                t1.Background = TemplateMapper.GetDefaultBackground();
                            }
                        }
                    }
                    else
                    {
                        Song.Parts[CurrentPartId].Slides[CurrentSlideId].Background = TemplateMapper.GetDefaultBackground();
                    }
                }
                PreviewSlide();
            }
        }
コード例 #5
0
        private void BtnBrowse_Click(object sender, EventArgs e)
        {
            string temp = Directory.GetCurrentDirectory();

            try
            {
                ImageDialog.ShowDialog();
                PicLogoImage.Image = Image.FromFile(ImageDialog.FileName);
            }
            catch
            {
                ImageDialog.FileName = "";
            }
            Directory.SetCurrentDirectory(temp);
        }
コード例 #6
0
        public ShowAllStudentViewModel()
        {
            TabTitle = "Show Students";
            Application.Current.Dispatcher.InvokeAsync(() =>
            {
                UserControl = new ShowAllStudent()
                {
                    DataContext = this
                };
            });

            SchoolObjContext Context = new SchoolObjContext();

            AllStudents = new ObservableCollection <object>(Context.Students.Join(
                                                                Context.Standards,
                                                                s => s.StandardId,
                                                                std => std.StandardId,
                                                                (s, std) => new
            {
                Student      = s,
                StandardName = std.StandardName
            }
                                                                ).ToList());

            RemoveRecordCommand = new RelayCommand(x => RemoveRecord());
            EditStudentCommand  = new RelayCommand(x => EditStudent(x));
            ShowResultCommand   = new RelayCommand(x =>
            {
                var Student = Context.Students.Where(s => s.StudentId == (int)x).FirstOrDefault();
                if (Student == null)
                {
                    return;
                }
                var check = (from sheet in Context.AllMarks
                             where sheet.StudentId == Student.StudentId && sheet.StandardId == Student.StandardId
                             select sheet).FirstOrDefault();
                if (check == null)
                {
                    if (MessageBox.Show("Result not available yet, click 'Yes' to generate", "Result not available", MessageBoxButton.YesNo, MessageBoxImage.Question) == MessageBoxResult.Yes)
                    {
                        MainViewModel.Tabs.Add(new ViewModels.ResultViewModel((int)CurrentItem.Student.StudentId, 0, true));
                        return;
                    }
                }
                else
                {
                    MainViewModel.Tabs.Add(new ViewModels.ResultViewModel((int)CurrentItem.Student.StudentId));
                }
            });
            ShowDocumentCommand = new RelayCommand(x =>
            {
                var stud = x as EntityDatabase.DomainClasses.Student;
                if (stud.DocType.Equals("photo", StringComparison.InvariantCultureIgnoreCase))
                {
                    ImageDialog imageDialog = new ImageDialog(stud);
                    imageDialog.ShowDialog();
                }
                else
                {
                    var Dialog = new SaveFileDialog()
                    {
                        Filter   = "PDF file (*.pdf)|*.pdf",
                        FileName = "Document.pdf"
                    };
                    if (Dialog.ShowDialog() == false)
                    {
                        return;
                    }

                    using (Stream file = File.OpenWrite(@Dialog.FileName))
                    {
                        file.Write(stud.Doc, 0, stud.Doc.Length);
                    }
                }
            });
        }