Example #1
0
        public BankingProductPage(SampleCategory sampleCategory)
        {
            Title = sampleCategory.Name;
            InitializeComponent();

            BindingContext = new BankingProductViewModel(sampleCategory.Name);
        }
        public override void DoWork()
        {
            Logger.Info("Doing sample background processing work");
            // In this example we will just add a new SampleModel every 10 minutes.
            // It will also add a category called "Special" if it does not exist
            using (var session = DataService.OpenSession())
            {
                var specialCat = session.QueryOver <SampleCategory>().Where(c => c.Description == "Special").SingleOrDefault();
                if (specialCat == null) // create if does not exist
                {
                    Logger.Info("Special category does not exist, adding it");
                    specialCat = new SampleCategory()
                    {
                        Description = "Special"
                    };
                    DataService.SaveOrUpdate(session, specialCat);
                    session.Flush(); // Must flush so the db is updated
                }

                var modelCount = session.QueryOver <SampleModel>().RowCount() + 1;
                var newItem    = new SampleModel()
                {
                    Category      = specialCat,
                    DateValue     = DateTime.Now,
                    LongTestValue = "Auto #" + modelCount,
                    NumberValue   = modelCount,
                    StringValue   = "Auto #" + modelCount
                };
                DataService.SaveOrUpdate(session, newItem);

                session.Flush();
            }

            Logger.Info("Sample background processing complete");
        }
Example #3
0
 public SampleDefinition(string name, Type pageType, SampleType sampleType, SampleCategory sampleArea)
 {
     _name           = name;
     _pageType       = pageType;
     _sampleType     = sampleType;
     _sampleCategory = sampleArea;
 }
Example #4
0
        public PricingCalculatorDetailSelection(SampleCategory sampleCategory)
        {
            Title = sampleCategory.Name;
            InitializeComponent();

            BindingContext = new PricingCalculatorDetailSelectionViewModel(sampleCategory.Name);
        }
Example #5
0
 public ReferentialPage(SampleCategory sampleCategory)
 {
     InitializeComponent();
     SampleCategory        = sampleCategory;
     DetailedLineSituation = sampleCategory.DetailedLineSituation;
     BindingContext        = this;
 }
		public SamplesListFromCategory ( SampleCategory sampleCategory )
		{
			InitializeComponent ();

			BindingContext = sampleCategory;
			Title = sampleCategory.Name;
		}
Example #7
0
 public SampleDefinition
 (
     string name,
     Type pageType,
     SampleType sampleType,
     SampleCategory sampleArea,
     bool requiresEffects,
     bool requiresFastEffects,
     string imageUrl    = MissingThumbnailAsset,
     string description = null,
     bool featured      = false,
     DateTime dateAdded = new DateTime(),
     RuntimeSupportedSDKs.SDKVERSION sdkVersion = RuntimeSupportedSDKs.SDKVERSION._10586
 )
 {
     _name                = name;
     _pageType            = pageType;
     _sampleType          = sampleType;
     _sampleCategory      = sampleArea;
     _imageUrl            = imageUrl;
     _description         = description;          // used when showing more information about a sample, such as for featured samples
     _featured            = featured;
     _requiresEffects     = requiresEffects;
     _requiresFastEffects = requiresFastEffects;
     _sdkVersion          = sdkVersion;
     _dateAdded           = dateAdded;
 }
 public SampleDefinition(string name, Type pageType, SampleType sampleType, SampleCategory sampleArea)
 {
     _name           = name;
     _pageType       = pageType;
     _sampleType     = sampleType;
     _sampleCategory = sampleArea;
 }
