private void AddItems(List <Json.DataObject> objs, int index, bool select, bool report = true)
        {
            IList list = CurrentList;

            if (objs.Count == 0 || list == null)
            {
                return;
            }

            CreateEditAction action = new CreateEditAction(true, Index.RemoveNext(), Index.RemoveNext());

            foreach (Json.DataObject item in objs)
            {
                CurrentList.Insert(index, item);
                listBoxList.Items.Insert(index, SafeName(item));
                action.objects.Add(index, item);
                index++;
            }
            index--;
            if (select)
            {
                listBoxList.SelectedIndices.Clear();
                this.listBoxList.SelectedIndex = index;
            }
            action.Index1.itemIndex = index;
            if (report && OnObjectEdited != null)
            {
                OnObjectEdited(this, action);
            }
        }
        private void toolStripButtonSaveUlDef_Click(object sender, EventArgs e)
        {
            CurrentList.SaveToFile(DefaultUninstallListPath);
            CurrentListFileName = DefaultUninstallListPath;

            toolStripButtonDelete.Enabled = true;
        }
Exemple #3
0
 //----------------------------------------------------------------------------------------------------------------------
 internal void DeleteCurrentTrack()
 {
     if (CurrentList != null)
     {
         CurrentList.DeleteCurrentTrack();
     }
 }
Exemple #4
0
        private List <List <int> > GenerateVaildBestPath(List <int> BestPath)
        {
            var BestPathFull = new List <List <int> >();
            var CurrentList  = new List <int>();
            var firstList    = true;

            foreach (var v in BestPath)
            {
                if (v == 0)
                {
                    if (firstList)
                    {
                        firstList   = false;
                        CurrentList = new List <int>();
                    }
                    else
                    {
                        firstList = true;
                        CurrentList.Add(v);
                        BestPathFull.Add(CurrentList);
                        continue;
                    }
                }

                CurrentList.Add(v);
            }

            return(BestPathFull);
        }
        /// <summary>
        /// Shows the completion list popup at a given point on screen
        /// </summary>
        /// <param name="NearRectangle">Normally, the popup list will be shown
        /// right under this block (under NearRectangle)</param>
        /// <param name="parentControl">DrawWindow that causes this popup to show</param>
        public void Show(Rectangle nearRectangle, Control parent)
        {
            if (this.Visible)
            {
                return;
            }
            ParentControl = parent;

            FillItems();
            if (lstItems.Items.Count == 0)
            {
                return;
            }

            this.Parent = parent.Parent;
            this.BringToFront();

            CalcSize();
            CalcStartPosition(nearRectangle, parent);

            this.Show();

            this.lstItems.Focus();

            if (CurrentList != null)
            {
                CurrentList.RaiseVisibleChanged(true);
            }
        }
Exemple #6
0
        public override void Enter()
        {
            MainWindow.StopTimer();
            if (CursorX < 0 || CursorX >= CurrentList.Count ? false : !ShowingDrive)
            {
                MediaPlayerController controller = MainWindow.controller;

                if (iD.Equals("currentPlaylistBrowser"))
                {
                    WindowManager.DrawColourBlock(ConsoleColor.Gray, 42, 10, 43, 120);//Seekbar domyslny szary
                    //controller.LoadCurrentSong(CurrentList.ElementAt(cursorX));
                    controller.Stop();
                    controller.LoadCurrentSong(cursorX);
                    WindowManager.WirteText(CurrentlySelectedFile, 0, 0, this.TextColour, this.BackgroundColour);
                    //ResetCursorX();
                    //(ParentWindow as MainWindow).currentSongLabel.SetText("                                                                              ");
                    //(ParentWindow as MainWindow).currentSongLabel.SetText(controller.GetCurrentSongLabel(cursorX));
                    //(ParentWindow as MainWindow).ReloadCurrentPlaylistBrowser();
                }
                else if (iD.Equals("playlistsBrowser"))
                {
                    controller.Stop();
                    controller.LoadCurrentPlaylist(CurrentList.ElementAt(cursorX));
                    //controller.CurrentSong = mediaPlayer.CurrentPlaylist.Tracks.FirstOrDefault();
                    //controller.SetFirstOrDefaultSong();
                    (ParentWindow as MainWindow).ReloadCurrentPlaylistBrowser();

                    //ResetCursorX();
                    //(ParentWindow as MainWindow).ReloadPlaylistsBrowser();
                }
                else if (iD.Equals("libraryBrowser"))
                {
                    controller.Stop();
                    if (CursorX == 0)
                    {
                        controller.LoadLibraryMediaPlaylist();
                    }
                    else
                    {
                        controller.LoadCurrentLibrary(CurrentList.ElementAt(CursorX));
                    }
                    (ParentWindow as MainWindow).ReloadCurrentPlaylistBrowser();
                    //(ParentWindow as MainWindow).ReloadLibraryBrowser();
                    //(ParentWindow as MainWindow).ReloadPlaylistsBrowser();
                }
                else if (iD.Equals("addTrackToPlaylist"))
                {
                    string playlist;
                    playlist = controller.PlaylistsToString.ElementAt(cursorX);
                    (ParentWindow as AddTrackToPlaylistWindow).Apply();
                    controller.AddTrackToPlaylist(rememberSongId, playlist);
                    ResetCursorX();
                }
            }
            else if (SelectFile == null ? false : !ShowingDrive)
            {
                SelectFile();
            }
            MainWindow.StartTimer();
        }
