Пример #1
0
        public void DoCrudAndEnjoy()
        {
            WindowsStoreContext context = new WindowsStoreContext();
            var apps = context.Apps.Where(app => app.Guid != Guid.Empty && app.AppCategory.AppType == AppType.Game)
                       .ToList();

            for (int i = 0; i < apps.Count; i++)
            {
                apps[i].Name = $"بازی شماره {i}";
            }

            //foreach (var app in apps) {
            //    var thumbnailPath = $"C:\\Paasteel\\Apps\\{app.Guid}\\Screenshots\\Thumbnail";
            //    var thumbnails = Directory.EnumerateFiles(thumbnailPath);

            //    thumbnails.ForEach(thumb =>
            //    {
            //        app.Screenshots.Add(new Screenshot()
            //        {
            //            AppId = app.Id,
            //            FileName = Path.GetFileName(thumb),
            //            Type = ScreenshotType.Mobile
            //        });
            //    });

            //}

            context.SaveChanges();
        }
 public UserManagementDomainService()
 {
     _context         = new WindowsStoreContext();
     NaturalPersonBiz = new NaturalPersonBiz(_context);
     LegalPersonBiz   = new LegalPersonBiz(_context);
     MembershipBiz    = new MembershipBiz(_context);
     PersonBiz        = new PersonBiz(_context);
     RoleBiz          = new RoleBiz(_context);
 }
Пример #3
0
 public AppDomainService()
 {
     _context       = new WindowsStoreContext();
     AppBiz         = new AppBiz(_context);
     PlatformBiz    = new PlatformBiz(_context);
     AppCategoryBiz = new AppCategoryBiz(_context);
     AppVersionBiz  = new AppVersionBiz(_context);
     ScreenshotBiz  = new ScreenshotBiz(_context);
 }
Пример #4
0
        private async void Screenshoot_Load(object sender, EventArgs e)
        {
            context = new WindowsStoreContext();

            var apps = await Task.Factory.StartNew(() =>
            {
                return(context.Apps.ToList());
            });

            appsComboBox.Items.AddRange(apps.ToArray <object>());
        }
Пример #5
0
        public void SetApps()
        {
            WindowsStoreContext context = new WindowsStoreContext();
            var apps = context.AppVersions.ToList();// .Include("AppVersion").ToList();

            foreach (var app in apps)
            {
                app.Size = 3161464;
            }
            ;

            context.SaveChanges();
        }
Пример #6
0
        public void SeedDatabase()
        {
            // Seed Database
            WindowsStoreContext             context = new WindowsStoreContext();
            WindowsStoreDatabaseInitializer init    = new WindowsStoreDatabaseInitializer();

            init.Seed(context);

            // Update Records
            //var paasteel = context.Apps.Single(app => app.Guid == Guid.Empty);
            //paasteel.Icon128x128 = File.ReadAllBytes(@"C:\paasteel128x128.png");
            //paasteel.Icon256x256 = File.ReadAllBytes(@"C:\paasteel256x256.png");
            //paasteel.AppVersions.First().Size = 0;
        }
