Beispiel #1
0
        public OptionsProvider(IStorageSystem storage)
        {
            _storage    = storage;
            AlexOptions = new AlexOptions();

            Load();
        }
Beispiel #2
0
        /// <summary>
        /// Event which is raised whenever a connected storage system requests
        /// permission for pack input. The specified request object is used to get further details about
        /// the requested pack input and to allow or deny the pack input.
        /// </summary>
        /// <param name="sender">Object instance which raised the event.</param>
        /// <param name="request">Object which contains the details about the requested pack input.</param>
        static void StorageSystem_PackInputRequested(IStorageSystem sender, IInputRequest request)
        {
            // for now just accept every input request
            foreach (var pack in request.Packs)
            {
                Console.WriteLine("Pack '{0}' requested input via request '{1}' from source '{2}'.", pack.ScanCode, request.Id, request.Source);

                var articleCode = pack.ScanCode;
                if (articleCode.Length < 8)
                {
                    articleCode = articleCode.PadLeft(8, '0');
                }


                // set dummy article information
                pack.SetArticleInformation(articleCode,
                                           string.Format("My Article {0}", articleCode),
                                           "Dosage Form",
                                           "Packaging Unit",
                                           0,
                                           string.Format("Virtual-{0}", articleCode),
                                           string.Format("My Article {0}", articleCode));

                /*/pack.SetVirtualArticleInformation("Virtual_" + pack.ScanCode,
                 *          string.Format("My VirtualArticle {0}", pack.ScanCode),
                 *          "Dosage Form",
                 *          "Packaging Unit");*/


                // allow pack input
                pack.SetHandling(InputHandling.Allowed);
            }

            request.Finish();
        }
Beispiel #3
0
        public OptionsDataProvider(IStorageSystem storage)
        {
            _storage = storage;
            Data     = new AlexOptions();

            Load();
        }
Beispiel #4
0
        /// <summary>
        /// Event which is raised when detailed information for one or more articles is requested.
        /// </summary>
        /// <param name="sender">The sender of the event.</param>
        /// <param name="articleList">List of articles request.</param>
        private static void StorageSystem_ArticleInfoRequested(IStorageSystem sender, IStorageSystemArticleInfoRequest request)
        {
            foreach (var article in request.ArticleList)
            {
                Console.WriteLine("Article Info Request for id '{0}', Depth '{1}', Width '{2}', Height '{3}', Weight {4}",
                                  article.Id, article.Depth, article.Width, article.Height, article.Weight);

                List <string> productCodeList = new List <string>();
                productCodeList.Add("123-1");
                productCodeList.Add("123-2");
                productCodeList.Add("123-3");

                article.SetArticleInformation(article.Id,
                                              string.Format("My Article {0}", article.Id),
                                              "Dosage Form",
                                              "Packaging Unit",
                                              0,
                                              string.Format("Virtual-{0}", article.Id),
                                              string.Format("My Article {0}", article.Id),
                                              false,
                                              DateTime.Now,
                                              productCodeList);
            }
            request.Finish();
        }
Beispiel #5
0
        /// <summary>
        /// Event which is raised whenever a connected storage system requests
        /// permission for pack input. The specified request object is used to get further details about
        /// the requested pack input and to allow or deny the pack input.
        /// </summary>
        /// <param name="sender">Object instance which raised the event.</param>
        /// <param name="request">Object which contains the details about the requested pack input.</param>
        static void StorageSystem_PackInputRequested(IStorageSystem sender, IInputRequest request)
        {
            // for now just accept every input request
            foreach (var pack in request.Packs)
            {
                Console.WriteLine("Pack '{0}' requested input via request '{1}' from source '{2}'.", pack.ScanCode, request.Id, request.Source);

                // set dummy article information
                pack.SetArticleInformation(pack.ScanCode,
                                           string.Format("My Article {0}", pack.ScanCode),
                                           "Dosage Form",
                                           "Packaging Unit");

                pack.SetVirtualArticleInformation("Virtual_" + pack.ScanCode,
                                                  string.Format("My VirtualArticle {0}", pack.ScanCode),
                                                  "Dosage Form",
                                                  "Packaging Unit");

                pack.AddOtherRobotArticleInformation("Bis" + pack.ScanCode,
                                                     string.Format("My other Article {0}", pack.ScanCode),
                                                     "Dosage Form",
                                                     "Packaging Unit");

                pack.AddOtherRobotArticleInformation("Bis2" + pack.ScanCode,
                                                     string.Format("My other second Article {0}", pack.ScanCode),
                                                     "Dosage Form",
                                                     "Packaging Unit");


                // allow pack input
                pack.SetHandling(InputHandling.Allowed);
            }

            request.Finish();
        }