Exemple #7
0
 //----------------------------------------------------------------------------------------------------------------------
 internal void GoToNextTrack()
 {
     if (CurrentList != null)
     {
         CurrentList.GoToNextTrack();
     }
 }
Exemple #8
0
        //
        // Summary:
        //     Called when the component needs to load graphics resources.  Override to
        //     load any component specific graphics resources.
        //
        // Parameters:
        //   loadAllContent:
        //     true if all graphics resources need to be loaded;false if only manual resources
        //     need to be loaded.
        protected override void LoadContent()
        {
            if (scoring && prompt != null)
            {
                prompt.LoadContent(game);
            }
            SpriteBatch = new SpriteBatch(game.Graphics.Device);
            foreach (MenupartDescription i in menuXml.MenuParts)
            {
                if (i.Name.Equals(CurrentMenu))
                {
                    background = game.Content.Load <Texture2D>("Content\\Textures\\Menu\\" + i.BackgroundImage);
                    mouse      = game.Content.Load <Texture2D>("Content\\Textures\\Menu\\" + i.Mouse);
                }
            }

            textfield = game.Content.Load <Texture2D>("Content\\Textures\\Menu\\" + "Textfield");
            CurrentList.LoadContent();
            font = game.Content.Load <SpriteFont>("Arial");
            red  = game.Content.Load <Texture2D>("Content\\Textures\\Menu\\" + "3dmousered");
            if (prompt != null)
            {
                prompt.LoadContent(game);
            }
            if (HighscoreMenu != null && HighscoreMenu.Visiblity)
            {
                HighscoreMenu.LoadContent();
            }
            if (OptionMenu != null && OptionMenu.Visiblity)
            {
                OptionMenu.LoadContent();
            }
        }
 /// <summary>
 /// 加入元素到缓存
 /// </summary>
 /// <param name="t"></param>
 public void Add(TU t)
 {
     lock (_lock)
     {
         CurrentList.Add(t);
     }
 }
Exemple #10
0
 private void ClearList()
 {
     _sectorObjects.Clear();
     _levelObjects.Clear();
     CurrentList.Clear();
     PreviousList.Clear();
 }
Exemple #11
0
        private void AddNewToCurrent()
        {
            try
            {
                if (string.IsNullOrEmpty(NewTagName))
                {
                    return;
                }

                var exists = ds.GetTags(NewTagName);
                if (exists.Count > 0)
                {
                    throw new Exception("The tag already exists.");
                }
                else
                {
                    CurrentList.Add(new Tag()
                    {
                        TagName = NewTagName
                    });
                    NewTagName = "";
                }
            }
            catch (Exception e)
            {
                MessageBoxFactory.ShowError(e);
            }
        }
        public async Task ExecuteLoadItemsCommand()
        {
            IsBusy = true;

            try
            {
                var list1 = await _canteenService.GetMenuOrderListCurrentAsync();

                var list2 = await _canteenService.GetMenuOrderListNextAsync();

                CurrentList.Clear();
                CurrentList.Add(new MenuOrderList {
                    WeekList = new ObservableCollection <MenuOrder>(list1)
                });
                CurrentList.Add(new MenuOrderList {
                    WeekList = new ObservableCollection <MenuOrder>(list2)
                });
                CurrentList.Add(new MenuOrderList {
                    WeekList = null
                });
            }
            catch (Exception ex)
            {
                Debug.WriteLine(ex);
            }
            finally
            {
                IsBusy = false;
            }
        }
