示例#1
0
        public Demos UpdateDemo(Demos newData)
        {
            var entity = db.Demos.Attach(newData);

            entity.State = EntityState.Modified;
            return(newData);
        }
示例#2
0
        public App()
        {
            ListView listView;
            var      listPage = new ContentPage {
                Content = listView = new ListView(),
                Title   = "Skia Demo",
            };

            NavigationPage navPage;

            MainPage = navPage = new NavigationPage(listPage)
            {
                BarBackgroundColor = new Xamarin.Forms.Color(0x34 / 255.0, 0x98 / 255.0, 0xdb / 255.0),
                BarTextColor       = Xamarin.Forms.Color.White,
            };

            listView.ItemsSource = Demos.SamplesForPlatform(Demos.Platform.iOS | Demos.Platform.Android);

            listView.ItemSelected += (sender, e) => {
                if (e.SelectedItem == null)
                {
                    return;
                }
                listView.SelectedItem = null;

                navPage.PushAsync(new ContentPage {
                    Content = new SkiaView(SkiaSharp.Demos.MethodForSample(e.SelectedItem.ToString())),
                });
            };
        }
示例#3
0
    static void CommonUpdate()
    {
        // If we can't see the world, we'll draw a floor!
        if (StereoKitApp.System.displayType == Display.Opaque)
        {
            Renderer.Add(floorMesh, floorTr, Color.White);
        }

        // Skip selection window if we're in test mode
        if (Demos.TestMode)
        {
            return;
        }

        // Make a window for demo selection
        UI.WindowBegin("Demos", ref demoSelectPose, new Vec2(50 * Units.cm2m, 0));
        for (int i = 0; i < Demos.Count; i++)
        {
            string name = Demos.GetName(i);

            // No Doc demos
            if (name.StartsWith("Doc"))
            {
                continue;
            }

            // Chop off the "Demo" part of any demo name that has it
            if (name.StartsWith("Demo"))
            {
                name = name.Substring("Demo".Length);
            }

            if (UI.Button(name))
            {
                Demos.SetActive(i);
            }
            UI.SameLine();
        }
        UI.WindowEnd();

        RulerWindow();
        /// :CodeSample: Log.Subscribe Log
        /// And in your Update loop, you can draw the window.
        LogWindow();
        /// And that's it!
        /// :End:

        // Take a screenshot on the first frame both hands are gripped
        bool valid =
            Input.Hand(Handed.Left).IsTracked&&
            Input.Hand(Handed.Right).IsTracked;
        BtnState right = Input.Hand(Handed.Right).grip;
        BtnState left  = Input.Hand(Handed.Left).grip;

        if (valid && left.IsActive() && right.IsActive() && (left.IsJustActive() || right.IsJustActive()))
        {
            Renderer.Screenshot(Input.Head.position, Input.Head.Forward, 1920 * 2, 1080 * 2, "Screenshot" + screenshotId + ".jpg");
            screenshotId += 1;
        }
    }
示例#4
0
    static void CommonUpdate()
    {
        Renderer.Add(floorMesh, floorTr, Color.White);

        // Skip selection window if we're in test mode
        if (Demos.TestMode)
        {
            return;
        }

        // Make a window for demo selection
        UI.WindowBegin("Demos", ref demoSelectPose, new Vec2(50 * Units.cm2m, 0));
        for (int i = 0; i < Demos.Count; i++)
        {
            // Chop off the "Demo" part of any demo name that has it
            string name = Demos.GetName(i);
            if (name.StartsWith("Demo"))
            {
                name = name.Substring("Demo".Length);
            }

            if (UI.ButtonRound(name, 4 * Units.cm2m))
            {
                Demos.SetActive(i);
            }
            UI.SameLine();
        }
        UI.WindowEnd();
    }
示例#5
0
    static void Main(string[] args)
    {
        Demos.TestMode = args.Length > 0 && args[0].ToLower() == "-test";

        StereoKitApp.settings.assetsFolder = Program.Root;
        if (!StereoKitApp.Initialize("StereoKit C#", Demos.TestMode ? Runtime.Flatscreen : Runtime.MixedReality, true))
        {
            Environment.Exit(1);
        }
        CommonInit();

        Demos.FindDemos();
        Demos.SetActive(args.Length > 0 ? args[0] : "Geo");
        Demos.Initialize();

        while (StereoKitApp.Step(() =>
        {
            Demos.Update();
            CommonUpdate();
        }))
        {
            ;
        }

        Demos.Shutdown();
        CommonShutdown();

        StereoKitApp.Shutdown();
    }
示例#6
0
        public static void Main(string[] args)
        {
            var kenneln = new KennelSystemet();

            kenneln.Run();

            var l = new FunkDemos();

            l.Run();


            var demos111 = new Demos();

            demos111.Run();


            var demo20120517 = new Demos20210517();

            demo20120517.Run();



            var looparLabbar = new  LooparLabbar();

            looparLabbar.Lab7();
            looparLabbar.Lab6a();
            looparLabbar.Lab6b();



            var demo = new Demos();

            demo.Run();

            Console.WriteLine("321132312");


            var helloWorld = new HelloWorld();

            //HelloWorld.Run123();
            helloWorld.Run123();

            //var variabelLabbar = new VariabelLabbar();
            //variabelLabbar.Run();


            var ifLabbar = new IfLabbar();

            ifLabbar.Run();


            var funktionsLabbar = new FunktionsLabbar();

            string theMessage = funktionsLabbar.PrintMessage();

            //funktionsLabbar.Lab2();
            funktionsLabbar.Run();
        }
示例#7
0
 public IEnumerable <Tuple <string[], DemoDetail[]> > GetDemosGroupedByFolder()
 {
     return(Demos
            .GroupBy(
                x => new DirectoryPath(baseDirectory, Path.GetDirectoryName(x.Path)),
                y => y)
            .OrderBy(x => x.Key.SplitPath.Length)
            .Select(x => Tuple.Create(x.Key.SplitPath, x.ToArray())));
 }
示例#8
0
        public MainViewModel()
        {
            Demos = new[]
            {
                new Demo
                {
                    Name  = "Manual Values",
                    Files = new[] { "ManualValues.xaml" },
                    Type  = typeof(ManualValues)
                },
                new Demo
                {
                    Name  = "Manual Values: X and Y",
                    Files = new[] { "ManualValuesXAndY.xaml" },
                    Type  = typeof(ManualValuesXAndY)
                },
                new Demo
                {
                    Name  = "Manual Values: Colors",
                    Files = new[] { "ManualValuesColors.xaml" },
                    Type  = typeof(ManualValuesColors)
                },
                new Demo
                {
                    Name  = "Manual Values: Labels",
                    Files = new[] { "ManualValuesLabels.xaml" },
                    Type  = typeof(ManualValuesLabels)
                },
                new Demo
                {
                    Name  = "Binding Observable Collection",
                    Files = new[] { "BindingObservableCollection.xaml", "BindingObservableCollectionViewModel.cs" },
                    Type  = typeof(BindingObservableCollection)
                },
                new Demo
                {
                    Name  = "Binding Data Properties",
                    Files = new[] { "BindingDataProperties.xaml", "BindingDataPropertiesViewModel.cs" },
                    Type  = typeof(BindingDataProperties)
                },
                new Demo
                {
                    Name  = "Sample Values",
                    Files = new[] { "SampleValues.xaml" },
                    Type  = typeof(SampleValues)
                },
                new Demo
                {
                    Name  = "Sample Values Binding",
                    Files = new[] { "SampleValuesBinding.xaml" },
                    Type  = typeof(SampleValuesBinding)
                }
            };

            SelectedDemo = Demos.FirstOrDefault();
        }
示例#9
0
 public void AddAll(Statistics statistics)
 {
     Demos.AddRange(statistics.Demos);
     Kills.AddRange(statistics.Kills);
     Rounds.AddRange(statistics.Rounds);
     foreach (var(key, value) in statistics.Movement)
     {
         Movement[key] = value;
     }
 }
示例#10
0
        public void ClearDemo()
        {
            foreach (ParsedDemo Demo in Demos)
            {
                Demo.Dispose();
            }
            Demos.Clear();
            Display.ClearDemos();
            GC.Collect();

            Display.Invalidate();
            ClockState(false);
        }
示例#11
0
        private void PopulateComboBox()
        {
            var demos = Assembly.GetExecutingAssembly().GetTypes().Where(type => type.BaseType == typeof(DemoBase))
                        .ToList();

            foreach (var demo in demos)
            {
                Demos.Add(Activator.CreateInstance(demo) as DemoBase);
            }

            AllDemos = new ListCollectionView(Demos);
            AllDemos.GroupDescriptions.Add(new PropertyGroupDescription(nameof(DemoBase.Category)));
        }
示例#12
0
        private void MergeDemo(string filename)
        {
            QDemo      dem  = QDemo.Load(filename);
            ParsedDemo demo = new ParsedDemo();

            if (Demos.Count == 0)
            {
                MinTime = 100;
                MaxTime = 0;
            }
            demo.Parse(dem);
            Demos.Add(demo);

            MinTime = Math.Min(MinTime, demo.Start);
            MaxTime = Math.Max(MaxTime, demo.End);
        }
示例#13
0
        private void AutoloadBsp()
        {
            var demo = Demos.First();

            if (demo == null || demo.Models.Count < 1)
            {
                return;
            }

            foreach (PackFile pak in LoadedPaks)
            {
                string bspfile = demo.Models[0];
                if (pak.Contains(bspfile))
                {
                    Bsp bsp = new Bsp(pak.GetFile(bspfile));
                    Display.Bsp = bsp;
                }
            }
        }
示例#14
0
        private void OverlayDemo(string filename)
        {
            QDemo      dem = QDemo.Load(filename);
            ParsedDemo demo;

            if (Demos.Count > 0)
            {
                demo = Demos[0];
            }
            else
            {
                demo = new ParsedDemo();
                Demos.Add(demo);
                MinTime = 100;
                MaxTime = 0;
            }
            demo.Parse(dem);

            MinTime = Math.Min(MinTime, demo.Start);
            MaxTime = Math.Max(MaxTime, demo.End);
        }
示例#15
0
        public async Task LoadDemosHeader()
        {
            NotificationMessage = "Loading...";
            IsBusy          = true;
            HasNotification = true;

            try
            {
                List <string> folders = new List <string>();

                if (SelectedFolder != null)
                {
                    folders.Add(SelectedFolder);
                }
                else
                {
                    folders = Folders.ToList();
                }

                Demos.Clear();

                var demos = await _demosService.GetDemosHeader(folders);

                foreach (var demo in demos)
                {
                    Demos.Add(demo);
                }

                DataGridDemosCollection.Refresh();
            }
            catch (Exception e)
            {
                Logger.Instance.Log(e);
            }
            finally
            {
                IsBusy          = false;
                HasNotification = false;
            }
        }
        public void LoadDemoData(StorageFile dataFile)
        {
            var document = new XmlDocument();

            document.Load(dataFile.LocalPath);

            var node = document.SelectSingleNode(@"./Age");

            if (node == null)
            {
                return;
            }
            foreach (XmlNode childNode in node.ChildNodes)
            {
                switch (childNode.Name)
                {
                case "Age":
                    Demos.Add(ListDataItem.FromXml(childNode));
                    break;
                }
            }
        }
        public void LoadCombinedData(StorageFile dataFile)
        {
            var document = new XmlDocument();

            document.Load(dataFile.LocalPath);

            var node = document.SelectSingleNode(@"/TargetCustomers");

            if (node == null)
            {
                return;
            }
            foreach (XmlNode childNode in node.ChildNodes)
            {
                switch (childNode.Name)
                {
                case "SlideHeader":
                    Headers.Add(ListDataItem.FromXml(childNode));
                    break;

                case "Demo":
                    Demos.Add(ListDataItem.FromXml(childNode));
                    break;

                case "HHI":
                    HHIs.Add(ListDataItem.FromXml(childNode));
                    break;

                case "Geography":
                    Geographies.Add(ListDataItem.FromXml(childNode));
                    break;
                }
            }

            CombinedList.AddRange(Demos);
            CombinedList.AddRange(HHIs);
            CombinedList.AddRange(Geographies);
        }
