예제 #1
0
 private void DeleteSelectedPrintItem()
 {
     if (Dialog.AskForDelete())
     {
         PrintItems.Remove(SelectedPrintItem);
     }
 }
예제 #2
0
        public void Load()
        {
            ConfigData cd = School.Configuration[_name];

            if (cd.Contains("xml") && !string.IsNullOrEmpty(cd["xml"]))
            {
                HasValue = true;
                XmlElement element = XmlHelper.LoadXml(cd["xml"]);
                RankMethod = element.SelectSingleNode("RankMethod").InnerText;
                PrintItems.Clear();
                foreach (XmlElement item in element.SelectNodes("PrintItems/Item"))
                {
                    PrintItems.Add(item.InnerText);
                }

                //<Config>
                //  <RankMethod></RankMethod>
                //  <PrintItems>
                //      <Item/>
                //      <Item/>
                //  </PrintItems>
                //</Config>
            }
            else
            {
                HasValue = false;
            }
        }
예제 #3
0
 public void Save()
 {
     _config.SetString("RankMethod", RankMethod);
     _config.SetString("PrintItems", string.Join(",", PrintItems.ToArray()));
     _config.SetString("PaperSize", PaperSize);
     _config.Save();
 }
예제 #4
0
 public void Save()
 {
     _config.SetString("RankMethod", RankMethod);
     _config.SetString("PrintItems", string.Join(",", PrintItems.ToArray()));
     _config.SetString("PaperSize", PaperSize);
     _config.SetString("ReScoreMark", ReScoreMark);
     _config.SetString("UserSelScoreType", UserSelScoreType);
     _config.Save();
 }
예제 #5
0
 public void AddItem(PrintItemWrapper item, int indexToInsert = -1)
 {
     if (indexToInsert == -1)
     {
         indexToInsert = PrintItems.Count;
     }
     PrintItems.Insert(indexToInsert, item);
     OnItemAdded(new IndexArgs(indexToInsert));
 }
예제 #6
0
 private void DoAddItem(PrintItemWrapper item, int indexToInsert)
 {
     if (indexToInsert == -1)
     {
         indexToInsert = PrintItems.Count;
     }
     PrintItems.Insert(indexToInsert, item);
     OnItemAdded(new IndexArgs(indexToInsert));
     SaveDefaultQueue();
 }
예제 #7
0
        public void RemoveAt(int index)
        {
            if (index >= 0 && index < ItemCount)
            {
                PrintItems.RemoveAt(index);

                OnItemRemoved(new ItemChangedArgs(index));
                SaveDefaultQueue();
            }
        }
예제 #8
0
        private void DoAddItem(PrintItemWrapper item, int insertAt)
        {
            if (insertAt == -1)
            {
                insertAt = PrintItems.Count;
            }

            PrintItems.Insert(insertAt, item);
            OnItemAdded(new ItemChangedArgs(insertAt));
            SaveDefaultQueue();
        }
예제 #9
0
 public LabelPrintEditorViewModel(ILabelPrintViewProvider viewProvider, IPrintService printService)
 {
     _viewProvider     = viewProvider;
     _printService     = printService;
     PrintItems        = Bag.Empty <LabelPrintViewModel>();
     AddToPrintCommand = new RelayCommand(AddToPrint);
     ClearCollectionItemsFilterCommand = new RelayCommand(ClearSourceFilterText);
     ClearPrintItemsFilterCommand      = new RelayCommand(() => PrintItems.ClearFilterText());
     DeleteCurrentPrintItemCommand     = new RelayCommand(DeleteSelectedPrintItem);
     PrintCommand = new RelayCommand(Print, CanPrint);
 }
예제 #10
0
        public void LoadLibraryItems()
        {
            PrintItems.Clear();
            IEnumerable <DataStorage.PrintItem> partFiles = GetLibraryItems(keywordFilter);

            if (partFiles != null)
            {
                foreach (PrintItem part in partFiles)
                {
                    PrintItems.Add(new PrintItemWrapper(part));
                }
            }
            OnDataReloaded(null);
        }
예제 #11
0
        public void ViewTable()
        {
            List <Film> films = this.GetFilms().ToList();

            Console.Clear();
            PrintItems.PrintLine(93);
            PrintItems.PrintRow(93, "ID", "Title", "Kind", "Plot", "Language", "Date");

            foreach (var film in films)
            {
                PrintItems.PrintLine(103);
                PrintItems.PrintRow(103, film.Id.ToString(), film.FilmTitle, film.FilmKind, film.FilmPlot, film.Language, film.Date.ToString("yyyy - MM - dd"));
                PrintItems.PrintLine(103);
            }
        }
예제 #12
0
        public void RemoveItem(PrintItemWrapper printItemWrapper)
        {
            int index = PrintItems.IndexOf(printItemWrapper);

            if (index < 0)
            {
                // It may be possible to have the same item in the remove list twice.
                // so if it is not in the PrintItems then ignore it.
                return;
            }
            PrintItems.RemoveAt(index);

            // and remove it from the data base
            printItemWrapper.Delete();
        }
예제 #13
0
        public void ViewTable()
        {
            List <Cast> casts = this.GetCasts().ToList();

            Console.Clear();
            PrintItems.PrintLine(93);
            PrintItems.PrintRow(93, "ID", "FILMID", "ACTORID", "ROLE");

            foreach (var cast in casts)
            {
                PrintItems.PrintLine(103);
                PrintItems.PrintRow(103, cast.Id.ToString(), cast.FilmId.ToString(), cast.ActorId.ToString(), cast.Role);
                PrintItems.PrintLine(103);
            }
        }
