Exemplo n.º 1
0
        public NewGameAdd()
        {
            string data1  = Environment.CurrentDirectory + "\\Content\\maets.cur";
            var    cursor = new System.Windows.Input.Cursor(data1);

            this.Cursor = cursor;
            this.Title  = "Maets";

            InitializeComponent();
            modelProducts  = new List <ModelImage>();
            btnAdd.Content = "Отправить заявку\n на добаление";
            ModelImage modelProduct = new ModelImage();

            modelProducts.Add(modelProduct.MakeModelImage(File.ReadAllBytes(ShopWindows.imagesmaets + @"1.encr")));
            Screenshoot.Items.Add(modelProducts[0]);
            Screenshoot1.Items.Add(modelProducts[0]);
            Screenshoot2.Items.Add(modelProducts[0]);
            Screenshoot3.Items.Add(modelProducts[0]);
            Screenshoot4.Items.Add(modelProducts[0]);
            Screenshoot5.Items.Add(modelProducts[0]);
            Screenshoot1.IsEnabled = false;
            Screenshoot2.IsEnabled = false;
            Screenshoot3.IsEnabled = false;
            Screenshoot4.IsEnabled = false;
            Screenshoot5.IsEnabled = false;
        }
Exemplo n.º 2
0
        public ModelImage MakeModelImage(byte[] profile)
        {
            DataProvider dp           = new DataProvider();
            ModelImage   modelProfile = new ModelImage();

            modelProfile.MainImage = profile;
            return(modelProfile);
        }
Exemplo n.º 3
0
        private void leftmouse_mylibrary(object sender, EventArgs e)
        {
            Screenshoot.Items.Clear();
            Screenshoot1.Items.Clear();
            Screenshoot2.Items.Clear();
            Screenshoot3.Items.Clear();
            Screenshoot4.Items.Clear();
            Screenshoot5.Items.Clear();
            screns.Clear();
            Service.Product idx = profile.Games[mylibrary.SelectedIndex];

            screns.Add(idx.MainImage);
            List <byte[]> d = ShopWindows.client.GetGameImages(idx.Id).ToList();

            for (int h = 0; h < d.Count; h++)
            {
                screns.Add(d.ToList()[h]);
                modelProducts = new List <ModelImage>();
            }
            foreach (byte[] product in screns)
            {
                ModelImage modelProduct = new ModelImage();
                modelProducts.Add(modelProduct.MakeModelImage(product));
            }
            Screenshoot.Items.Add(modelProducts[0]);
            Screenshoot1.Items.Add(modelProducts[0 + 1]);
            Screenshoot2.Items.Add(modelProducts[0 + 2]);
            Screenshoot3.Items.Add(modelProducts[0 + 3]);
            Screenshoot4.Items.Add(modelProducts[0 + 4]);
            Screenshoot5.Items.Add(modelProducts[0 + 5]);

            string path = GetPathToGame(idx.Id) + "\\" + idx.Name + ".exe";

            if (path == null || !File.Exists(path))
            {
                Download.Visibility = Visibility.Visible;
                Play.Visibility     = Visibility.Hidden;
            }
            else
            {
                Download.Visibility = Visibility.Hidden;
                Play.Visibility     = Visibility.Visible;
            }
            int i = mylibrary.SelectedIndex;

            if (i != -1)
            {
                tbgamename.Visibility = Visibility.Visible;
                tbgamename.Text       = profile.Games[i].Name;
            }
        }
Exemplo n.º 4
0
        private void ImMainImage_MouseLeftButtonUp(object sender, MouseButtonEventArgs e)
        {
            ModelImage modelProduct = get_image_from_PC();

            if (modelProduct.Id != -1)
            {
                lvimMainImage.Items.Clear();
                imMainImage.Visibility = Visibility.Hidden;
                lvimMainImage.Items.Add(modelProduct);
                client.changeProfileImage(profile.ID, modelProduct.MainImage);
            }
            else
            {
                lvimMainImage.SelectedItem = null;
            }
        }
