Пример #1
0
        private void addSubtitle()
        {
            if (tbSubtitle.Text.Length > 2 && dataGridTitles.SelectedItem != null)
            {
                int titleId = ((Title)dataGridTitles.SelectedItem).id;

                Subtitle subtitle = new Subtitle(titleId, tbSubtitle.Text);

                int subtitleId = TitleHelper.sendSubtitleToDB(subtitle);

                if (subtitleId > 0)
                {
                    MessageBox.Show("Se guardó con el código: " + subtitleId.ToString());
                    tbSubtitle.Text = "";
                }
                else
                {
                    MessageBox.Show("Ocurrió un error y no pudo guardarse, intente más tarde");
                }

                LoadSubtitles();
            }
            else
            {
                MessageBox.Show("Nombre muy corto");
            }
        }
Пример #2
0
        public static string GetFieldName <TRoot>(Expression <Func <TRoot, object> > sourceProperty)
        {
            var           propertyChain = PropertyChainFromExpression.Get(sourceProperty);
            List <string> names         = new List <string>();

            foreach (var prop in propertyChain)
            {
                var    attrs = (DisplayAttribute[])prop.GetCustomAttributes(typeof(DisplayAttribute), false);
                string namepart;
                if ((attrs != null) && (attrs.Length > 0))
                {
                    namepart = TitleHelper.StringToPascalCase(attrs[0].GetName());
                }
                else
                {
                    namepart = prop.Name;
                }

                foreach (var symb in RemovedSimbols)
                {
                    namepart = namepart.Replace(symb, "");
                }

                names.Add(namepart);
            }
            var name = String.Join(".", names);

            return(name);
        }
        protected override async void OnNavigatedTo(NavigationEventArgs e)
        {
            IDictionary <string, string> parameters = this.NavigationContext.QueryString;

            if (parameters.ContainsKey("type"))
            {
                type = (parameters["type"] as string);
            }
            if (parameters.ContainsKey("keyword"))
            {
                keyword = (parameters["keyword"] as string);
            }
            this.TBPageTitle.Text  = TitleHelper.GetTitle(type);
            this.TBMainSearch.Text = keyword;
            InitFilterButton("", "", "");
            result = await GetData(keyword);

            if (result != null)
            {
                Render();
            }
            else
            {
                string url = string.Empty;
                url = StaticURLHelper.GetURL(type).List;
                GetJSON(url, new Dictionary <string, string>());
            }
            base.OnNavigatedTo(e);
        }
Пример #4
0
 private void comboTitle_SelectionChanged(object sender, SelectionChangedEventArgs e)
 {
     if (comboTitle.SelectedIndex >= 0)
     {
         comboSubtitle.ItemsSource = TitleHelper.GetSubtitles((int)((Title)comboTitle.SelectedItem).Value);
     }
 }
Пример #5
0
        public void LoadGame(
            out List <Brands> brands,
            out List <Cards> cards,
            out List <Matches> matches,
            out List <Promotions> promotions,
            out List <Teams> teams,
            out List <TitlesMain> titles,
            out List <WrestlersMain> wrestlers
            )
        {
            BrandHelper     bHelper  = new BrandHelper();
            CardHelper      cHelper  = new CardHelper();
            MatchHelper     mHelper  = new MatchHelper();
            PromotionHelper pHelper  = new PromotionHelper();
            TeamHelper      tHelper  = new TeamHelper();
            TitleHelper     tlHelper = new TitleHelper();
            WrestlerHelper  wHelper  = new WrestlerHelper();

            brands     = bHelper.PopulateBrandsList();
            cards      = cHelper.PopulateCardsList();
            matches    = mHelper.PopulateMatchesList();
            promotions = pHelper.PopulatePromotionsList();
            teams      = tHelper.PopulateTeamsList();
            titles     = tlHelper.PopulateTitlesList();
            wrestlers  = wHelper.PopulateWrestlersList();
        }
        public virtual async Task <ActionResult> Watch(int id)
        {
            var viewModel = await this.ThreadService.GetThread(id);

            this.ViewBag.Title = TitleHelper.GetThreadTabTitle(viewModel.Title, viewModel.Id, viewModel.Product.DisplayName);

            return(this.View("WatchThread", viewModel));
        }
        public virtual async Task <ActionResult> Edit(string productName, int?id)
        {
            var viewModel = await this.GetThreadViewModel(productName, id);

            viewModel.Product.Categories = await this.ProductService.GetCategoriesFromProduct(viewModel.Product.Id.Value, this.ThreadType);

            this.ViewBag.Title = TitleHelper.GetProductTabTitle(id == null ? "New Idea" : "Editing Idea", viewModel.Product.DisplayName);

            return(this.View("EditThread", viewModel));
        }