Exemple #13
0
        private void UpdatePlayerPosition()
        {
            //TODO: this needs to be more global
            if (!IsActive)
            {
                return;
            }
            var playPos = Player.Tr.position.WorldToGenericGrid(_sectorSize);

            if (playPos == _playerPosition)
            {
                return;
            }
            _playerPosition = playPos;
            _currentIndex   = _currentIndex == 0 ? 1 : 0;
            CurrentList.Clear();
            CurrentList.Add(_playerPosition);
            for (int i = 0; i < DirectionsExtensions.DiagonalLength; i++)
            {
                var pos = _playerPosition + ((DirectionsEight)i).ToP3();
                CurrentList.Add(pos);
            }
            SetList(true);
            SetList(false);
        }
Exemple #14
0
        /// <summary>Dismiss current card and fetch next one.</summary>
        /// <returns>Whether any cards are available</returns>
        /// <exception cref="System.InvalidOperationException">No card available (Current is null).</exception>
        public Task <bool> DismissAsync()
        {
            Card card = Current;

            if (card == null)
            {
                throw new InvalidOperationException("Card unavailable");
            }

            NextAction[CurrentList] = () => CurrentList.DismissAsync();
            CurrentList             = null;

            // Create review log before dismiss
            ReviewLog log = CreateLog(card);

            // Actually dismiss card
            CardAction cardAction = card.Dismiss();

            // Complete log with updated values
            CompleteLog(log, card, Grade.Dismiss);

#pragma warning disable 4014
            // Save changes to Database
            UpdateCardAsync(log, card, cardAction);
#pragma warning restore 4014

            return(DoNextAsync());
        }
Exemple #15
0
        /// <summary>
        /// Has the car arrived at its destination?
        /// </summary>
        /// <returns>true if arrived, false if still transitioning.</returns>
        private bool ArrivedDestination()
        {
            bool arrived = false;

            // Are we heading in a direction, but servicing the opposite list (i.e. heading up to service the downList - or vice versa)
            Direction currentListDirection = (CurrentList == upList) ? Direction.up : Direction.down;

            if (currentListDirection != CurrentDirection)
            {
                // We are servicing opposing list / direction case.  We have only arrived if we are at the head of the list.
                if ((CurrentList.Count > 0) && (CurrentList[0] != CurrentFloor))
                {
                    return(arrived);
                }
            }

            if (CurrentList.Contains(CurrentFloor))
            {
                Console.WriteLine("Car is on floor {0}, loading/unloading passengers, and {1}.", CurrentFloor, (CurrentDirection == Direction.idle) ? "is idle" : "is heading " + CurrentDirection.ToString());
                Console.WriteLine("You have {0} seconds to choose your destination.  Otherwise, you may loose your turn.", ElevatorTimer.TheTimer.Interval / 1000);
                CurrentList.Remove(CurrentFloor);
                arrived = true;
            }

            return(arrived);
        }
Exemple #16
0
 //----------------------------------------------------------------------------------------------------------------------
 internal void DeleteAllTracks()
 {
     if (CurrentList != null)
     {
         CurrentList.DeleteAllTracks();
     }
 }
Exemple #17
0
        private void RandomButt_Click(object sender, RoutedEventArgs e)
        {
            Random rand = new Random();

            CurrentList      = CurrentList.OrderBy(x => x != CurrentList[CurrentIndex] ? rand.Next() : 0).ToList();
            Play.ItemsSource = CurrentList;
            CurrentIndex     = 0;
        }
