Beispiel #1
0
        private ImportProgressMessage Message(string message, int idx)
        {
            var msg = new ImportProgressMessage
            {
                Message  = message,
                Progress = (int)10 + (idx + 1) * 90 / ResourceCount
            };

            return(msg);
        }
Beispiel #2
0
        private void Progress(string message, int progress)
        {
            _progress = progress;

            var msg = new ImportProgressMessage
            {
                Message  = message,
                Progress = progress
            };

            Clients.Caller.sendMessage(msg);
        }
Beispiel #3
0
        private void Progress(string message, int progress)
        {

            _progress = progress;

            var msg = new ImportProgressMessage
            {
                Message = message,
                Progress = progress
            };

            Clients.Caller.sendMessage(msg);
        }
Beispiel #4
0
        private void Progress(string message, int progress)
        {
            Trace.TraceInformation($"[{progress}%] {message}");

            _progress = progress;

            var msg = new ImportProgressMessage
            {
                Message  = message,
                Progress = progress
            };

            Clients.Caller.sendMessage(msg);
        }
Beispiel #5
0
        public void LoadData()
        {
            try
            {
                //cleans store and index
                Progress("Cleaning", 0);
                store.Clean();
                index.Clean();

                Progress("Loading data...");
                this.resources = GetExampleData();

                var resarray = resources.ToArray();
                var rescount = resarray.Count();

                for (int x = 0; x <= rescount - 1; x++)
                {
                    //Thread.Sleep(1000);
                    var res = resarray[x];
                    Key key = res.ExtractKey();

                    if (res.Id != null && res.Id != "")
                    {
                        service.Put(key, res);
                    }
                    else
                    {
                        service.Create(key, res);
                    }


                    // Sending message:

                    var msg = new ImportProgressMessage
                    {
                        Message  = "Importing " + res.ResourceType.ToString() + " " + res.Id + "...",
                        Progress = (int)(x + 1) * 100 / rescount
                    };

                    Clients.Caller.sendMessage(msg);
                }

                Progress("Import completed!", 100);
            }
            catch (Exception e)
            {
                Progress("Error: " + e.Message);
            }
        }
Beispiel #6
0
        public void LoadData()
        {
            try
            {
                //cleans store and index
                Progress("Cleaning", 0);
                store.Clean();
                index.Clean();

                Progress("Loading data...");
                this.resources = GetExampleData();

                var resarray = resources.ToArray();
                var rescount = resarray.Count();

                for (int x = 0; x <= rescount - 1; x++)
                {
                    //Thread.Sleep(1000);
                    var res = resarray[x];
                    Key key = res.ExtractKey();

                    if (res.Id != null && res.Id != "")
                    {

                        service.Put(key, res);
                    }
                    else
                    {
                        service.Create(key, res);
                    }

                    // Sending message:

                    var msg = new ImportProgressMessage
                    {
                        Message = "Importing " + res.ResourceType.ToString() + " " + res.Id + "...",
                        Progress = (int)(x + 1) * 100 / rescount
                    };

                    Clients.Caller.sendMessage(msg);
                }

                Progress("Import completed!", 100);
            }
            catch (Exception e)
            {
                Progress("Error: " + e.Message);
            }
        }
Beispiel #7
0
 private ImportProgressMessage Message(string message, int idx)
 {
     var msg = new ImportProgressMessage
     {
         Message = message,
         Progress = (int)10 + (idx + 1) * 90 / ResourceCount
     };
     return msg;
 }