Example #9
0
    private void UpdateHelp()
    {
      string name = null;
      SampleCategory category = SampleCategory.Unsorted;
      string summary = null;
      string description = null;
      if (_sample != null)
      {
        var sampleType = _sample.GetType();
        var sampleAttribute = SampleAttribute.GetSampleAttribute(sampleType);
        if (sampleAttribute != null)
        {
          name = sampleType.Name;
          category = sampleAttribute.Category;
          summary = sampleAttribute.Summary;
          description = sampleAttribute.Description;
        }
      }

      // Create help text for the sample.
      string helpText =
        "Sample: " + (string.IsNullOrEmpty(name) ? "No sample selected" : name) +
        "\nCategory: " + category +
        "\n" +
        "\nDescription:" +
        "\n--------------" +
        "\n" + (string.IsNullOrEmpty(summary) ? "-" : summary);

      if (!string.IsNullOrEmpty(description))
        helpText += "\n\n" + description;

      // General controls.
      helpText +=
        "\n\nControls:" +
        "\n-----------" +
        "\nGeneral" +
        "\n  Press <Esc> or <Back> to show menu." +
        "\n  Press <F1> or <Left Stick> to show help." +
        "\n  Press <F3> to show profiling data (and also reset the data)." +
        "\n  Press <F4> to show options." +
        "\n  Press <F7> to hide GUI." +
        "\n  Press <PageUp/Down> or <DPad Left/Right> to switch samples." +
        "\n  Press <Keyboard End> or <Left Shoulder>+<Right Shoulder> to restart sample." +
        "\n  Press <P> to pause/resume physics and particle simulation." +
        "\n  Press <T> to single step physics and particle simulation when simulation is paused.";

      // Controls of sample.
      if (_sample != null)
        foreach (var controlsAttribute in ControlsAttribute.GetControlsAttribute(_sample.GetType()))
          helpText += "\n\n" + controlsAttribute.Description;

      // Controls of game objects.
      foreach (var gameObject in _gameObjectService.Objects)
        foreach (var controlsAttribute in ControlsAttribute.GetControlsAttribute(gameObject.GetType()))
          helpText += "\n\n" + controlsAttribute.Description;

      _titleTextBlock.Text = (_sample != null) ? category + " - " + name : name;
      _helpTextBlock.Text = helpText;
    }
Example #10
0
 public NavigationItem(string displayName, SampleCategory cat, Type pageType, string featuredSamplesTitle = "", string categoryDescription = "")
 {
     _displayName          = displayName;
     _pageType             = pageType;
     _cat                  = cat;
     _featuredSamplesTitle = featuredSamplesTitle;
     _categoryDescription  = categoryDescription;
 }
 public SampleForDisplay(SampleCategory category, Sample sample)
 {
     CategoryId     = category.CategoryId;
     CategoryTitle  = category.Title;
     Id             = sample.Id;
     Title          = sample.Title;
     IconPath       = sample.IconPath ?? category.DefaultIconPath;
     IconAccentPath = sample.IconAccentPath ?? category.DefaultIconAccentPath;
 }
Example #12
0
        public void ToStringTestTutorial()
        {
            const SampleCategory Category = SampleCategory.Tutorial;
            var sample = new Sample("TutorialName", Category, "Game.sln", "Game.csproj", "Game.exe");

            Assert.AreEqual(
                "Sample: Title=Tutorial Name, Category=" + Category + ", Description=Tutorial",
                sample.ToString());
        }
 public SampleDefinition(string name, Type pageType, SampleType sampleType, SampleCategory sampleArea, bool requiresEffects, bool requiresFastEffects)
 {
     _name                = name;
     _pageType            = pageType;
     _sampleType          = sampleType;
     _sampleCategory      = sampleArea;
     _requiresEffects     = requiresEffects;
     _requiresFastEffects = requiresFastEffects;
 }
Example #14
0
 public TabbedPageRLC(SampleCategory counterpart)
 {
     CounterPart = counterpart.Name;
     Children.Add(new SamplesListFromCategoryPage(counterpart));
     Children.Add(new ReferentialPage(counterpart)
     {
         Title = "Detailed Situation"
     });
     InitializeComponent();
     BindingContext = this;
 }
Example #15
0
        void AddNavigationItem(ref List <NavigationItem> menu, String displayName, SampleCategory cat, Type pageType, string categoryDescription = "")
        {
            var samples = from sample in SampleDefinitions.Definitions
                          where (sample.SampleCategory == cat)
                          select sample;

            if (samples.Count <SampleDefinition>() > 0)
            {
                menu.Add(new NavigationItem(displayName, cat, pageType, categoryDescription: categoryDescription));
            }
        }
