Skip to content

Instantly share code, notes, and snippets.

@fantasticswallow
Last active August 29, 2015 14:11
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save fantasticswallow/d57844eed7975c442436 to your computer and use it in GitHub Desktop.
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Windows.UI.Xaml.Media;
namespace SwitchableLeftMenuApp
{
internal class SampleDataModel
{
internal int Index { get; set; }
internal string Name { get; set; }
internal static SampleDataModel[] CreateSample()
{
string[] name = { "", "", "", "わさび", "まぐろ", "いわし", "いくら","かんぴょう" };
return name.Select((x, i) => CreateSample(i, x)).ToArray();
}
internal static SampleDataModel CreateSample(int index, string name)
{
var info = new SampleDataModel();
info.Index = index;
info.Name = name;
return info;
}
internal static TransitionPaneViewModel CreateSamplePaneVM()
{
var info = new TransitionPaneViewModel();
info.Title = "商品";
info.BackgroundBrush = new SolidColorBrush(Windows.UI.Colors.Blue);
var nodeCol = new ObservableCollection<PaneItemViewModel>();
var node1 = new PaneItemViewModel();
node1.Index = -1;
node1.Title = "セット";
var nodePane1 = new TransitionPaneViewModel();
nodePane1.Title = "セット";
nodePane1.BackgroundBrush = new SolidColorBrush(Windows.UI.Colors.Orange);
var nodePane1Col = new ObservableCollection<PaneItemViewModel>();
nodePane1Col.Add(createNode(1, ""));
nodePane1Col.Add(createNode(2, ""));
nodePane1Col.Add(createNode(3, ""));
nodePane1.Children = nodePane1Col;
node1.ChildViewModel = nodePane1;
nodeCol.Add(node1);
nodeCol.Add(createNode(4, "わさび"));
var node3 = new PaneItemViewModel();
node3.Index = -1;
node3.Title = "寿司";
var nodePane3 = new TransitionPaneViewModel();
nodePane3.Title = "寿司";
nodePane3.BackgroundBrush = new SolidColorBrush(Windows.UI.Colors.Red);
var nodePane3Col = new ObservableCollection<PaneItemViewModel>();
var node3_1 = createNode(-1, "握り");
var node3_2 = createNode(-1, "巻物");
var nodePane3_1 = new TransitionPaneViewModel();
nodePane3_1.Title = "握り";
nodePane3_1.BackgroundBrush = new SolidColorBrush(Windows.UI.Colors.Purple);
var nodePane3_1Col = new ObservableCollection<PaneItemViewModel>();
nodePane3_1Col.Add(createNode(5, "まぐろ"));
nodePane3_1Col.Add(createNode(6, "いわし"));
nodePane3_1.Children = nodePane3_1Col;
node3_1.ChildViewModel = nodePane3_1;
var nodePane3_2 = new TransitionPaneViewModel();
nodePane3_2.Title = "巻物";
nodePane3_2.BackgroundBrush = new SolidColorBrush(Windows.UI.Colors.Green);
var nodePane3_2Col = new ObservableCollection<PaneItemViewModel>();
nodePane3_2Col.Add(createNode(7, "いくら"));
nodePane3_2Col.Add(createNode(8, "かんぴょう"));
nodePane3_2.Children = nodePane3_2Col;
node3_2.ChildViewModel = nodePane3_2;
nodePane3Col.Add(node3_1);
nodePane3Col.Add(node3_2);
nodePane3.Children = nodePane3Col;
node3.ChildViewModel = nodePane3;
nodeCol.Add(node3);
info.Children = nodeCol;
return info;
}
private static PaneItemViewModel createNode(int index, string title)
{
var info = new PaneItemViewModel();
info.Index = index;
info.Title = title;
return info;
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment