Exemplo n.º 1
0
 public IActionResult Processing() {
     var vm = new ProcessingViewModel();
     
     for (int i = 0; i < 1000; i++) {
         var perc = vm.Percentage;
         vm.Percentage = (i * 100) / 1000;
         if(perc != vm.Percentage)
             _chatHubContext.Clients.All.SendAsync("ReceivePercent", "percent: ", vm.Percentage);
     }
     return Ok();
 }
Exemplo n.º 2
0
        public IActionResult Processing()
        {
            var context = Hosting.GetHttpContext();
            int selectedValue;

            int.TryParse(context.Request["taskSelector"], out selectedValue);

            var model = new ProcessingViewModel
            {
                ExampleFileSelector = new ExampleFileSelector
                {
                    Id          = "exampleFileSelector",
                    InitialFile = "JPG Image.jpg",
                    FormWrapped = false
                },
                TaskSelectList = PopulateTaskSelector(selectedValue)
            };

            model.ImagePath = model.ExampleFileSelector.SelectedFile;

            var expression = TaskExpressions[selectedValue];
            var lambda     = expression.Compile();

            model.TaskAction = task =>
            {
                task.ResizeWidth(400);
                lambda(task);
            };

            model.CodeString = string.Format(
                "@this.ImageTag(\"{0}\", {1})",
                model.ExampleFileSelector.SelectedFile.FileName,
                ExpressionStringBuilder.ToString(expression)
                );

            return(View(model));
        }
        public ProcessingControl(string headText, string midText, string dialogIdentifier)
        {
            InitializeComponent();

            DataContext = new ProcessingViewModel(headText, midText, dialogIdentifier);
        }
Exemplo n.º 4
0
        void LoadFile()
        {
            string filename = Utils.GetFile();

            if (filename.Length < 1)
            {
                return;
            }

            FileIsLoading = true;

            try
            {
                worker = new BackgroundWorker();
                worker.WorkerReportsProgress = true;

                DataRepository repository
                    = new DataRepository(filename, DataSourceType.CSV);


                repository.FileOpening += new DataRepository.FileProgressEventHandler(repository_UpdateProgress);
                repository.FileLoading += new DataRepository.FileProgressEventHandler(repository_UpdateProgress);
                repository.FileLoaded  += new DataRepository.FileProgressEventHandler(repository_UpdateProgress);


                worker.DoWork += delegate(object sender, DoWorkEventArgs args)
                {
                    DataTable data = repository.GetAllData();

                    SessionColumnCollection collection = new SessionColumnCollection(data);
                    if (!sessionCollections.Contains(collection))
                    {
                        sessionCollections.Add(collection);
                    }
                    //need a better way to convert this collection to multithreaded oibservable
                    ObservableCollection <ISessionColumn> colClxn = new MultiThreadObservableCollection <ISessionColumn>();
                    foreach (SessionColumn sc in collection.Columns)
                    {
                        colClxn.Add(sc);
                    }
                    collection.Columns = colClxn;
                    if (MainWorkSpace != null)
                    {
                        this.Dispatcher.Invoke(DispatcherPriority.DataBind, new Action
                                               (
                                                   delegate()
                        {
                            MainWorkSpace = new ProcessingViewModel(sessionCollections);
                        }));
                    }

                    FileIsLoading = false;
                };

                worker.RunWorkerAsync();
            }
            catch (Exception e)
            {
                throw e;
            }
        }
Exemplo n.º 5
0
        void ShowProcessingView()
        {
            ProcessingViewModel processingview = new ProcessingViewModel();

            MainWorkSpace = processingview;
        }