Example #16
0
        public void ToStringTest()
        {
            const string         Title       = "Sample's Name";
            const SampleCategory Category    = SampleCategory.Game;
            const string         Description = "Sample Game";
            var sample = new Sample(Title, Category, "Game.sln", "Game.csproj", "Game.exe");

            Assert.AreEqual(
                "Sample: Title=" + Title + ", Category=" + Category + ", Description=" + Description,
                sample.ToString());
        }
Example #17
0
    /// <summary>
    /// Initializes a new instance of the <see cref="SampleAttribute" /> class.
    /// </summary>
    /// <param name="category">The category.</param>
    /// <param name="summary">The summary.</param>
    /// <param name="description">The description.</param>
    /// <param name="order">The order.</param>
    public SampleAttribute(SampleCategory category, string summary, string description, int order)
    {
      if (summary == null)
        throw new ArgumentNullException("summary");
      if (description == null)
        throw new ArgumentNullException("description");

      Category = category;
      Summary = summary;
      Description = description;
      Order = order;
    }
Example #18
0
    /// <summary>
    /// Initializes a new instance of the <see cref="SampleAttribute" /> class.
    /// </summary>
    /// <param name="category">The category.</param>
    /// <param name="summary">The summary.</param>
    /// <param name="description">The description.</param>
    /// <param name="order">The order.</param>
    public SampleAttribute(SampleCategory category, string summary, string description, int order)
    {
      if (summary == null)
        throw new ArgumentNullException("summary");
      if (description == null)
        throw new ArgumentNullException("description");

      Category = category;
      Summary = summary;
      Description = description;
      Order = order;
    }
Example #19
0
        private void AddSample(SampleCategory category, string projectDirectory, string frameworkPath)
        {
            string projectName      = GetProjectNameFromLocation(projectDirectory);
            string prefix           = category == SampleCategory.Game ? "" : "DeltaEngine.Tutorials.";
            string solutionFilePath = category == SampleCategory.Game
                                ? Path.Combine(frameworkPath, "DeltaEngine.Samples.sln")
                                : Path.Combine(frameworkPath, "Tutorials", GetTutorialSolutionFileName(projectName));
            string projectFilePath    = Path.Combine(projectDirectory, prefix + projectName + ".csproj");
            string executableFilePath = Path.Combine(frameworkPath, prefix + projectName + ".exe");

            Samples.Add(new Sample(projectName, category, solutionFilePath, projectFilePath,
                                   executableFilePath));
        }
 public NavigationItem(
     string displayName,
     SampleCategory cat,
     Type pageType,
     string categoryDescription,
     string thumbnail)
 {
     _displayName          = displayName;
     _pageType             = pageType;
     _cat                  = cat;
     _featuredSamplesTitle = "";
     _categoryDescription  = categoryDescription;
     _thumbnail            = thumbnail;
 }
Example #21
0
 public void AddSample(SerializedSample sample)
 {
     map[sample.name] = sample;
     samples.Add(sample);
     sample.library = this;
     if (!categoryMap.TryGetValue(sample.category, out SampleCategory value))
     {
         SampleCategory sampleCategory = new SampleCategory();
         sampleCategory.name = sample.category;
         value = sampleCategory;
         categoryMap[sample.category] = value;
         categories.Add(value);
     }
     value.samples.Add(sample);
 }
Example #22
0
		public Sample(string name, SampleCategory category, string solutionFilePath,
			string projectFilePath, string assemblyFilePath)
		{
			Name = name;
			Category = category;
			if (Category == SampleCategory.Game)
				Description = "Sample Game";
			else if (Category == SampleCategory.Tutorial)
				Description = "Tutorial";
			else
				Description = "Visual Test";
			SetImageUrl(name);
			SolutionFilePath = solutionFilePath;
			ProjectFilePath = projectFilePath;
			AssemblyFilePath = assemblyFilePath;
		}
        void AddNavigationItem(
            List <NavigationItem> menu,
            String displayName,
            SampleCategory cat,
            Type pageType,
            string categoryDescription      = "",
            bool addEvenIfNoMatchingSamples = false,
            string thumbnail = "")
        {
            var samples = from sample in SampleDefinitions.Definitions
                          where (sample.SampleCategory == cat)
                          select sample;

            if ((samples.Count <SampleDefinition>() > 0) || addEvenIfNoMatchingSamples)
            {
                menu.Add(new NavigationItem(displayName, cat, pageType, categoryDescription: categoryDescription, thumbnail: thumbnail));
            }
        }