Пример #8
0
 private void TurnOptionsOff()
 {
     ToggleButtons(false);
     Exit.SetActive(false);
     Definitions.SetActive(false);
     Bestiary.SetActive(false);
     Player.SetActive(false);
     Squadron.SetActive(false);
     Abilities.SetActive(false);
     TitleHelper.SetActive(false);
 }
Пример #9
0
        private void buttonAddSubTitle_Click(object sender, RoutedEventArgs e)
        {
            Subtitle subtitle = (Subtitle)comboSubtitle.SelectedItem;

            if (!subtitles.Contains(subtitle))
            {
                subtitles.Add(subtitle);
            }

            TitleHelper.setSubtitleGrid(dataGridCategories, subtitles);
        }
Пример #10
0
        private void LoadSubtitles()
        {
            int titleId = 0;

            if (dataGridTitles.SelectedItem != null)
            {
                titleId = ((Title)dataGridTitles.SelectedItem).id;
            }

            TitleHelper.setSubtitleGrid(dataGridSubtitles, titleId);
        }
        public async Task <ActionResult> Index(string productName)
        {
            var viewModel = await this.GetProductViewModel(productName);

            Debug.Assert(viewModel.Id != null, "viewModel.Id != null");
            viewModel.Threads = await this.ThreadService.GetThreads(viewModel.Id.Value, this.ThreadType);

            this.ViewBag.Title = TitleHelper.GetProductTabTitle(viewModel.ActiveTab.ToString(), viewModel.DisplayName);

            return(this.View(viewModel));
        }
Пример #12
0
        public async Task <ActionResult> Index(string productName)
        {
            if (productName == null)
            {
                throw new ArgumentNullException(nameof(productName));
            }

            var viewModel = await this._productService.GetProductViewModel(productName, ProductActiveTab.Home);

            this.ViewBag.Title = TitleHelper.GetProductTabTitle("Home", viewModel.DisplayName);

            return(this.View(viewModel));
        }