Beispiel #6
0
        public ResourceManager(GraphicsDevice graphics, IStorageSystem storageSystem, IOptionsProvider options)
        {
            Storage  = storageSystem;
            Graphics = graphics;
            Atlas    = new AtlasGenerator(Graphics);

            Options = options;
        }
Beispiel #7
0
        public void LoadProfiles(IProgressReceiver progressReceiver)
        {
            IPlayerProfileService profileService = ServiceProvider.GetRequiredService <IPlayerProfileService>();
            IStorageSystem        storage        = ServiceProvider.GetRequiredService <IStorageSystem>();

            progressReceiver.UpdateProgress(0, StatusMessage);
            if (storage.TryReadJson(ProfilesFile, out ProfilesFileFormat saveFile))
            //if (File.Exists(ProfilesFile))
            {
                progressReceiver.UpdateProgress(50, StatusMessage);

                //	ProfilesFileFormat saveFile = null;
                SavedProfile[] profiles = null;


                progressReceiver.UpdateProgress(50, StatusMessage);

                if (saveFile != null)
                {
                    profiles = saveFile.Profiles;

                    if (!string.IsNullOrWhiteSpace(saveFile.SelectedProfile))
                    {
                        progressReceiver.UpdateProgress(75, StatusMessage);

                        foreach (var profile in profiles)
                        {
                            //profile.Profile.Type = profile.Type;// == ProfileType.Bedrock;
                            if (profile.Profile.Uuid.Equals(saveFile.SelectedProfile))
                            {
                                progressReceiver.UpdateProgress(90, StatusMessage);
                                LastUsedProfile = profile;
                                //profileService.TryAuthenticateAsync(profile.Profile);
                                //profileService.CurrentProfile = profile;
                                break;
                            }
                        }
                    }

                    progressReceiver.UpdateProgress(99, StatusMessage);
                    foreach (var profile in profiles)
                    {
                        Profiles.Add(profile.Profile.Uuid, profile);
                    }
                }
                else
                {
                    Log.Warn($"Profiles file not found.");
                }
            }
            else
            {
                storage.TryWriteJson(ProfilesFile, new ProfilesFileFormat());
                //	File.WriteAllText(ProfilesFile, JsonConvert.SerializeObject(new ProfilesFileFormat(), Formatting.Indented));
            }

            progressReceiver.UpdateProgress(100, StatusMessage);
        }
Beispiel #8
0
 /// <summary>
 /// Event which is raised whenever a new pack was successfully stored in a storage system.
 /// </summary>
 /// <param name="sender">Object instance which raised the event.</param>
 /// <param name="articleList">List of articles with the packs that were stored.</param>
 static void StorageSystem_PackStored(IStorageSystem sender, IArticle[] articleList)
 {
     foreach (var article in articleList)
     {
         foreach (var pack in article.Packs)
         {
             Console.WriteLine("Pack '{0}' with ScanCode '{1}' and StockInDate '{2}' has been stored in the storage system.", pack.Id, pack.ScanCode, pack.StockInDate.ToShortDateString());
         }
     }
 }
Beispiel #9
0
 private static void StorageSystem_StockUpdated(IStorageSystem sender, IArticle[] articleList)
 {
     foreach (var article in articleList)
     {
         foreach (var pack in article.Packs)
         {
             Console.WriteLine("Pack '{0}' with ScanCode '{1}' and StockInDate '{2}' Stock update.", pack.Id, pack.ScanCode, pack.StockInDate.ToShortDateString());
         }
     }
 }
Beispiel #10
0
        public BlobCache(IStorageSystem storage)
        {
            Storage  = storage;
            BasePath = "blobs";

            if (!Storage.TryGetDirectory(BasePath, out _))
            {
                Storage.TryCreateDirectory(BasePath);
            }
        }
Beispiel #11
0
        /// <summary>
        /// Initializes a new instance of the <see cref="FBulkOrder" /> class.
        /// </summary>
        /// <param name="storageSystem">The storage system instance to use.</param>
        /// <param name="articlePackCounts">The article pack counts to use.</param>
        public FBulkOrder(IStorageSystem storageSystem, Dictionary <string, List <IPack> > articlePacks)
        {
            if (storageSystem == null)
            {
                throw new ArgumentException("Invalid storageSystem specified.");
            }

            InitializeComponent();
            _storageSystem = storageSystem;
            _articlePacks  = articlePacks;
        }
