private void windowLoadedHandler()
        {
            // Load sections from database and display on canvas
            _storeSectionList = _db.TableStoreSection.GetAllStoreSections(_floorplanID);
            foreach (var section in _storeSectionList)
            {
                SectionShape loadedSectionShape = new SectionShape();
                loadedSectionShape.Top   = section.CoordinateY;
                loadedSectionShape.Left  = section.CoordinateX;
                loadedSectionShape.Shape = ShapeButtonCreator.CreateShapeForButton();
                loadedSectionShape.Name  = "Button" + section.StoreSectionID;
                loadedSectionShape.ID    = section.StoreSectionID;

                ShapeCollection.Add(loadedSectionShape);
            }

            // Load items from database and display on itemdatagrid
            ListOfItems.Populate(_db.TableItem.SearchItems(""));


            // Load floorplan and display on canvas
            _db.TableFloorplan.DownloadFloorplan(@"../../images/");

            FloorplanImage = null;
            ImageBrush       floorplanImgBrush = new ImageBrush();
            RefreshableImage refresh           = new RefreshableImage();
            BitmapImage      result            = refresh.Get("../../images/floorplan.jpg");

            floorplanImgBrush.ImageSource = result;
            FloorplanImage = floorplanImgBrush;
        }
示例#2
0
 private void Window_Deactivated(object sender, EventArgs e)
 {
     AppController.Current.CurrentlyInBackground = true;
     ScrollToItem     = ListOfItems.GetCurrentlyTopmostShownItem();
     TopMostShownItem = ScrollToItem;
     storeTweetMarkerOfCurrentSelectView();
 }
示例#3
0
        public MainPageViewModel()
        {
            ListOfItems.Add(new User());
            LoginCommand = new Command((e) =>
            {
                var item = (e as User);
                //TODO: LOGIN TO YOUR SYSTEM
                OnLoginCommandExecute(item);
            });
            RegisterCommand = new Command((e) =>
            {
                OnRegisterCommandExecute();
            });
            //}

            //public event PropertyChangedEventHandler PropertyChanged;
            //void OnPropertyChanged([CallerMemberName]string propertyName = "") =>
            //        PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));

            //public ICommand OnSignInCommandExecute { get; private set; }
            //public MainPageViewModel()
            //{
            //    //OnSignInCommandExecute = new Command<User>(OnLoginCommandExecute);
            //    OnSignInCommandExecute = new Command((e) =>
            //    {
            //        var item = e as User;
            //        OnLoginCommandExecute(item);
            //    });
            //}

            //private bool CanOnLoginCommandExecute(User arg)
            //{
            //    return true;
            //}
        }
示例#4
0
        public IActionResult AverageStock()
        {
            List <ShopItem> itemsList    = ListOfItems.GetItems();
            double          averageStock = itemsList.Average(i => i.StockQuantity);

            return(View(averageStock));
        }
示例#5
0
        public IActionResult MyShop()
        {
            //ViewBag.items = ListOfItems.GetItems(); working same as line under (better solution)
            List <ShopItem> itemsList = ListOfItems.GetItems();

            return(View(itemsList));
        }