Пример #13
0
 public ActionResult Create(Noticia newNoticia)
 {
     if (ModelState.IsValid)
     {
         newNoticia.Slug = TitleHelper.URLFriendly(newNoticia.Titulo);
         db.Noticias.Add(newNoticia);
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     else
     {
         return(View(newNoticia));
     }
 }
Пример #14
0
        private async Task <SettingsViewModel> GetSettingsViewModel(string productName)
        {
            var product = await this.productService.GetProductViewModel(productName, ProductActiveTab.Settings);

            product.Members = await this.productService.GetMembersInProduct(product.Id.Value);

            this.ViewBag.Title = TitleHelper.GetProductTabTitle("Settings", product.DisplayName);

            var viewModel = new SettingsViewModel()
            {
                Product = product
            };

            return(viewModel);
        }
Пример #15
0
        private void Page_Loaded(object sender, RoutedEventArgs e)
        {
            comboBrand.ItemsSource = BrandHelper.GetBrands();

            comboUnits.ItemsSource = UnitHelper.GetUnits();

            comboTitle.ItemsSource = TitleHelper.GetTitles();

            comboCompany.ItemsSource = CompanyHelper.GetCompanies();

            comboShop.ItemsSource = ShopHelper.GetShops();

            dataGridCompanies.HeadersVisibility = DataGridHeadersVisibility.None;

            loadCompanies();
        }
Пример #16
0
        public static string GetCollectionName(Expression <Func <TDoc, IList <TRow> > > sourceProperty)
        {
            var           propertyChain = PropertyChainFromExpression.Get(sourceProperty);
            List <string> names         = new List <string>();

            foreach (var prop in propertyChain)
            {
                var    attrs = (DisplayAttribute[])prop.GetCustomAttributes(typeof(DisplayAttribute), false);
                string namepart;
                if ((attrs != null) && (attrs.Length > 0))
                {
                    namepart = TitleHelper.StringToPascalCase(attrs[0].GetName());
                }
                else
                {
                    namepart = prop.Name;
                }
                names.Add(namepart);
            }
            var name = String.Join(".", names);

            return(name);
        }
Пример #17
0
        private void addTitle()
        {
            if (tbTitle.Text.Length > 2)
            {
                Title title = new Title(tbTitle.Text);

                int titleId = TitleHelper.sendTitleToDB(title);
                if (titleId > 0)
                {
                    MessageBox.Show("Se guardó con el código: " + titleId.ToString());
                    tbTitle.Text = "";
                }
                else
                {
                    MessageBox.Show("Ocurrió un error y no pudo guardarse, intente más tarde");
                }
                LoadTitles();
            }
            else
            {
                MessageBox.Show("Nombre muy corto");
            }
        }
Пример #18
0
 private void LoadTitles()
 {
     TitleHelper.setTitleGrid(dataGridTitles);
 }
Пример #19
0
        public int CurrentID(
            bool isBrands     = false,
            bool isCards      = false,
            bool isMatches    = false,
            bool isPromotions = false,
            bool isTeams      = false,
            bool isTitles     = false,
            bool isWrestlers  = false
            )
        {
            int currentID = 0;

            if (isBrands)
            {
                BrandHelper         bHelper   = new BrandHelper();
                List <BrandsEntity> allBrands = bHelper.PopulateBrandsList();

                currentID = allBrands.Count() + 1;
            }

            if (isCards)
            {
                CardHelper         cHelper  = new CardHelper();
                List <CardsEntity> allCards = cHelper.PopulateCardsList();

                currentID = allCards.Count() + 1;
            }

            if (isMatches)
            {
                MatchHelper          mHelper    = new MatchHelper();
                List <MatchesEntity> allMatches = mHelper.PopulateMatchesList();

                currentID = allMatches.Count() + 1;
            }

            if (isPromotions)
            {
                PromotionHelper         pHelper   = new PromotionHelper();
                List <PromotionsEntity> allPromos = pHelper.PopulatePromotionsList();

                currentID = allPromos.Count() + 1;
            }

            if (isTeams)
            {
                TeamHelper         tHelper  = new TeamHelper();
                List <TeamsEntity> allTeams = tHelper.PopulateTeamsList();

                currentID = allTeams.Count() + 1;
            }

            if (isTitles)
            {
                TitleHelper         tiHelper  = new TitleHelper();
                List <TitlesEntity> allTitles = tiHelper.PopulateTitlesList();

                currentID = allTitles.Count() + 1;
            }

            if (isWrestlers)
            {
                WrestlerHelper         wHelper   = new WrestlerHelper();
                List <WrestlersEntity> allWrests = wHelper.PopulateWrestlersList();

                currentID = allWrests.Count() + 1;
            }

            return(currentID);
        }
Пример #20
0
        static void Main(string[] args)
        {
            //title screen demo
            using (var title = TitleHelper.CreateTitlescreenFor("Superawsome Application!"))
            {
                title.Show();
                Console.ReadKey();
                title.ChangeText("Pretty cool eh? Want to see a loading bar too?");
                Console.ReadKey();
                title.ChangeText("Here we go");
                using (var bar = Loading.LoadingHelper.GetLoadingBar())
                {
                    bar.Start();
                    title.ChangeText("Doing some important stuff");
                    bar.SetPercentage(25);
                    System.Threading.Thread.Sleep(50);
                    title.ChangeText("Almost there ...");
                    bar.SetPercentage(50);
                    System.Threading.Thread.Sleep(500);
                    bar.SetPercentage(80);
                    title.ChangeText("Finishing up...");
                    System.Threading.Thread.Sleep(800);
                    bar.SetPercentage(100);
                    title.ChangeText("...and we are ready to go!");
                }
                Console.ReadKey();
                title.Close();
            }


            //create a new argument binder to bind it to InputArgs
            var setup = ArgumentBinder.Create <InputArgs>();
            //Setup the arguments we want to bind
            var binder = setup
                         .CreateFor("-f", "Forces creation", field => field.Force)
                         .CreatePathArgumentFor("-out", "Sets outputfile dir", c => c.OutputToFileSupplied, c => c.FilePath)
                         .CreateArgumentWithPayloadFor("-addr", "Sets Hex-Address", c => c.HexSupplied, c => c.Hex, new Regex("[^[0-9A-F]+$]"))
                         .CreateArrayArgumentFor("-users", "List of users", c => c.UsersSupplied, c => c.UserNames)
                         .Build();

            try
            {
                //bind it
                var input = binder.Bind(args);
                //do something with the input like
                if (input.Force)
                {
                    Console.WriteLine("Forced");
                }
            }
            catch (ArgumentBinderException e) //check for binding errors
            {
                Console.WriteLine("Please check the supplied arguments.");
                //dispay details whats wrong
                e.BindingErrors.ToList().ForEach(err =>
                {
                    Console.WriteLine(err);
                });
                //display help text
                binder.Help();
            }
            catch (Exception ex)
            {
                Console.WriteLine("Uh-Oh something went horrible wrong here.");
                Console.WriteLine("Error occured: {0}", ex.Message);
            }
            //do something with args
            Console.ReadKey();


            //some extensions
            Console.WriteLine("Extensions Demo");
            ConsoleExtensions.BlackOnWhite();
            List <ABC> dummyData = new List <ABC>
            {
                new ABC
                {
                    A = "Hello there",
                    B = 1,
                    C = "High-Ground"
                },
                new ABC
                {
                    A = "General Kenobi",
                    B = -1,
                    C = "Low-Ground"
                }
            };

            dummyData.TableizeToConsole(c => c.A, c => c.C, c => c.B);
            Console.ResetColor();
            Console.WriteLine("Enter your multiline text, press ESC once finished");
            string s = ConsoleExtensions.ReadMultiline();

            Console.WriteLine("Your wrote: {0}", s);
            ConsoleExtensions.WriteLnLog("Look at me I know the time!");

            //bar demos
            Console.WriteLine("Waiting bar demo - press enter twice");
            using (var bar = Loading.LoadingHelper.GetWaitingBar())
            {
                bar.Start();
                Console.ReadKey();
                bar.Done();
                Console.ReadKey();
            }


            Console.WriteLine("Loading bar demo");
            using (var bar = Loading.LoadingHelper.GetLoadingBar())
            {
                for (short i = 0; i <= 100; i++)
                {
                    bar.SetPercentage(i);
                    System.Threading.Thread.Sleep(50);
                }
                bar.Done();
            }
        }
Пример #21
0
        public void SaveGame(
            List <Brands> brands,
            List <Cards> cards,
            List <Matches> matches,
            List <Promotions> promotions,
            List <Teams> teams,
            List <TitlesMain> titles,
            List <WrestlersMain> wrestlers
            )
        {
            string dir = string.Concat(Directory.GetCurrentDirectory(), "\\Saves");

            if (!Directory.Exists(dir))
            {
                Directory.CreateDirectory(string.Concat(Directory.GetCurrentDirectory(), "\\Saves"));
            }
            else
            {
                string main = string.Concat(Directory.GetCurrentDirectory(), "\\Saves\\" + "\\" + "Main");

                if (!Directory.Exists(main))
                {
                    Directory.CreateDirectory(string.Concat(Directory.GetCurrentDirectory(), "\\Saves\\" + "\\" + "Main"));
                }
                else
                {
                    BrandHelper     bHelper  = new BrandHelper();
                    CardHelper      cHelper  = new CardHelper();
                    MatchHelper     mHelper  = new MatchHelper();
                    PromotionHelper pHelper  = new PromotionHelper();
                    TeamHelper      tHelper  = new TeamHelper();
                    TitleHelper     tlHelper = new TitleHelper();
                    WrestlerHelper  wHelper  = new WrestlerHelper();

                    foreach (Brands b in brands)
                    {
                        bHelper.SaveBrandsList(b);
                    }

                    foreach (Cards c in cards)
                    {
                        cHelper.SaveCardsList(c);
                    }

                    foreach (Matches m in matches)
                    {
                        mHelper.SaveMatchesList(m);
                    }

                    foreach (Promotions p in promotions)
                    {
                        pHelper.SavePromotionsList(p);
                    }

                    foreach (Teams t in teams)
                    {
                        tHelper.SaveTeamsList(t);
                    }

                    foreach (TitlesMain tl in titles)
                    {
                        tlHelper.SaveTitlesList(tl);
                    }

                    foreach (WrestlersMain w in wrestlers)
                    {
                        wHelper.SaveWrestlersList(w);
                    }
                }
            }
        }