コード例 #1
0
        public Loader()
        {
            InitializeComponent();

            vm = new LoaderViewModel(this);
            this.DataContext = vm;
        }
コード例 #2
0
        private void ConstructTCSSafeLoaderAndDisplay(Task action, Color loaderColour, Color loaderPopupColour, List <string> reasonsForLoader, Color textColour, int millisecondsBetweenReasons)
        {
            LoaderViewModel loaderWaiting = ConstructLoaderModal(loaderColour, loaderPopupColour, reasonsForLoader, textColour, millisecondsBetweenReasons);

            action.GetAwaiter().OnCompleted(() => Device.BeginInvokeOnMainThread(() => loaderWaiting.SafeCloseModal <LoaderPopupPage>()));
            if (!action.IsCompleted)
            {
                LoaderAttachAndPush(loaderWaiting).SafeFireAndForget();
            }
        }
コード例 #3
0
        private void ConstructLoaderAndDisplay(Task action, Color loaderColour, Color loaderPopupColour, List <string> reasonsForLoader, Color textColour)
        {
            LoaderViewModel loaderWaiting = ConstructLoaderModal(loaderColour, loaderPopupColour, reasonsForLoader, textColour);

            action.GetAwaiter().OnCompleted(() => Device.BeginInvokeOnMainThread(() => loaderWaiting.SafeCloseModal()));
            if (!action.IsCompleted && action.Status != TaskStatus.WaitingForActivation)
            {
                LoaderAttachAndPush(loaderWaiting).SafeFireAndForget();
            }
        }
コード例 #4
0
        public InitializePage(IDialerService dialerService)
        {
            InitializeComponent();

            var model = new LoaderViewModel(dialerService);

            model.Navigation = Navigation;

            BindingContext = model;
        }
コード例 #5
0
        public async Task <IActionResult> UploadFile(LoaderViewModel vm)
        {
            if (vm.File == null || vm.File.Length == 0)
            {
                //await Response.WriteAsync("<script>alert('Nie wybrano pliku!')</script>");
                return(RedirectToAction("Loader", "Home", new { message = "Nie wybrano pliku!" }));
            }

            var user = await _userManager.GetUserAsync(HttpContext.User);

            if (CheckProjectNameAvailability(vm.ProjectName, user))
            {
                //await Response.WriteAsync("<script>alert('Już stworzyłeś projekt o takiej samej nazwie!')</script>");
                return(RedirectToAction("Loader", "Home", new { message = "Już stworzyłeś projekt o takiej samej nazwie!" }));
            }

            if (vm.ProjectName == null || vm.ProjectName == "")
            {
                vm.ProjectName = vm.File.GetFilename().Substring(0, vm.File.GetFilename().Length - 4);
            }

            var path = Path.Combine(Directory.GetCurrentDirectory(), "wwwroot/DoZatwierdzenia/", user.Id + vm.ProjectName + ".stl");

            using (var stream = new FileStream(path, FileMode.Create))
            {
                await vm.File.CopyToAsync(stream);
            }

            if (vm.IsPrivate == null)
            {
                vm.IsPrivate = "false";
            }

            _context.Order.Add(new Order
            {
                Status         = "Przyjęto",
                User           = user,
                UserId         = user.Id,
                UploadDate     = DateTime.Now,
                Private        = vm.IsPrivate.Equals("false"),
                Name           = vm.ProjectName,
                Path           = user.Id + vm.ProjectName + ".stl",
                UserScreenPath = "/images/" + user.Id + vm.ProjectName + "thumb.png"
            });

            _context.SaveChanges();

            var pathForStl = Path.Combine(
                Directory.GetCurrentDirectory(), "wwwroot\\DoZatwierdzenia\\", vm.ProjectName);
            DirectoryInfo d = new DirectoryInfo(pathForStl);

            //ForwardFiles(pathForStl, userOrder.Path);

            return(RedirectToAction("Loader", "Home", new { message = "Pomyślnie dodano projekt." }));
        }//Dominik
コード例 #6
0
        public MainWindow()
        {
            InitializeComponent();
            string mutex_id = @"Global\" + appGuid;

            mutex         = new Mutex(false, mutex_id);
            lm            = new LoaderViewModel(new Loader());
            DataContext   = lm;
            Loaded       += ToolWindow_Loaded;
            Loaded       += CheckMutex;
            this.Closing += this.MainWindow_Closing;
        }
コード例 #7
0
        public MainWindow()
        {
            InitializeComponent();
            NavigationManager.Initialize(this);
            Managers.Screens direction = AccountManager.CurrentUser != null ? Managers.Screens.Main : Managers.Screens.SignIn;
            NavigationManager.Navigate(direction);

            LoaderViewModel vmodel = new LoaderViewModel();

            LoaderManager.Initialize(vmodel);
            DataContext = vmodel;

            Logger.Log("Application started.");
        }
コード例 #8
0
 private async Task LoaderAttachAndPush(LoaderViewModel loaderWaiting)
 {
     var popupModal = AttachViewModel(CreatePopupPage <LoaderPopupPage>(), loaderWaiting);
     await Device.InvokeOnMainThreadAsync(() => s_popupNavigation.PushAsync(popupModal));
 }
コード例 #9
0
 public Loader()
 {
     InitializeComponent();
     viewModel      = new LoaderViewModel();
     BindingContext = viewModel;
 }
コード例 #10
0
 private async Task LoaderAttachAndPush <TPopupPage>(LoaderViewModel loaderWaiting) where TPopupPage : PopupPage, IGenericViewModel <LoaderViewModel>, new()
 {
     var popupModal = AttachViewModel(CreatePopupPage <TPopupPage>(), loaderWaiting);
     await Device.InvokeOnMainThreadAsync(() => s_popupNavigation.PushAsync(popupModal));
 }
コード例 #11
0
 public LoaderView(Guild guildData)
 {
     InitializeComponent();
     DataContext = new LoaderViewModel(guildData);
 }
コード例 #12
0
 public LoadingFileCommand(LoaderViewModel viewModel, MainWindowViewModel mwvm)
 {
     this.loaderViewModel = viewModel;
     this.mwvm            = mwvm;
 }
コード例 #13
0
 public MainWindow()
 {
     DataContext = new LoaderViewModel();
     InitializeComponent();
 }
コード例 #14
0
ファイル: ViewModelBase.cs プロジェクト: tianvan/Loader
 public ViewModelBase()
 {
     _loader = new LoaderViewModel();
 }