Beispiel #12
0
        public void SaveProfiles()
        {
            IPlayerProfileService profileService = ServiceProvider.GetRequiredService <IPlayerProfileService>();
            IStorageSystem        storage        = ServiceProvider.GetRequiredService <IStorageSystem>();

            //IPlayerProfileService profileService = Alex.Services.GetService<IPlayerProfileService>();
            storage.TryWriteJson(ProfilesFile, new ProfilesFileFormat()
            {
                Profiles        = Profiles.Values.ToArray(),
                SelectedProfile = profileService?.CurrentProfile?.Uuid ?? string.Empty
            });
        }
        /// <summary>
        /// Initializes a new instance of the <see cref="FOrder" /> class.
        /// </summary>
        /// <param name="storageSystem">The storage system instance to use.</param>
        /// <param name="articleList">The article list to use.</param>
        public FOrder(IStorageSystem storageSystem, string[] articleList)
        {
            if (storageSystem == null)
            {
                throw new ArgumentException("Invalid storageSystem specified.");
            }

            InitializeComponent();
            _storageSystem = storageSystem;
            _articleList   = articleList;
            _orderNumberGenerator++;
            txtOrderNumber.Text = _orderNumberGenerator.ToString();
        }
Beispiel #14
0
        /// <summary>
        /// Event which is raised whenever a pack was dispensed by an output
        /// process that was not initiated by this storage system connection (e.g. at the UI of the storage system).
        /// </summary>
        /// <param name="sender">Object instance which raised the event.</param>
        /// <param name="articleList">List of articles with the packs that were dispensed.</param>
        static void StorageSystem_PackDispensed(IStorageSystem sender, IArticle[] articleList)
        {
            foreach (var article in articleList)
            {
                foreach (var pack in article.Packs)
                {
                    Console.WriteLine("Pack '{0}' with ScanCode '{1}' and StockInDate '{2}' has been dispensed by GUI.", pack.Id, pack.ScanCode, pack.StockInDate.ToShortDateString());
                }
            }

            Console.WriteLine("Requesting complete stock...");
            sender.GetStock();
            Console.WriteLine("Requesting complete stock finished.");
        }
Beispiel #15
0
        /// <summary>
        /// Sends the current stock delivery set to the specified storage system.
        /// </summary>
        /// <param name="storageSystem">Storage system to send the stock deliveries too.</param>
        public void Send(IStorageSystem storageSystem)
        {
            var deliveryMap  = new Dictionary <string, List <DataRow> >();
            var deliveryList = new List <IStockDelivery>();

            foreach (DataRow row in _stockDeliveryItemModel.Rows)
            {
                var deliveryNumber = (row[0] != DBNull.Value) ? ((string)row[0]).Trim() : string.Empty;

                if (deliveryMap.ContainsKey(deliveryNumber) == false)
                {
                    deliveryMap.Add(deliveryNumber, new List <DataRow>());
                }

                deliveryMap[deliveryNumber].Add(row);
            }

            foreach (string deliveryNumber in deliveryMap.Keys)
            {
                var delivery = storageSystem.CreateStockDelivery(deliveryNumber);

                foreach (var itemRow in deliveryMap[deliveryNumber])
                {
                    DateTime?expiryDate = null;

                    if (itemRow[9] != DBNull.Value)
                    {
                        expiryDate = (DateTime)itemRow[9];
                    }

                    delivery.AddItem((itemRow[1] != DBNull.Value) ? (string)itemRow[1] : string.Empty,
                                     (itemRow[2] != DBNull.Value) ? (string)itemRow[2] : string.Empty,
                                     (itemRow[4] != DBNull.Value) ? (string)itemRow[4] : string.Empty,
                                     (itemRow[3] != DBNull.Value) ? (string)itemRow[3] : string.Empty,
                                     (itemRow[5] != DBNull.Value) ? (bool)itemRow[5] : false,
                                     (itemRow[6] != DBNull.Value) ? (uint)itemRow[6] : 0,
                                     (itemRow[7] != DBNull.Value) ? (string)itemRow[7] : string.Empty,
                                     (itemRow[8] != DBNull.Value) ? (string)itemRow[8] : string.Empty,
                                     expiryDate,
                                     (itemRow[10] != DBNull.Value) ? (uint)itemRow[10] :0,
                                     (itemRow[11] != DBNull.Value) ? (string)itemRow[11] : null,
                                     (itemRow[12] != DBNull.Value) ? (string)itemRow[12] : null);
                }

                deliveryList.Add(delivery);
            }

            storageSystem.AddStockDeliveries(deliveryList);
        }