示例#6
0
        public void ScrollToItemInListbox(IItem item)
        {
            if (item == null)
            {
                return;
            }
            if (lastScrollToTimes.ContainsKey(item.Id))
            {
                DateTime?lastTimeScrolledTo = lastScrollToTimes[item.Id];
                if (lastTimeScrolledTo != null)
                {
                    if (lastTimeScrolledTo.Value.AddSeconds(2) > DateTime.Now)
                    {
                        return;
                    }
                }
            }
            lastScrollToTimes[item.Id] = DateTime.Now;

            //AppController.Current.sendNotification("General", "Scroll to item", item.Text, "", item);
            if (ListOfItems.listView_Tweets.ItemContainerGenerator.Status != System.Windows.Controls.Primitives.GeneratorStatus.GeneratingContainers)
            {
                AppController.Current.Logger.addDebugMessage("Scroll to item", "ItemContainerGenerator is free", item: item, type: DebugMessage.DebugMessageTypes.ScrollIntoView);
                if (!ListOfItems.listView_Tweets.Items.Contains(item))
                {
                    item = ListOfItems.GetCurrentlyTopmostShownItem();
                    AppController.Current.Logger.addDebugMessage("Scroll to item not displayed!", "Initated retrieval of new top item", item: item, type: DebugMessage.DebugMessageTypes.ScrollIntoView);
                }
                if (ListOfItems.listView_Tweets.Items.Count < 2)
                {
                    return;
                }


                ListOfItems.listView_Tweets.Dispatcher.BeginInvoke(System.Windows.Threading.DispatcherPriority.Input, new Action(() =>
                {
                    try
                    {
                        //ttt
                        //ListOfItems.listView_Tweets.ScrollIntoView(ListOfItems.listView_Tweets.Items[ListOfItems.listView_Tweets.Items.Count - 1]);
                        //ListOfItems.listView_Tweets.ScrollIntoView(item);
                    }
                    catch { }
                }));


                ScrollToItem = item;
            }
            else
            {
                AppController.Current.Logger.addDebugMessage("Scroll to item", "ItemContainerGenerator is in use", item: item, type: DebugMessage.DebugMessageTypes.ScrollIntoView);
                if (!ListOfItems.listView_Tweets.Items.Contains(item))
                {
                    item = ListOfItems.GetCurrentlyTopmostShownItem();
                    AppController.Current.Logger.addDebugMessage("Scroll to item not displayed!", "Initated retrieval of new top item", item: item, type: DebugMessage.DebugMessageTypes.ScrollIntoView);
                }
                ScrollToItem = item;
            }
        }
示例#7
0
        /// <summary>
        /// Opens a project from a file.
        /// </summary>
        /// <param name="path"></param>
        public void Open(string path)
        {
            string appData = System.Environment.GetFolderPath(System.Environment.SpecialFolder.ApplicationData) + "\\Stv233\\ItemCreator\\";

            Name = path.Substring(path.LastIndexOf("\\") + 1, path.LastIndexOf(".") - path.LastIndexOf("\\") - 1);
            try
            {
                Directory.Delete(appData + "\\Projects\\" + Name, true);
            }
            catch { }
            ZipFile.ExtractToDirectory(path, appData + "\\Projects\\" + Name);
            ListOfItems.Clear();

            string[] ProjectData = File.ReadAllLines(appData + "\\Projects\\" + Name + "\\ProjectData");

            if (ProjectData[0] == "AIS")
            {
                Type = Types.AIS;
            }
            else if (ProjectData[0] == "Pro")
            {
                Type = Types.Pro;
            }
            else if (ProjectData[0] == "Simple")
            {
                Type = Types.Simple;
            }
            else
            {
                throw new System.Exception("Unknown project type");
            }

            Array.Copy(ProjectData, 1, ProjectData, 0, ProjectData.Length - 1);
            Array.Resize <string>(ref ProjectData, ProjectData.Length - 1);

            foreach (string itemName in ProjectData)
            {
                if (Type == Types.Simple)
                {
                    SimpleItem item = new SimpleItem(itemName);
                    item.Import(appData + "\\Projects\\" + Name + "\\" + itemName);
                    ListOfItems.Add(itemName, item);
                }
                else if (Type == Types.Pro)
                {
                    ProItem item = new ProItem(itemName);
                    item.Import(appData + "\\Projects\\" + Name + "\\" + itemName);
                    ListOfItems.Add(itemName, item);
                }
                else if (Type == Types.AIS)
                {
                    AISItem item = new AISItem(itemName);
                    item.Import(appData + "\\Projects\\" + Name + "\\" + itemName);
                    ListOfItems.Add(itemName, item);
                }
            }
        }
 private void deleteItemHandler()
 {
     try
     {
         DisplayItem selectedItem = ListOfItems[ListOfItems.CurrentIndex];
         _db.TableItem.DeleteItem((long)selectedItem.ID);
         ListOfItems.RemoveAt(ListOfItems.CurrentIndex);
         _messageBox.OpenMessageBox($"{selectedItem.VareNavn} blev slettet fra databasen");
     }
     catch (Exception exception)
     {
         _messageBox.OpenMessageBox("Noget gik galt! Check Debug for fejlmeddelelse");
         Debug.WriteLine(exception.Message);
     }
 }