Пример #7
0
        public void AddApp()
        {
            WindowsStoreContext context = new WindowsStoreContext();
            var paasteelProvider        = context.LegalPeople.Single(lp => lp.PrimaryEmail == "*****@*****.**");
            var universalPlatform       = context.Platforms.First(p => p.PlatformCategory == PlatformCategory.Windows10Universal);
            var appCategories           = context.AppCategories.ToList();

            FileInfo packageInfo    = new FileInfo(@"D:\WindowsPhoneApps\Music Beta\arm.appx");
            var      icon128X128    = File.ReadAllBytes(@"D:\WindowsPhoneApps\zoomit-ir\128.png");
            var      icon256X256    = File.ReadAllBytes(@"D:\WindowsPhoneApps\zoomit-ir\128.png");
            var      appTitle       = "#Music Beta";
            var      appDescription =
                "" + Environment.NewLine +
                "" + Environment.NewLine +
                "" + Environment.NewLine +


                "";
            var appVersionDescription = "رفع اشکال نمایش دیدگاه ها";
            var appCategory           = appCategories.ElementAt(6);
            var cpuArchitecture       = CpuArchitecture.Arm;
            var version = "1.0.0.0";

            var app = new App
            {
                Guid                 = Guid.NewGuid(),
                Developer            = paasteelProvider,
                Name                 = appTitle,
                Description          = appDescription,
                Icon128X128          = icon128X128,
                Icon256X256          = icon256X256,
                AppCategory          = appCategory,
                CpuArchitectureFlags = cpuArchitecture,
                State                = AppState.Published,
            };

            app.Platforms.Add(universalPlatform);
            app.AppVersions.Add(new AppVersion()
            {
                Description = appVersionDescription,
                Downloads   = 0,
                PublishDate = DateTime.Now,
                Version     = version,
                Size        = packageInfo.Length
            });
            context.Apps.Add(app);
            context.SaveChanges();
        }
Пример #8
0
        public void AddDemoAppFiles()
        {
            WindowsStoreContext context = new WindowsStoreContext();
            var    apps = context.Apps.Include("Platforms").ToList();
            string fileName;
            var    appsDirectory = "C:\\Paasteel\\Apps";

            foreach (var app in apps)
            {
                Directory.CreateDirectory($"{appsDirectory}\\{app.Guid}");

                //if ((app.CpuArchitectureFlags & CpuArchitecture.Arm) == CpuArchitecture.Arm)
                //{
                fileName = $"{appsDirectory}\\{app.Guid}\\arm.appx";
                File.Copy(@"d:\MyMusic8AnyCPU.appx", fileName);
                //}
            }
        }
Пример #9
0
        public void AddDemoApps()
        {
            Random rnd = new Random();
            WindowsStoreContext context = new WindowsStoreContext();
            var developer         = context.People.Single(p => p.PrimaryEmail == "*****@*****.**");
            var appCategories     = context.AppCategories.ToList();
            var description       = string.Concat(Enumerable.Repeat("توضیحات مربوط به برنامه.", 10));
            var universalPlatform = context.Platforms.First(p => p.PlatformCategory == PlatformCategory.Windows10Universal);

            for (int i = 1; i <= 100; i++)
            {
                var icon128x128 = File.ReadAllBytes($"D:\\png\\1 ({(i % 13) + 1}).png");
                var app         = new App
                {
                    Guid                 = Guid.NewGuid(),
                    Developer            = developer,
                    Name                 = $"برنامه {i}",
                    Description          = $"توضیحات مربوط به برنامه شماره {i}",
                    Icon128X128          = icon128x128,
                    Icon256X256          = icon128x128,
                    AppCategory          = appCategories.ElementAt(rnd.Next(appCategories.Count())),
                    CpuArchitectureFlags = CpuArchitecture.Arm,
                    State                = AppState.Published,
                };

                for (int versionCounter = 1; versionCounter <= 2; versionCounter++)
                {
                    app.AppVersions.Add(new AppVersion()
                    {
                        Description = description,
                        Downloads   = rnd.Next(1000),
                        PublishDate = DateTime.Now.AddDays(rnd.Next(-1000, 1000)),
                        Version     = $"{versionCounter}.0.0.0",
                        Size        = 0
                    });
                }

                app.Platforms.Add(universalPlatform);
                context.Apps.Add(app);
            }

            context.SaveChanges();
        }
Пример #10
0
 public MembershipBiz(WindowsStoreContext context) : base(context)
 {
     _context = context;
 }
