Get() 공개 정적인 메소드

public static Get ( ) : MethodologyProvider
리턴 MethodologyProvider
        private bool IsMethodologyFollowed()
        {
            //Check if there are no photos
            if (this.result.PhotoList.Count <= 0)
            {
                NoPhotos = true;
                return(false);
            }

            //Check if methodology is followed
            if (Properties.Settings.Default.CheckPhotoCount)
            {
                //Fetch input categories from Methodology
                Methodology methodology = MethodologyProvider.Get().Methodology;

                //Check if any category doesnt have the required number of photos
                foreach (Category category in this.result.InputCategoryList)
                {
                    if (category.PhotoList.Count < methodology.InputCategories[category.Name].RequiredPhotoCount)
                    {
                        return(false);
                    }
                }
            }

            //If none of the checks fail, return true
            return(true);
        }
        private void AddAllPlaceHolders()
        {
            //Fetch input categories from Methodology
            Methodology methodology = MethodologyProvider.Get().Methodology;

            //Check if any category doesnt have the required number of photos
            foreach (Category category in this.result.InputCategoryList)
            {
                AddGroupPlaceHolders(category.Name);
            }
        }
 private void PlaceHolder()
 {
     foreach (string inputCategoryName in MethodologyProvider.Get().Methodology.InputCategories.Keys)
     {
         int count = GetCount(inputCategoryName);
         for (int i = 0; i < (5 - count); i++)
         {
             AddPlaceHolder(inputCategoryName);
         }
     }
     this.SelectPhotosGrid.DataContext = this.result;
     UpdateDataContext();
 }
        private void InputCategoryInfo_Click(object sender, RoutedEventArgs e)
        {
            Button buttonClicked = sender as Button;

            StackPanel        parentStackPanel  = buttonClicked.Parent as StackPanel;
            Grid              parentGrid        = parentStackPanel.Parent as Grid;
            TextBlock         categoryName      = parentGrid.FindName("CategoryName") as TextBlock;
            string            inputCategoryName = categoryName.Text;
            InputCategoryInfo inputCategoryInfo = MethodologyProvider.Get().Methodology.InputCategories[inputCategoryName];

            this.InstructionOverlay.Scroll.ScrollToTop();
            this.InstructionOverlay.CategoryInfoGrid.DataContext = inputCategoryInfo;
            this.InstructionOverlay.GeneralInfoGrid.DataContext  = MethodologyProvider.Get().Methodology;
            this.InstructionOverlay.Visibility = Visibility.Visible;
        }
        private void AddPhotos_Click(object sender, RoutedEventArgs e)
        {
            Button buttonClicked = sender as Button;

            StackPanel parentStackPanel  = buttonClicked.Parent as StackPanel;
            Grid       parentGrid        = parentStackPanel.Parent as Grid;
            TextBlock  categoryName      = parentGrid.FindName("CategoryName") as TextBlock;
            string     inputCategoryName = categoryName.Text;

            //Display Open File Dialog
            OpenFileDialog openFileDialog = new OpenFileDialog();

            openFileDialog.Title       = "Add a photo";
            openFileDialog.Filter      = "Picture Files (*.jpg, *.bmp, *.png) |*.jpg;*.bmp;*.png |All Files (*.*)|*.*";
            openFileDialog.Multiselect = true;
            Nullable <bool> fileOpenResult = openFileDialog.ShowDialog();

            //Add Files to PhotoFetcher
            if (fileOpenResult == true)
            {
                string[] filenames = openFileDialog.FileNames;

                RemovePlaceHolders(inputCategoryName);

                for (int fileIndex = 0; fileIndex < filenames.Length; fileIndex++)
                {
                    Photo photo = new Photo();
                    photo.Filename       = filenames.ElementAt(fileIndex);
                    photo.InputCategory  = inputCategoryName;
                    photo.SourceFilePath = filenames[fileIndex];
                    photo.Filename       = Path.GetFileName(filenames[fileIndex]);
                    if (photo.Filename.Equals("add_photo.png"))
                    {
                        photo.Name = "";
                    }
                    else
                    {
                        photo.Name = photo.Filename;
                    }
                    photo.OutputCategories = MethodologyProvider.Get().Methodology.InputCategories[inputCategoryName].outputCategories;

                    this.result.PhotoList.Add(photo);
                }
                AddAllPlaceHolders();
                UpdateDataContext();
            }
        }
        private void AddPlaceHolder(string inputCategoryName)
        {
            Photo photo = new Photo();

            photo.InputCategory  = inputCategoryName;
            photo.SourceFilePath = placeHolderImagePath;
            photo.Filename       = Path.GetFileName(placeHolderImagePath);
            if (photo.Filename.Equals("add_photo.png"))
            {
                photo.Name = "";
            }
            else
            {
                photo.Name = photo.Filename;
            }
            photo.OutputCategories = MethodologyProvider.Get().Methodology.InputCategories[inputCategoryName].outputCategories;//Get the list of outputCategories from the MethodologyProvider
            this.result.PhotoList.Add(photo);
        }
예제 #7
0
 public Result()
 {
     this.Name        = Properties.Resources.DefaultTestName;
     this.PhotoList   = new List <Photo>();
     this.Methodology = MethodologyProvider.Get().Methodology;
 }