Beispiel #16
0
        public JsonStorageMechanism(IStorageSystem fileSystem, string databaseName, string rootFolder, IPecanLogger logger)
        {
            this.Logger = logger;

            if (string.IsNullOrEmpty(databaseName))
            {
                throw new ArgumentNullException(nameof(databaseName));
            }
            this._rootFolder = rootFolder;
            this.db          = this._rootFolder + "\\" + databaseName;

            this.FileSystem = fileSystem;
            if (!this.FileSystem.DirectoryExists(this.db))
            {
                this.FileSystem.CreateDirectory(this.db);
            }

            this.Logger?.Trace(this.GetType().Name, $"Initialized {this.GetType().Name} {this.GetContextDescription()}");
        }
        public StoreListViewModel(IStorageSystem storageSystem, IEventAggregator eventAggregator) : this()
        {
            _eventAggregator = eventAggregator;
            foreach (var store in storageSystem.Stores)
            {
                Stores.Add(new StoreViewModel(store, _eventAggregator));
            }

            var pubSubEvent = eventAggregator.GetEvent <PubSubEvent <AddStoreEvent> >();

            if (Thread.CurrentThread.IsBackground)
            {
                pubSubEvent.Subscribe(OnAddStore);
            }
            else
            {
                pubSubEvent.Subscribe(OnAddStore, ThreadOption.UIThread);
            }
        }
Beispiel #18
0
        public DeliveryPointListViewModel(IStorageSystem storageSystem, IEventAggregator eventAggregator) : this()
        {
            _storageSystem   = storageSystem;
            _eventAggregator = eventAggregator;
            var addEvent = _eventAggregator.GetEvent <PubSubEvent <AddDeliveryPointEvent> >();

            if (Thread.CurrentThread.IsBackground)
            {
                addEvent.Subscribe(OnAddDeliveryPoint);
            }
            else
            {
                addEvent.Subscribe(OnAddDeliveryPoint, ThreadOption.UIThread);
            }

            foreach (var storagePoint in _storageSystem.DeliveryPoints)
            {
                var storagePointViewModel = new StoragePointViewModel(storagePoint, _eventAggregator);
                DeliveryPoints.Add(storagePointViewModel);
            }
        }
Beispiel #19
0
 public MCBedrockAssetUtils(IStorageSystem storage)
 {
     Storage = storage;
 }
Beispiel #20
0
 /// <summary>
 /// Event which is raised whenever the state of a storage system component changes.
 /// </summary>
 /// <param name="sender">Object instance which raised the event.</param>
 /// <param name="component">Component that has changed.</param>
 static void StorageSystem_ComponentStateChanged(IStorageSystem sender, IComponent component)
 {
     Console.WriteLine("Component '{0}' has changed state to '{1}'.", component.Description, component.State.ToString());
 }
Beispiel #21
0
        public SavedServerDataProvider(IStorageSystem storage)
        {
            _storage = storage;

            Load();
        }
Beispiel #22
0
 public ProfileManager(Alex alex, IStorageSystem storage)
 {
     Alex     = alex;
     Storage  = storage;
     Profiles = new Dictionary <string, SavedProfile>();
 }
 public ShellViewModel(IStorageSystem storageSystem)
 {
     _storageSystem = storageSystem;
 }
Beispiel #24
0
 private static void StorageSystem_PackInputFinished(IStorageSystem sender, int source, string inputRequestId, InputResult result, IArticle[] articleList)
 {
     Console.WriteLine("Input request '{0}' of source {1} finished with result '{2}'.", inputRequestId, source, result.ToString());
 }
Beispiel #25
0
 public MCJavaAssetsUtil(IStorageSystem storage)
 {
     _storage = storage;
 }
Beispiel #26
0
 public AudioEngine(IStorageSystem storageSystem)
 {
     StorageSystem = storageSystem;
     StoragePath   = Path.Combine("assets");
 }
Beispiel #27
0
 /// <summary>
 /// Event which is raised whenever the state of a storage system changes.
 /// </summary>
 /// <param name="sender">Object instance which raised the event.</param>
 /// <param name="state">New state of the storage system.</param>
 static void StorageSystem_StateChanged(IStorageSystem sender, ComponentState state)
 {
     Console.WriteLine("Storage system changed state to '{0}'.", state.ToString());
 }