Пример #11
0
 public PlatformBiz(WindowsStoreContext context) : base(context)
 {
     _context = context;
 }
        public void Seed(WindowsStoreContext context)
        {
            #region Platform
            var platform1 = new Platform
            {
                PlatformCategory = PlatformCategory.Windows10Universal,
                Title            = "ویندوز 10، یونیورسال"
            };
            var platform2 = new Platform
            {
                PlatformCategory = PlatformCategory.Windows10Desktop,
                Title            = "ویندوز 10، خانواده دسکتاپ"
            };
            var platform3 = new Platform
            {
                PlatformCategory = PlatformCategory.Windows10Mobile,
                Title            = "ویندوز 10، خانواده موبایل"
            };
            var platform4 = new Platform
            {
                PlatformCategory = PlatformCategory.Windows10XBox,
                Title            = "ویندوز 10، خانواده XBox"
            };
            var platform5 = new Platform
            {
                PlatformCategory = PlatformCategory.Windows10Iot,
                Title            = "ویندوز 10، خانواده IOT"
            };
            var platform6 = new Platform
            {
                PlatformCategory = PlatformCategory.Windows10HoloLens,
                Title            = "ویندوز 10، خانواده HoloLens"
            };

            context.Platforms.AddRange(
                new Platform[] { platform1, platform2, platform3, platform4, platform5, platform6 });

            #endregion

            #region AppCategory
            var appCategory1 = new AppCategory {
                AppType = AppType.Application, Title = "کسب و کار"
            };
            var appCategory2 = new AppCategory {
                AppType = AppType.Application, Title = "توسعه نرم افزار"
            };
            var appCategory3 = new AppCategory {
                AppType = AppType.Application, Title = "غذا و آشپزی"
            };
            var appCategory4 = new AppCategory {
                AppType = AppType.Application, Title = "خانواده"
            };
            var appCategory5 = new AppCategory {
                AppType = AppType.Application, Title = "سبک زندگی"
            };
            var appCategory6 = new AppCategory {
                AppType = AppType.Application, Title = "موسیقی"
            };
            var appCategory7 = new AppCategory {
                AppType = AppType.Application, Title = "مسافرت-نقشه"
            };
            var appCategory8 = new AppCategory {
                AppType = AppType.Application, Title = "خبر-آب‌ و‌ هوا"
            };
            var appCategory9 = new AppCategory {
                AppType = AppType.Application, Title = "تصویر و ویدیو"
            };
            var appCategory10 = new AppCategory {
                AppType = AppType.Application, Title = "خرید"
            };
            var appCategory11 = new AppCategory {
                AppType = AppType.Application, Title = "ابزار"
            };
            var appCategory12 = new AppCategory {
                AppType = AppType.Application, Title = "کتاب‌ها و مراجع"
            };
            var appCategory13 = new AppCategory {
                AppType = AppType.Application, Title = "خرید"
            };
            var appCategory14 = new AppCategory {
                AppType = AppType.Application, Title = "اجتماعی"
            };
            var appCategory15 = new AppCategory {
                AppType = AppType.Application, Title = "ورزش"
            };
            var appCategory16 = new AppCategory {
                AppType = AppType.Application, Title = "ابزار"
            };
            var appCategory17 = new AppCategory {
                AppType = AppType.Game, Title = "اکشن"
            };
            var appCategory18 = new AppCategory {
                AppType = AppType.Game, Title = "کارت و تخته"
            };
            var appCategory19 = new AppCategory {
                AppType = AppType.Game, Title = "آموزشی"
            };
            var appCategory20 = new AppCategory {
                AppType = AppType.Game, Title = "پلتفرمر"
            };
            var appCategory21 = new AppCategory {
                AppType = AppType.Game, Title = "معمایی"
            };
            var appCategory22 = new AppCategory {
                AppType = AppType.Game, Title = "پرواز"
            };
            var appCategory23 = new AppCategory {
                AppType = AppType.Game, Title = "تیراندازی"
            };
            var appCategory24 = new AppCategory {
                AppType = AppType.Game, Title = "شبیه‌سازی"
            };
            var appCategory25 = new AppCategory {
                AppType = AppType.Game, Title = "استراتژی"
            };
            var appCategory26 = new AppCategory {
                AppType = AppType.Game, Title = "کلمات"
            };

            context.AppCategories.AddRange(new AppCategory[] {
                appCategory1, appCategory2, appCategory3, appCategory4, appCategory5,
                appCategory6, appCategory7, appCategory8, appCategory9, appCategory10,
                appCategory11, appCategory12, appCategory13, appCategory14, appCategory15,
                appCategory16, appCategory17, appCategory18, appCategory19, appCategory20,
                appCategory21, appCategory22, appCategory23, appCategory24, appCategory25,
                appCategory26
            }
                                           );
            #endregion

            #region Role
            var AdminRole = new Role {
                Title = "Admin", Name = "Admin"
            };
            var developerRole = new Role {
                Title = "Developer", Name = "Developer"
            };
            context.Roles.AddRange(new Role[] { AdminRole, developerRole });
            #endregion

            #region LegalPerson
            var paasteelCompany = new LegalPerson
            {
                PrimaryEmail = "*****@*****.**",
                Name         = "پاستیل",
                Membership   = new Membership
                {
                    CreateDate = DateTime.Now,
                    FailedPasswordAttemptCount = 0,
                    IsApproved                   = true,
                    IsIdentityVerified           = true,
                    IsLockedOut                  = true,
                    Password                     = SecurityHelper.ComputeSha256Hash("12345"),
                    VerificationCodeLastSendDate = DateTime.Now,
                    VerificationCode             = 0
                }
            };

            var paasteelAppProvider = new LegalPerson
            {
                PrimaryEmail = "*****@*****.**",
                Name         = "(گرد آورنده: پاستیل)",
                Membership   = new Membership
                {
                    CreateDate = DateTime.Now,
                    FailedPasswordAttemptCount = 0,
                    IsApproved                   = true,
                    IsIdentityVerified           = true,
                    IsLockedOut                  = true,
                    Password                     = SecurityHelper.ComputeSha256Hash("12345"),
                    VerificationCodeLastSendDate = DateTime.Now,
                    VerificationCode             = 0
                }
            };
            context.LegalPeople.AddRange(new LegalPerson[] { paasteelCompany, paasteelAppProvider });
            #endregion

            #region Natural Person
            var mehrdad = new NaturalPerson
            {
                PrimaryEmail = "*****@*****.**",
                FirstName    = "مهرداد",
                LastName     = "تاجدینی",
                Age          = 29,
                Sexuality    = Sexuality.Male,
                Membership   = new Membership
                {
                    CreateDate = DateTime.Now,
                    FailedPasswordAttemptCount = 0,
                    IsApproved                   = true,
                    IsIdentityVerified           = true,
                    IsLockedOut                  = true,
                    Password                     = SecurityHelper.ComputeSha256Hash("12345"),
                    VerificationCodeLastSendDate = DateTime.Now,
                    VerificationCode             = 0
                }
            };
            mehrdad.Roles.Add(AdminRole);
            mehrdad.Roles.Add(developerRole);

            var vahid = new NaturalPerson
            {
                PrimaryEmail = "*****@*****.**",
                FirstName    = "وحید",
                LastName     = "انصاری",
                Age          = 29,
                Sexuality    = Sexuality.Male,
                Membership   = new Membership
                {
                    CreateDate = DateTime.Now,
                    FailedPasswordAttemptCount = 0,
                    IsApproved                   = true,
                    IsIdentityVerified           = true,
                    IsLockedOut                  = true,
                    Password                     = SecurityHelper.ComputeSha256Hash("12345"),
                    VerificationCodeLastSendDate = DateTime.Now,
                    VerificationCode             = 0
                }
            };
            vahid.Roles.Add(AdminRole);
            vahid.Roles.Add(developerRole);

            context.NaturalPeople.AddRange(new NaturalPerson[] { mehrdad, vahid });
            #endregion

            #region App
            var paasteelApp = new App
            {
                Guid                 = Guid.Empty,
                Developer            = paasteelCompany,
                Name                 = "پاستیل",
                Description          = "پاستیل",
                Icon128X128          = new byte[1],
                Icon256X256          = new byte[1],
                AppCategory          = appCategory16,
                State                = AppState.Unpublished,
                CpuArchitectureFlags = CpuArchitecture.Arm,
            };
            paasteelApp.Platforms.Add(platform1);
            paasteelApp.AppVersions.Add(new AppVersion()
            {
                Downloads   = 0,
                PublishDate = DateTime.Now,
                Description = "پاستیل",
                Version     = "1.0.0.0",
                Size        = 0
            });
            context.Apps.Add(paasteelApp);
            #endregion

            context.SaveChanges();
        }
 public DeviceManagementDomainService()
 {
     _context  = new WindowsStoreContext();
     DeviceBiz = new DeviceBiz(_context);
     ActiveDeviceHistoryBiz = new ActiveDeviceHistoryBiz(_context);
 }
 public ActiveDeviceHistoryBiz(WindowsStoreContext context) : base(context)
 {
     _context = context;
 }
