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

            return(msg);
        }
Exemplo n.º 2
0
        private void Progress(string message, int progress)
        {
            _progress = progress;

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

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

            _progress = progress;

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

            Clients.Caller.sendMessage(msg);
        }
Exemplo n.º 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);
        }
Exemplo n.º 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);
            }
        }
Exemplo n.º 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);
            }
        }
Exemplo n.º 7
0
 private ImportProgressMessage Message(string message, int idx)
 {
     var msg = new ImportProgressMessage
     {
         Message = message,
         Progress = (int)10 + (idx + 1) * 90 / ResourceCount
     };
     return msg;
 }