Exemplo n.º 5
0
        private ModelImage get_image_from_PC()
        {
            OpenFileDialog openFileDialog = new OpenFileDialog();

            openFileDialog.ShowDialog();

            string s = openFileDialog.FileName;

            // System.Windows.MessageBox.Show(s);
            byte[] buffer = dp.GetByteFromImage(s);
            gamescreen.Add(buffer);

            ModelImage modelProduct = new ModelImage();

            modelProduct = modelProduct.MakeModelImage(buffer);
            return(modelProduct);
        }
Exemplo n.º 6
0
        private void Inicialize(Service.Product productnow)
        {
            ocenka.Text = Convert.ToString(productnow.Rate);
            screns      = new List <byte[]>();
            screns.Add(productnow.MainImage);
            List <byte[]> d = ShopWindows.client.GetGameImages(productnow.Id).ToList();

            for (int i = 0; i < d.Count; i++)
            {
                screns.Add(d.ToList()[i]);
            }
            ;
            foreach (string janr in productnow.GameGenre)
            {
                janrs.Text += " " + janr + " ";
            }
            foreach (string minr in productnow.MinGameSysReq)
            {
                sysmin.Text += " " + minr + "\n";
            }
            foreach (string recr in productnow.RecGameSysReq)
            {
                sysrec.Text += " " + recr + "\n";
            }
            modelProducts = new List <ModelImage>();
            foreach (byte[] product in screns)
            {
                ModelImage modelProduct = new ModelImage();
                modelProducts.Add(modelProduct.MakeModelImage(product));
            }
            Back.IsEnabled = false;
            cms            = ShopWindows.client.GetAllGameComments(tv1.Id).ToList();
            modelComments  = new List <ModelProfileComment>();
            foreach (Tuple <Service.Comment, Service.Profile> product in cms)
            {
                ModelProfileComment modelComment = new ModelProfileComment();
                modelComments.Add(modelComment.MakeModelProfileComment(product));
            }
            for (int i = 0; i < modelComments.Count; i++)
            {
                if (modelComments[i].ID != MainWindow.shopWindows.profile.ID)
                {
                    Lvcomment.Items.Add(modelComments[i]);
                }
                else
                {
                    qqqq            = 1;
                    mycom_hint.Text = modelComments[i].Comment;
                    com.ToolTip     = "Вы можете оставить только один комментарий";
                }
            }
            Back.IsEnabled = false;
            if (modelComments.Count == 0)
            {
                nocomments.Visibility = Visibility.Visible;
                Lvcomment.Visibility  = Visibility.Hidden;
            }
            else
            {
                nocomments.Visibility = Visibility.Hidden;
                Lvcomment.Visibility  = Visibility.Visible;
            }
            if (!inmylibrary())
            {
                mycom_hint.Text  = "Только купившие игру пользователи могут оставлять на нее комментарии";
                mycomm.IsEnabled = false;
                com.IsEnabled    = false;
                ocenka.IsEnabled = false;
            }

            Screenshoot.Items.Add(modelProducts[ishop]);
            Screenshoot1.Items.Add(modelProducts[ishop + 1]);
            Screenshoot2.Items.Add(modelProducts[ishop + 2]);
            Screenshoot3.Items.Add(modelProducts[ishop + 3]);
            Screenshoot4.Items.Add(modelProducts[ishop + 4]);
            Screenshoot5.Items.Add(modelProducts[ishop + 5]);
            tbgameName.Text    = productnow.Name;
            tbDescription.Text = productnow.Description;
            tbDeveloper.Text   = productnow.Developer;
            tbPublisher.Text   = productnow.Publisher;
            //tbgame1.Text = productnow.Description + "\n" + productnow.Developer + "\n";
            price.Text    = Convert.ToString(productnow.RetailPrice);
            price.ToolTip = "Тут должна быть цена другая, но она пока не рабоатет";
            // Screenshoot.Source = dp.GetImageFromByte(tv.MainImage);
        }