Пример #15
0
        static void Main(string[] args)
        {
            WindowsStoreContext context = new WindowsStoreContext();
            var apps = context.Apps.Where(app => app.Guid != Guid.Empty);

            foreach (var app in apps)
            {
                var thumbnailPath = $"C:\\Paasteel\\Apps\\{app.Guid}\\Screenshots\\Thumbnail";
                var thumbnails    = Directory.EnumerateFiles(thumbnailPath);

                thumbnails.ForEach(thumb =>
                {
                    app.Screenshots.Add(new Screenshot()
                    {
                        AppId    = app.Id,
                        FileName = Path.GetFileName(thumb),
                        Type     = ScreenshotType.Mobile
                    });
                });
            }
            context.SaveChanges();



            //bool b=   TestCall();
            //System.ServiceModel.NetHttpBinding biding = new NetHttpBinding();
            //EndpointAddress endPoint = new EndpointAddress("http://localhost:1578/Service/DeveloperService.svc/~/Service/Developer.svc");
            //DeveloperService.DeveloperServiceClient proxy2 = new DeveloperService.DeveloperServiceClient(biding, endPoint);

            //try
            //{
            //    proxy2.SignIn("", "");

            //}
            //catch (FaultException<GeneralInternalFault> x)
            //{

            //    Console.WriteLine(x.Detail.FaultCode);
            //}
            //catch (FaultException)
            //{

            //}



            //AppsService.AppsServiceClient appClient = new AppsService.AppsServiceClient("BasicHttpBinding_IAppsService");
            //Console.WriteLine(appClient.GetServiceName());
            //appClient.Close();

            //Console.ReadLine();
            //1
            //  createProxyAndReadData_1();

            //2
            //readServiceNameAsynk_2();
            //Console.WriteLine("get service name called asycronoslly...");
            //Console.ReadLine();

            //3
            //
        }
Пример #16
0
 public PersonBiz(WindowsStoreContext context) : base(context)
 {
     _context = context;
 }
Пример #17
0
 public DeviceBiz(WindowsStoreContext context) : base(context)
 {
     _context = context;
 }
Пример #18
0
 public BaseBiz(WindowsStoreContext context)
 {
     _context = context;
 }
Пример #19
0
 public MainForm()
 {
     InitializeComponent();
     _ctx = new WindowsStoreContext();
 }
Пример #20
0
 public ScreenshotBiz(WindowsStoreContext context) : base(context)
 {
     _context = context;
 }
Пример #21
0
 public AppBiz(WindowsStoreContext context) : base(context)
 {
     _context = context;
 }