示例#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
 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);
                    }
                }
            });
        }