示例#18
0
        public App()
        {
            var items =
                Device.OS == TargetPlatform.iOS ? Demos.SamplesForPlatform(Demos.Platform.iOS) :
                Device.OS == TargetPlatform.Android ? Demos.SamplesForPlatform(Demos.Platform.Android) :
                Device.OS == TargetPlatform.Windows ? Demos.SamplesForPlatform(Demos.Platform.UWP) :
                Demos.SamplesForPlatform(Demos.Platform.All);

            var masterDetail = new MasterDetailPage
            {
                IsGestureEnabled = true,
                MasterBehavior   = MasterBehavior.Popover
            };
            var detailPage = new DetailsPage(items.First());
            var navPage    = new NavigationPage(detailPage)
            {
                BarBackgroundColor = XamarinBlue,
                BarTextColor       = Color.White,
            };
            var masterPage = new MasterPage(items, demo =>
            {
                masterDetail.IsPresented = false;
                detailPage.SetDemo(demo);
                navPage.Title = demo;
            });

            if (Device.OS == TargetPlatform.iOS)
            {
                masterPage.Icon = "hamburger.png";
            }

            masterDetail.Master = masterPage;
            masterDetail.Detail = navPage;

            MainPage = masterDetail;

            masterDetail.IsPresented = true;
        }
示例#19
0
    /// :End:

    //////////////////////

    static void Main(string[] args)
    {
        Demos.TestMode = args.Length > 0 && args[0].ToLower() == "-test";
        Time.Scale     = Demos.TestMode ? 0 : 1;

        Log.Filter = LogLevel.Diagnostic;
        StereoKitApp.settings.assetsFolder = Program.Root;
        if (!StereoKitApp.Initialize("StereoKit C#", Demos.TestMode ? Runtime.Flatscreen : Runtime.MixedReality, true))
        {
            Environment.Exit(1);
        }

        if (Demos.TestMode)
        {
            Input.HandVisible(Handed.Max, false);
        }

        CommonInit();

        Demos.FindDemos();
        Demos.SetActive(args.Length > 0 ? args[0] : "Lines");
        Demos.Initialize();

        while (StereoKitApp.Step(() =>
        {
            Demos.Update();
            CommonUpdate();
        }))
        {
            ;
        }

        Demos.Shutdown();
        CommonShutdown();

        StereoKitApp.Shutdown();
    }
示例#20
0
 public Demos AddDemo(Demos newData)
 {
     db.Demos.Add(newData);
     return(newData);
 }
示例#21
0
 public void SetDemo(string demo)
 {
     Title   = demo;
     Content = new SkiaView(Demos.GetSample(demo));
 }
        private void Load()
        {
            var document = new XmlDocument();

            document.Load(ResourceManager.Instance.DataTargetCustomersFile.LocalPath);

            var node = document.SelectSingleNode(@"/TargetCustomers");

            if (node == null)
            {
                return;
            }
            foreach (XmlNode childNode in node.ChildNodes)
            {
                switch (childNode.Name)
                {
                case "SlideHeader":
                    foreach (XmlAttribute attribute in childNode.Attributes)
                    {
                        switch (attribute.Name)
                        {
                        case "Value":
                            if (!string.IsNullOrEmpty(attribute.Value))
                            {
                                Headers.Add(attribute.Value);
                            }
                            break;
                        }
                    }
                    break;

                case "Demo":
                    foreach (XmlAttribute attribute in childNode.Attributes)
                    {
                        switch (attribute.Name)
                        {
                        case "Value":
                            if (!string.IsNullOrEmpty(attribute.Value))
                            {
                                Demos.Add(attribute.Value);
                            }
                            break;
                        }
                    }
                    break;

                case "HHI":
                    foreach (XmlAttribute attribute in childNode.Attributes)
                    {
                        switch (attribute.Name)
                        {
                        case "Value":
                            if (!string.IsNullOrEmpty(attribute.Value))
                            {
                                HHIs.Add(attribute.Value);
                            }
                            break;
                        }
                    }
                    break;

                case "Geography":
                    foreach (XmlAttribute attribute in childNode.Attributes)
                    {
                        switch (attribute.Name)
                        {
                        case "Value":
                            if (!string.IsNullOrEmpty(attribute.Value))
                            {
                                Geographies.Add(attribute.Value);
                            }
                            break;
                        }
                    }
                    break;
                }
            }
        }
示例#23
0
 public override bool HasUpdatedStatus()
 {
     return(base.HasUpdatedStatus() || Demos.Where(d => d.HasNewStatus() || d.HasUpdatedStatus()).Any());
 }