private void ItemTextbox_OnSelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            if (sender is ComboBox cb)
            {
                if (cb.SelectedItem is En thisSelection)
                {
                    BackgroundWorker bw = new BackgroundWorker
                    {
                        WorkerReportsProgress = true
                    };

                    bw.DoWork += delegate { _selectedItem = FNA.GetFilePair(thisSelection.UrlName); };
                    bw.RunWorkerAsync();

                    bw.RunWorkerCompleted += (o, args) =>
                    {
                        if (_selectedItem.ItemHasRanks)
                        {
                            ShowRankSelector();
                        }
                        else
                        {
                            HideRankSelector();
                        }
                        Image_Item.MouseUp -= ClickImage;
                        Image_Item.Source   = new BitmapImage(new Uri(Path.Combine(Functions.PathToTemp(),
                                                                                   Path.GetFileName(_selectedItem.FileName))));
                        Image_Item.MouseUp += ClickImage;
                    };
                }
            }
        }
Esempio n. 2
0
        private void FontOpenDialog_FileOk(object sender, CancelEventArgs e)
        {
            Progress.Style     = ProgressBarStyle.Marquee;
            Progress.Value     = 0;
            Progress.Visible   = true;
            pnFontMenu.Visible = false;
            FontPath           = FontOpenDialog.FileName;
            BeginInvoke(new MethodInvoker(async() =>
            {
                FontReader?.Dispose();
                FontReader = File.Open(FontPath, FileMode.Open);
                FontInfo   = await FNA.Open(FontReader, null);

                pnFontMenu.Visible      = true;
                Progress.Visible        = false;
                cbFace.Enabled          = true;
                cbTable.Enabled         = true;
                btnSaveFont.Enabled     = true;
                btnRedraw.Enabled       = true;
                btnRedrawTables.Enabled = true;

                cbFace.Items.Clear();

                for (int i = 0; i < FontInfo.Fonts.Length; i++)
                {
                    cbFace.Items.Add(i);
                }

                cbFace.SelectedIndex = 0;
            }));
        }
Esempio n. 3
0
 public override Type BindToType(string assemblyName, string typeName)
 {
     if (assemblyName != "Microsoft.Xna.Framework" && !assemblyName.StartsWith("Microsoft.Xna.Framework,") && !assemblyName.StartsWith("Microsoft.Xna.Framework."))
     {
         return(Inner?.BindToType(assemblyName, typeName));
     }
     return(FNA.GetType(typeName));
 }
        public ItemNotification(PostLoad postLoad)
        {
            PostLoad = postLoad;

            OnlineIconUrl = Path.Combine(Functions.PathToTemp(), Path.GetFileName(FNA.GetFilePair(postLoad.Item.UrlName).FileName));

            FullName = _postLoad.Item.Name;

            UrlName = _postLoad.Item.UrlName;

            Quantity += $"[{postLoad.Quantity}]";

            OfferText = $"{postLoad.Platinum} Platinum";

            if (postLoad.Quantity > 1)
            {
                OfferText += $" Each ({postLoad.Quantity * postLoad.Platinum})";
            }

            switch (_postLoad.Type)
            {
            case OrderType.Buy:
                OfferForeground = Constants.WtbForeground;
                OfferBackground = Constants.WtbBackground;
                break;

            case OrderType.Sell:
                OfferForeground = Constants.WtsForeground;
                OfferBackground = Constants.WtsBackground;
                break;
            }

            switch (_postLoad.User.Status)
            {
            case Status.Ingame:
                UserStatus       = "ONLINE IN GAME";
                StatusForeground = Constants.StatusForegroundIngame;
                break;

            case Status.Offline:
                UserStatus       = "OFFLINE";
                StatusForeground = Constants.StatusForegroundOffline;
                break;

            case Status.Online:
                UserStatus       = "ONLINE";
                StatusForeground = Constants.StatusForegroundOnline;
                break;
            }
        }
Esempio n. 5
0
        private GridItem LoadFromConfiguration(C.Item i)
        {
            var g = new GridItem
            {
                Name    = i.Name,
                Price   = i.Price,
                Type    = i.Type,
                Enabled = i.Enabled,
                Image   = Path.Combine(Functions.PathToTemp(), Path.GetFileName(FNA.GetFilePair(i.UrlName).FileName))
            };


            if (i.QuantityMin == 0 && i.QuantityMax != 999)
            {
                g.Quantity = $"≤ {i.QuantityMax}";
            }
            else if (i.QuantityMin != 0 && i.QuantityMax == 999)
            {
                g.Quantity = $"≥ {i.QuantityMin}";
            }
            else if (i.QuantityMin == 0 && i.QuantityMax == 999)
            {
                g.Quantity = "ANY";
            }
            else
            {
                g.Quantity = $"{i.QuantityMin} - {i.QuantityMax}";
            }

            if (i.ModRankMin != null && i.ModRankMax != null)
            {
                g.Rank = i.ModRankMax == i.ModRankMin ? $"{i.ModRankMin}" : $"{i.ModRankMin} - {i.ModRankMax}";
            }
            else if (i.ModRankMin != null && i.ModRankMax == null)
            {
                g.Rank = $"{i.ModRankMin} +";
            }
            else if (i.ModRankMin == null && i.ModRankMax != null)
            {
                g.Rank = $"- {i.ModRankMax}";
            }
            else
            {
                g.Rank = "N/A";
            }


            switch (i.Type)
            {
            case OrderType.Buy:
                g.OrderText       = "WTB";
                g.OrderForeground = Constants.WtbForeground;
                g.OrderBackground = Constants.WtbBackground;
                break;

            case OrderType.Sell:
                g.OrderText       = "WTS";
                g.OrderForeground = Constants.WtsForeground;
                g.OrderBackground = Constants.WtsBackground;
                break;
            }

            g.Configitem = i;
            return(g);
        }