Example #24
0
        private void GetExecutablesFromInstallPath(DeltaEngineFramework framework,
                                                   SampleCategory category)
        {
            if (category != SampleCategory.Game && category != SampleCategory.Tutorial)
            {
                return;
            }
            string frameworkPath = Path.Combine(installPath, framework.ToString());

            string[] directories =
                Directory.GetDirectories(Path.Combine(frameworkPath,
                                                      category == SampleCategory.Game ? "Samples" : "Tutorials"));
            foreach (string projectDirectory in directories)
            {
                if (!projectDirectory.Contains("EmptyLibrary"))
                {
                    AddSample(category, projectDirectory, frameworkPath);
                }
            }
        }
Example #25
0
 public Sample(string name, SampleCategory category, string solutionFilePath,
               string projectFilePath, string assemblyFilePath)
 {
     Name     = name;
     Category = category;
     if (Category == SampleCategory.Game)
     {
         Description = "Sample Game";
     }
     else if (Category == SampleCategory.Tutorial)
     {
         Description = "Tutorial";
     }
     else
     {
         Description = "Visual Test";
     }
     SetImageUrl(name);
     SolutionFilePath = solutionFilePath;
     ProjectFilePath  = projectFilePath;
     AssemblyFilePath = assemblyFilePath;
 }
Example #26
0
        /// <summary>
        /// Invoked when the Page is loaded and becomes the current source of a parent Frame. Setting the View Model so that controls can bind to it.
        /// </summary>
        /// <param name="e">Event data that can be examined by overriding code. The event data is representative of the pending navigation that will load the current Page. Usually the most relevant property to examine is Parameter.</param>
        protected override async void OnNavigatedTo(NavigationEventArgs e)
        {
            base.OnNavigatedTo(e);

            var category = e.Parameter as SampleCategory;

            if (category != null)
            {
                ViewModel = category;
                return;
            }

            // If not a direct category then it is a search result
            var query = e.Parameter.ToString();

            var customCategory = new SampleCategory
            {
                Samples = await Samples.FindSamplesByName(query),
                Name    = $"Search for \"{query}\""
            };

            ViewModel = customCategory;
        }
Example #27
0
            public void RemoveMissing()
            {
                map.Clear();
                Dictionary <string, SampleCategory> dictionary = categoryMap;

                categoryMap = new Dictionary <string, SampleCategory>();
                categories.Clear();
                for (int num = samples.Count - 1; num >= 0; num--)
                {
                    SerializedSample serializedSample = samples[num];
                    serializedSample.RemoveMissingCips();
                    if (serializedSample.clips.Count == 0)
                    {
                        samples.RemoveAt(num);
                    }
                    else
                    {
                        map[serializedSample.name] = serializedSample;
                        if (!categoryMap.TryGetValue(serializedSample.category, out SampleCategory value))
                        {
                            if (dictionary.TryGetValue(serializedSample.category, out value))
                            {
                                value.samples.Clear();
                            }
                            else
                            {
                                SampleCategory sampleCategory = new SampleCategory();
                                sampleCategory.name = serializedSample.category;
                                value = sampleCategory;
                            }
                            categoryMap[serializedSample.category] = value;
                            categories.Add(value);
                        }
                        value.samples.Add(serializedSample);
                    }
                }
            }
 private void ShadowGrid_Tapped(object sender, TappedRoutedEventArgs e) => this.Category = null;
Example #29
0
 public static async Task NavigateToCategory(SampleCategory sampleCategory, INavigation navigation)
 {
     await navigation.PushAsync(new TabbedPageRLC(sampleCategory));
 }