Exemple #18
0
        private void RandomButt_Click(object sender, RoutedEventArgs e)
        {
            Random rand = new Random();

            CurrentList      = CurrentList.OrderBy(x => x != CurrentList[CurrentIndex] ? rand.Next() : 0).ToList(); //mix songs
            Play.ItemsSource = CurrentList;                                                                         // updating the list of songs
            CurrentIndex     = 0;                                                                                   //to play from the beginning
        }
        private void RandomButt_Click(object sender, RoutedEventArgs e)
        {
            Random rand = new Random();

            CurrentList      = CurrentList.OrderBy(x => x != CurrentList[CurrentIndex] ? rand.Next() : 0).ToList(); //перемешиваем песни
            Play.ItemsSource = CurrentList;                                                                         // обновляем список песен
            CurrentIndex     = 0;                                                                                   //для воспроизведения с начала
        }
Exemple #20
0
        public override bool Execute()
        {
            var isbs = base.Execute();

            if (!isbs)
            {
                return(false);
            }

            int id = 0;

            using (var localrepos = new DAL.Repositories()) {
                id = LastElement == null?0:LastElement.CustomerID;
                if (!IsUpdate)
                {
                    if (IsNext)
                    {
                        Entities    = localrepos.Customers.GetAll(el => el.CustomerID > id);
                        CurrentList = Entities.Take(AmountElements).ToList();
                    }
                    else
                    {
                        id       = FirstElement == null?int.MaxValue:FirstElement.CustomerID;
                        Entities = localrepos.Customers.GetAll().OrderByDescending(el => el.CustomerID).
                                   Where(el => el.CustomerID < id);
                        CurrentList = Entities.Take(AmountElements).OrderBy(el => el.CustomerID).ToList();
                    }
                }
                else
                {
                    Entities    = localrepos.Customers.GetAll().Where(el => el.CustomerID >= id);
                    CurrentList = Entities.Take(AmountElements).ToList();
                }
            }

            if (CurrentList != null && CurrentList.Count > 0)
            {
                FirstElement = CurrentList.First();
                LastElement  = CurrentList.Last();
            }
            else
            {
                FirstElement = null;
                LastElement  = null;
                Information  = StringSource.EndList();
                return(false);
            }

            foreach (var el in CurrentList)
            {
                EntitiesInformation.Add(StringSource.ClientInformation(el, false));
                IdsEntities.Add(el.CustomerID);
            }

            Information = StringSource.Successfully();
            return(true);
        }
Exemple #21
0
 private void openEdit()
 {
     if (SelectedIndex >= 0)
     {
         _dialogService.ShowDialog(this, new ViewModels.EditViewModel(_dialogService, Selected));
         CurrentList.ChangeNote(SelectedIndex, Selected.Text);
         Utilities.SavedData.Save(Tabs);
     }
 }
Exemple #22
0
        //
        // Zusammenfassung:
        //     Called when the DrawableGameComponent needs to be drawn.  Override this method
        //     with component-specific drawing code.
        //
        // Parameter:
        //   gameTime:
        //     Time passed since the last call to Microsoft.Xna.Framework.DrawableGameComponent.Draw(Microsoft.Xna.Framework.GameTime).
        public override void Draw(GameTime gameTime)
        {
            if (SpriteBatch != null)
            {
                SpriteBatch.Begin();

                if (scoring && prompt != null)
                {
                    prompt.Draw(gameTime, SpriteBatch);
                }
                #region Hauptmenü
                if (Visiblity)
                {
                    //if (Action)
                    {
                        foreach (MenupartDescription i in menuXml.MenuParts)
                        {
                            if (i.Name.Equals(CurrentMenu))
                            {
                                SpriteBatch.Draw(background, new Rectangle(0, 0,
                                                                           game.Graphics.Device.Viewport.Width, game.Graphics.Device.Viewport.Height),
                                                 Color.White);
                            }
                        }
                        CurrentList.Draw(gameTime, SpriteBatch);
                    }
                    SpriteBatch.DrawString(font, "Press F2 for using 3D mouse",
                                           new Vector2(10, game.Graphics.Device.Viewport.Height - 70), Color.White);
                    if (game.HasSpaceMouse)
                    {
                        SpriteBatch.Draw(red, new Rectangle(10, game.Graphics.Device.Viewport.Height - 35,
                                                            16, 16), Color.White);
                    }
                }
                #endregion

                else if (HighscoreMenu != null && HighscoreMenu.Visiblity)
                {
                    HighscoreMenu.Draw(gameTime, SpriteBatch);
                }
                else if (OptionMenu != null && OptionMenu.Visiblity)
                {
                    OptionMenu.Draw(gameTime, SpriteBatch);
                }
                if (prompt != null)
                {
                    prompt.Draw(gameTime, SpriteBatch);
                }

                /*if (Prompts.Count != 0)
                 * {
                 *  Prompts.Draw(gameTime, SpriteBatch);
                 * }*/
                SpriteBatch.Draw(mouse, MousePosition, Color.White);
                SpriteBatch.End();
            }
        }