예제 #14
0
        public void ViewTable()
        {
            List <Actor> actors = this.GetActors().ToList();

            Console.Clear();
            PrintItems.PrintLine(93);
            PrintItems.PrintRow(93, "ID", "Name", "LastName", "Bibliography", "TaxIdCode", "Year");

            foreach (var actor in actors)
            {
                PrintItems.PrintLine(103);
                PrintItems.PrintRow(103, actor.Id.ToString(), actor.ActorName, actor.ActorLastName, actor.ActorBibliography, actor.ActorTaxIdCode, actor.ActorYear.ToString());
                PrintItems.PrintLine(103);
            }
        }
예제 #15
0
        public void RemoveAt(int index)
        {
            if (index >= 0 && index < Count)
            {
                bool ActiveItemMustStayInQueue = PrinterConnectionAndCommunication.Instance.PrinterIsPrinting || PrinterConnectionAndCommunication.Instance.PrinterIsPaused;
                bool PartMustStayInQueue       = ActiveItemMustStayInQueue && PrintItems[index] == PrinterConnectionAndCommunication.Instance.ActivePrintItem;
                if (!PartMustStayInQueue)
                {
                    PrintItems.RemoveAt(index);

                    OnItemRemoved(new IndexArgs(index));

                    SaveDefaultQueue();
                }
            }
        }
예제 #16
0
        public void AddItem(PrintItemWrapper item, int indexToInsert = -1)
        {
            if (indexToInsert == -1)
            {
                indexToInsert = PrintItems.Count;
            }
            PrintItems.Insert(indexToInsert, item);
            // Check if the collection we are adding to is the the currently visible collection.
            List <ProviderLocatorNode> currentDisplayedCollection = LibraryProviderSQLite.Instance.GetProviderLocator();

            if (currentDisplayedCollection.Count > 0 && currentDisplayedCollection[1].Key == LibraryProviderSQLite.StaticProviderKey)
            {
                //OnItemAdded(new IndexArgs(indexToInsert));
            }
            item.PrintItem.PrintItemCollectionID = RootLibraryCollection.Id;
            item.PrintItem.Commit();
        }
예제 #17
0
        private void AddPrintItem()
        {
            var dto = new LabelPrintViewModel();

            dto.Count = 1;
            if (SelectedPage == SelectedTabPage.CollectionItem)
            {
                dto.Set((CollectionItemDto)SelectedCollectionItem.InnerObject);
            }
            else if (SelectedPage == SelectedTabPage.Taxon)
            {
                dto.Set(SelectedTaxon.InnerObject);
            }

            dto.PropertyChanged += (sender, e) =>
            {
                if (e.PropertyName == nameof(LabelPrintViewModel.Count))
                {
                    OnPropertyChanged(nameof(LabelCount));
                }
            };

            PrintItems.Add(dto);
        }
예제 #18
0
 private bool PrintItemExists()
 {
     return(PrintItems.Any(x => x.Id.Equals(SelectedId())));
 }
예제 #19
0
 public int GetIndex(PrintItemWrapper printItem)
 {
     return(PrintItems.IndexOf(printItem));
 }
예제 #20
0
 private LabelPrintViewModel GetPrintItem()
 {
     return(PrintItems.Single(x => x.Id.Equals(SelectedId())));
 }
예제 #21
0
 private bool CanPrint()
 {
     return(PrintItems.Any());
 }
        public static void Main()
        {
PlayAgain:

            //creating the first snake in the upper left corner with len of 5
            snake = new Queue <Position>();
            snake = GlobalConstants.InitializeTheSnake();

            //setting the cursor to invisible so the game looks better
            Console.CursorVisible = false;
            Console.BufferHeight  = Console.WindowHeight;

            PrintItems.PrintTheSnakeOnTheConsole(snake);

            Position nextDirection = AvaliableDirections.GetNeededPosition(ConsoleKey.RightArrow);
            Position oldDirection  = AvaliableDirections.GetNeededPosition(ConsoleKey.RightArrow);

            while (true)
            {
                if (Console.KeyAvailable)
                {
                    ConsoleKeyInfo currMovement = Console.ReadKey();

                    nextDirection = AvaliableDirections.GetNeededPosition(currMovement);

                    bool moveIsNotValid = PositionCheck.CheckIfTheMoveIsValid(nextDirection, oldDirection);

                    if (moveIsNotValid)
                    {
                        nextDirection = oldDirection.ToPosition();
                    }

                    oldDirection = nextDirection.ToPosition();
                }

                Console.Clear();

                bool snakeAteTheFood;
                try
                {
                    snakeAteTheFood = SnakeUpdate.UpdateTheSnake(snake, nextDirection);
                }
                catch (GameOver goe)
                {
                    PrintItems.PrintFinalMessage(goe.Message, snake);

                    goto End;
                }

                HighScoreMenager.UpdateTheCurrentScore(snake);
                PrintItems.ScoreTracker();
                PrintItems.PrintTheSnakeOnTheConsole(snake);
                PrintItems.PrintSnakeFood(snake, snakeAteTheFood);

                Thread.Sleep(ConsoleDelayControl.consoleDelay);
            }

End:

            HighScoreMenager.CheckIfThereIsANewHighscoreAndUpdate();

            bool wantsToPlayAgain = PrintItems.AnotherGameQuestion();

            if (wantsToPlayAgain)
            {
                goto PlayAgain;
            }
        }