Example #30
0
 public SamplePageAttribute(SampleCategory category, string title, SourceSdk source = SourceSdk.WinUI)
 {
     Category = category;
     Title    = title;
     Source   = source;
 }
        /// <summary>
        /// Invoked when the Page is loaded and becomes the current source of a parent Frame. Setting the View Model so that controls can bind to it.
        /// </summary>
        /// <param name="e">Event data that can be examined by overriding code. The event data is representative of the pending navigation that will load the current Page. Usually the most relevant property to examine is Parameter.</param>
        protected override void OnNavigatedTo(NavigationEventArgs e)
        {
            base.OnNavigatedTo(e);

            ViewModel = e.Parameter as SampleCategory;
        }
 public SampleDefinition(string name, Type type, SampleCategory category)
 {
     Name = name;
     Type = type;
     Category = category;
 }
		public static async Task NavigateToCategory(SampleCategory sampleCategory, INavigation navigation){
			await navigation.PushAsync( new SamplesListFromCategory( sampleCategory ) );
		}
Example #34
0
 private void AddSample(SampleCategory category, string projectDirectory, string frameworkPath)
 {
     string projectName = GetProjectNameFromLocation(projectDirectory);
     string prefix = category == SampleCategory.Game ? "" : "DeltaEngine.Tutorials.";
     string solutionFilePath = category == SampleCategory.Game
         ? Path.Combine(frameworkPath, "DeltaEngine.Samples.sln")
         : Path.Combine(frameworkPath, "Tutorials", GetTutorialSolutionFileName(projectName));
     string projectFilePath = Path.Combine(projectDirectory, prefix + projectName + ".csproj");
     string executableFilePath = Path.Combine(frameworkPath, prefix + projectName + ".exe");
     Samples.Add(new Sample(projectName, category, solutionFilePath, projectFilePath,
         executableFilePath));
 }
Example #35
0
 public CategorySamples(SampleCategory category, IEnumerable <ISample> samples)
 {
     Category = category;
     Samples  = new BindableCollection <ISample>(samples.OrderBy(x => x.DisplayName));
 }
Example #36
0
 public SampleDefinition(string name, Type type, SampleCategory category)
 {
     Name     = name;
     Type     = type;
     Category = category;
 }
Example #37
0
 public static async Task NavigateToCategory(SampleCategory sampleCategory, INavigation navigation)
 {
     await navigation.PushAsync(new PricingCalculatorDetailSelection(sampleCategory));
 }
Example #38
0
 private void GetExecutablesFromInstallPath(DeltaEngineFramework framework,
     SampleCategory category)
 {
     if (category != SampleCategory.Game && category != SampleCategory.Tutorial)
         return;
     string frameworkPath = Path.Combine(installPath, framework.ToString());
     string[] directories =
         fileSystem.Directory.GetDirectories(Path.Combine(frameworkPath,
             category == SampleCategory.Game ? "Samples" : "Tutorials"));
     foreach (string projectDirectory in directories)
         if (!projectDirectory.Contains("EmptyLibrary"))
             AddSample(category, projectDirectory, frameworkPath);
 }
		public static Page GetPage( SampleCategory sampleCategory )
		{
			return new SamplesListFromCategory( sampleCategory );
		}
Example #40
0
 public Sample(string title, SampleCategory category, string solutionFilePath,
     string projectFilePath, string assemblyFilePath)
 {
     Title = title;
     Category = category;
     if (Category == SampleCategory.Game)
     {
         Description = SampleGameDescriptions.ContainsKey(Title)
             ? SampleGameDescriptions[Title] : "Sample Game";
         SetImageUrl(Title);
     }
     else if (Category == SampleCategory.Tutorial)
     {
         Description = TutorialDescritions.ContainsKey(Title)
             ? TutorialDescritions[Title] : "Tutorial";
         SetImageUrl("Tutorial");
         Title = Title.SplitWords(false);
     }
     else
     {
         Description = "Visual Test";
         SetImageUrl("VisualTest");
     }
     SolutionFilePath = solutionFilePath;
     ProjectFilePath = projectFilePath;
     AssemblyFilePath = assemblyFilePath;
 }