Exemple #23
0
 public void CreateNote()
 {
     if (_currentNoteText == null)
     {
         _currentNoteText = "";
     }
     CurrentList.Add(_currentNoteText);
     CurrentNoteText = "";
     Utilities.SavedData.Save(Tabs);
 }
Exemple #24
0
 private void DeleteProduct()
 {
     using (var db = new ShoppingContext())
     {
         var productToRemove = db.Products.SingleOrDefault(x => x.ProductId == SelectedProduct.OriginalProduct.ProductId);
         db.Products.Remove(productToRemove);
         db.SaveChanges();
     }
     CurrentList.Remove(SelectedProduct);
 }
Exemple #25
0
        private void deleteNote()
        {
            int temp = SelectedIndex;

            if (temp >= 0 && temp < CurrentList.Size)
            {
                CurrentList.Remove(temp);
                SelectedIndex = temp > 0 ? temp - 1 : 0;
                Utilities.SavedData.Save(Tabs);
            }
        }
Exemple #26
0
        private void AddExistingToCurrent()
        {
            if (SelectedExisting == null)
            {
                return;
            }

            var tmp = SelectedExisting;

            AllTags.Remove(tmp);
            CurrentList.Add(tmp);
        }
Exemple #27
0
 /// <summary>
 /// 加入元素到缓存
 /// </summary>
 /// <param name="t"></param>
 public void Add(TU t)
 {
     _readerWriterLockSlim.EnterReadLock();
     try
     {
         CurrentList.Add(t);
     }
     finally
     {
         _readerWriterLockSlim.ExitReadLock();
     }
 }
Exemple #28
0
        private void AddProduct()
        {
            var newProduct = new Product(ProductTitle, _currentShoppingList.ShoppingListId);

            using (var db = new ShoppingContext())
            {
                db.Products.Add(newProduct);
                db.SaveChanges();
            }
            CurrentList.Add(new BindableProduct(newProduct));
            ProductTitle = "";
        }
Exemple #29
0
        private void MoveElevator()
        {
            // The elevator is moving in a direction
            if ((CurrentDirection == Direction.up) || (CurrentDirection == Direction.down))
            {
                int destination = -1;

                // Are there more items on the CurrentList - which are eligible for servicing?
                int found = CurrentList.FindIndex((n) =>
                {
                    if (CurrentDirection == Direction.up)
                    {
                        return(n > CurrentFloor);
                    }
                    else if (CurrentDirection == Direction.down)
                    {
                        return(n < CurrentFloor);
                    }
                    return(false);
                });

                // If not, it is time to reverse direction
                if (found == -1)
                {
                    List <int> otherList = (CurrentList == upList) ? downList : upList;
                    if (otherList.Count == 0)
                    {
                        CurrentDirection = Direction.idle;
                        return;
                    }
                    CurrentList = otherList;
                    SetDirection();
                    destination = CurrentList[0];

                    // We have switched lists.  Are we on a floor on the new list?
                    if (CurrentFloor == destination)
                    {
                        CurrentList.Remove(destination);
                        return;
                    }
                }
                else
                {
                    destination = CurrentList[found];
                }

                Console.WriteLine("The elevator is moving past floor {0} transitioning to {1}", CurrentFloor, destination);
                CurrentFloor = (CurrentDirection == Direction.up) ? CurrentFloor + 1 : CurrentFloor - 1;
                //FutureDirection = OppositeDirection;
                return;
            }
        }
 private void saveUlDialog_FileOk(object sender, CancelEventArgs e)
 {
     try
     {
         CurrentList.SaveToFile(saveUlDialog.FileName);
         CurrentListFileName = saveUlDialog.FileName;
         UnsavedChanges      = false;
     }
     catch (Exception ex)
     {
         PremadeDialogs.GenericError(ex);
     }
 }