示例#9
0
 void ItemContainerGenerator_StatusChanged(object sender, EventArgs e)
 {
     if (ScrollToItem != null)
     {
         if (!ListOfItems.listView_Tweets.Items.Contains(ScrollToItem))
         {
             ScrollToItem = ListOfItems.GetCurrentlyTopmostShownItem();
             AppController.Current.Logger.addDebugMessage("Listbox did not contain the CurrentTopMostItem", "Selected new one (if item is empty none has been found", item: ScrollToItem, type: DebugMessage.DebugMessageTypes.ScrollIntoView, view: comboBoxViews.SelectedItem as View);
         }
         if (ScrollToItem != null)
         {
             ScrollToItemInListbox(ScrollToItem);
         }
     }
     ScrollToItem = null;
 }
示例#10
0
        public ResultObj <UserDto> Activate(string userCode, bool activate)
        {
            //activate or deactivate by updating IsActive flag to true or false
            var result = FindByKey(u => u.UserCode == userCode);

            if (!result.Success)
            {
                return(result);
            }

            result.Data.IsActive = activate;
            var user = ListOfItems.FirstOrDefault(u => u.UserCode == userCode);

            user.IsActive = activate;
            return(new ResultBuilder <UserDto>().Success(user).Build());
        }
示例#11
0
        public void AddItemList(string item, string description, List <string> Test)
        {
            ListOfItems.Add(Index, item);
            ListOfDescription.Add(Index, description);

            var TestDictonary = new Dictionary <int, string>();

            foreach (string i in Test)
            {
                TestDictonary.Add(IndexList, i);
                IndexList += 1;
            }
            IndexList = 1;
            ListDictionaryItemList.Add(TestDictonary);
            ListOfItemList.Add(Index);
            Sideway.Add(1);

            Index += 1;
        }
 private void addItemHandler()
 {
     try
     {
         if (Regex.IsMatch(ItemName, @"^[a-zA-Z0-9-øØ-æÆ-åÅ\s]+$"))
         {
             var itemID      = _db.TableItem.CreateItem(ItemName, ItemGroupComboBoxList[ComboBoxIndex].ItemGroupID);
             var createdItem = new Item(itemID, ItemName, ItemGroupComboBoxList[ComboBoxIndex].ItemGroupID);
             ListOfItems.Add(new DisplayItem(createdItem));
             _messageBox.OpenMessageBox($"{ItemName} er blevet tilføjet til databasen");
             ItemName      = "";
             ComboBoxIndex = -1;
         }
         else
         {
             _messageBox.OpenMessageBox("Navnet på en vare kan kun indeholde bogstaver og tal");
         }
     }
     catch (Exception exception)
     {
         _messageBox.OpenMessageBox("Noget gik galt! Check Debug for fejlmeddelelse");
         Debug.WriteLine(exception.Message);
     }
 }
示例#13
0
 public void AddItem(string item, string description)
 {
     ListOfItems.Add(Index, item);
     ListOfDescription.Add(Index, description);
     Index += 1;
 }
示例#14
0
        public void DoFillData(String t, ListOfItems li, MapFieldList m)
        {
            table = t;
            mf = m;
            ldata = li;

            ProgressDialog dlg2 = new ProgressDialog();
            dlg2.Owner = null;
            for (int index = 0; index < App.Current.Windows.Count; index++)
            {
                if (App.Current.Windows[index].Title == "ΕΥΕ Sampling")
                {
                    dlg2.Owner = App.Current.Windows[index];
                    break;
                }
            }
            dlg2.DialogText = "Καταγραφή δεδομένων στη Βάση.";
            int startValue = 0;
            dlg2.RunWorkerThread(startValue, FillDatal);
        }