コード例 #1
0
        public BankingProductPage(SampleCategory sampleCategory)
        {
            Title = sampleCategory.Name;
            InitializeComponent();

            BindingContext = new BankingProductViewModel(sampleCategory.Name);
        }
コード例 #2
0
        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");
        }
コード例 #3
0
 public SampleDefinition(string name, Type pageType, SampleType sampleType, SampleCategory sampleArea)
 {
     _name           = name;
     _pageType       = pageType;
     _sampleType     = sampleType;
     _sampleCategory = sampleArea;
 }
コード例 #4
0
        public PricingCalculatorDetailSelection(SampleCategory sampleCategory)
        {
            Title = sampleCategory.Name;
            InitializeComponent();

            BindingContext = new PricingCalculatorDetailSelectionViewModel(sampleCategory.Name);
        }
コード例 #5
0
 public ReferentialPage(SampleCategory sampleCategory)
 {
     InitializeComponent();
     SampleCategory        = sampleCategory;
     DetailedLineSituation = sampleCategory.DetailedLineSituation;
     BindingContext        = this;
 }
コード例 #6
0
		public SamplesListFromCategory ( SampleCategory sampleCategory )
		{
			InitializeComponent ();

			BindingContext = sampleCategory;
			Title = sampleCategory.Name;
		}
コード例 #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;
 }
コード例 #8
0
 public SampleDefinition(string name, Type pageType, SampleType sampleType, SampleCategory sampleArea)
 {
     _name           = name;
     _pageType       = pageType;
     _sampleType     = sampleType;
     _sampleCategory = sampleArea;
 }
コード例 #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;
    }
コード例 #10
0
 public NavigationItem(string displayName, SampleCategory cat, Type pageType, string featuredSamplesTitle = "", string categoryDescription = "")
 {
     _displayName          = displayName;
     _pageType             = pageType;
     _cat                  = cat;
     _featuredSamplesTitle = featuredSamplesTitle;
     _categoryDescription  = categoryDescription;
 }
コード例 #11
0
 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;
 }
コード例 #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());
        }
コード例 #13
0
 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;
 }
コード例 #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;
 }
コード例 #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));
            }
        }
コード例 #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());
        }
コード例 #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;
    }
コード例 #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;
    }
コード例 #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));
        }
コード例 #20
0
 public NavigationItem(
     string displayName,
     SampleCategory cat,
     Type pageType,
     string categoryDescription,
     string thumbnail)
 {
     _displayName          = displayName;
     _pageType             = pageType;
     _cat                  = cat;
     _featuredSamplesTitle = "";
     _categoryDescription  = categoryDescription;
     _thumbnail            = thumbnail;
 }
コード例 #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);
 }
コード例 #22
0
ファイル: Sample.cs プロジェクト: whztt07/DeltaEngine
		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;
		}
コード例 #23
0
        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));
            }
        }
コード例 #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);
                }
            }
        }
コード例 #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;
 }
コード例 #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;
        }
コード例 #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);
                    }
                }
            }
コード例 #28
0
 private void ShadowGrid_Tapped(object sender, TappedRoutedEventArgs e) => this.Category = null;
コード例 #29
0
 public static async Task NavigateToCategory(SampleCategory sampleCategory, INavigation navigation)
 {
     await navigation.PushAsync(new TabbedPageRLC(sampleCategory));
 }
コード例 #30
0
 public SamplePageAttribute(SampleCategory category, string title, SourceSdk source = SourceSdk.WinUI)
 {
     Category = category;
     Title    = title;
     Source   = source;
 }
コード例 #31
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 void OnNavigatedTo(NavigationEventArgs e)
        {
            base.OnNavigatedTo(e);

            ViewModel = e.Parameter as SampleCategory;
        }
コード例 #32
0
 public SampleDefinition(string name, Type type, SampleCategory category)
 {
     Name = name;
     Type = type;
     Category = category;
 }
コード例 #33
0
		public static async Task NavigateToCategory(SampleCategory sampleCategory, INavigation navigation){
			await navigation.PushAsync( new SamplesListFromCategory( sampleCategory ) );
		}
コード例 #34
0
ファイル: SampleCreator.cs プロジェクト: remy22/DeltaEngine
 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));
 }
コード例 #35
0
ファイル: ShellViewModel.cs プロジェクト: petrbalat/CMContrib
 public CategorySamples(SampleCategory category, IEnumerable <ISample> samples)
 {
     Category = category;
     Samples  = new BindableCollection <ISample>(samples.OrderBy(x => x.DisplayName));
 }
コード例 #36
0
ファイル: SampleDefinition.cs プロジェクト: Uwy/Live-Charts
 public SampleDefinition(string name, Type type, SampleCategory category)
 {
     Name     = name;
     Type     = type;
     Category = category;
 }
コード例 #37
0
 public static async Task NavigateToCategory(SampleCategory sampleCategory, INavigation navigation)
 {
     await navigation.PushAsync(new PricingCalculatorDetailSelection(sampleCategory));
 }
コード例 #38
0
ファイル: SampleCreator.cs プロジェクト: remy22/DeltaEngine
 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);
 }
コード例 #39
0
		public static Page GetPage( SampleCategory sampleCategory )
		{
			return new SamplesListFromCategory( sampleCategory );
		}
コード例 #40
0
ファイル: Sample.cs プロジェクト: remy22/DeltaEngine
 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;
 }