Beispiel #1
0
        /// <summary>
        /// 执行进度条动画
        /// </summary>
        private void SetProgess(MainWindowStatusNotify notify)
        {
            //如果状态栏有正在执行的任务, 标识任务正在执行, 且隐藏清除消息按钮
            if (notify.nowProgress < MainProgressBar.Maximum && !mIsProgressRunning)
            {
                mIsProgressRunning = true;
                ClearStatusBarTextButton.Visibility = Visibility.Collapsed;
                StopTaskButton.Visibility           = Visibility.Visible;
            }

            //如果一个任务已经执行完毕, 则显示清除按钮
            if (notify.nowProgress == MainProgressBar.Maximum && mIsProgressRunning)
            {
                mIsProgressRunning = false;
                ClearStatusBarTextButton.Visibility = Visibility.Visible;
                StopTaskButton.Visibility           = Visibility.Collapsed;
            }

            //标识需要动画才会执行进度条动画
            //if (notify.animateProgress)
            //{
            //MainProgressBar.IsIndeterminate = true;
            Duration        duration        = new Duration(TimeSpan.FromMilliseconds(notify.progressDuration));
            DoubleAnimation doubleanimation = new DoubleAnimation(notify.oldProgress, notify.nowProgress, duration);

            MainProgressBar.BeginAnimation(ProgressBar.ValueProperty, doubleanimation);
            //}
            //else
            //{
            //    //没有动画则直接赋值
            //    MainProgressBar.Dispatcher.Invoke(new Action<DependencyProperty, object>(MainProgressBar.SetValue), DispatcherPriority.Background, ProgressBar.ValueProperty, notify.nowProgress);
            //}
        }
Beispiel #2
0
        // TODO - if modified < created - then the file is very old and likely a copy so can be deleted

        private async void StartButton_Click(object sender, EventArgs e)
        {
            StartButton.Enabled = false;

            MainProgressBar.Text    = null;
            MainProgressBar.Maximum = 1000;
            MainProgressBar.Step    = 1;
            MainProgressBar.Value   = 0;
            MainProgressBar.Refresh();

            try {
                var directories = DirectoriesTextBox.Lines.Where(line => !string.IsNullOrWhiteSpace(line)).ToList();

                var total = Walker.GetFileCountSafe(directories);

                await Walker.WalkAsync(directories);

                var files = await Walker.GetFileDetailsAsync();

                var table = await Walker.GetTableAsync(files);

                MainDataGridView.DataSource = table;
                MainDataGridView.Refresh();

                MainProgressBar.Value = MainProgressBar.Maximum;
            }
            catch (Exception ex)
            {
                SetStatus($"Processing error: {ex.Message}", MessageState.Error);
            }
            StartButton.Enabled = true;
        }
        protected async override void OnDisappearing()
        {
            base.OnDisappearing();
            await MainProgressBar.ProgressTo(0.0, 0, Easing.Linear);

            stopwatch.Stop();
            stopwatch.Reset();
        }
        private async void StopTimerButton_Clicked(object sender, EventArgs e)
        {
            DependencyService.Get <IMessage>().ShortAlert(stopwatch.Elapsed.ToString());
            await MainProgressBar.ProgressTo(0.0, 0, Easing.Linear);

            long timeWorkedMilliS = stopwatch.ElapsedMilliseconds;

            stopwatch.Stop();
            stopwatch.Reset();
            await PopupNavigation.Instance.PushAsync(new CheckEffectivity(timeWorkedMilliS, _shift));
        }
        protected async override void OnAppearing()
        {
            base.OnAppearing();
            stopwatch.Start();
            var  v          = CrossVibrate.Current;
            uint timeToWork = (uint)_shift.MinutesToWork * 60 * 1000;
            await MainProgressBar.ProgressTo(1.0, timeToWork, Easing.Linear);

            stopwatch.Stop();
            stopwatch.Reset();
            DependencyService.Get <IMessage>().LongAlert("Nu har tiden gått ut!");

            v.Vibration(TimeSpan.FromSeconds(1));
        }
Beispiel #6
0
        private async void StartTimerButton_Clicked(object sender, EventArgs e)
        {
            ApiServices apiServices = new ApiServices();

            var list = await apiServices.FindSettingsPauseEmail(Settings.UserName);

            var v = CrossVibrate.Current;

            await MainProgressBar.ProgressTo(1.0, (uint)list.First().MinPauseBeforeActivity *60 *1000, Easing.Linear);

            DependencyService.Get <IMessage>().LongAlert("S**t på pausen!");

            v.Vibration(TimeSpan.FromSeconds(1));
        }
        protected override async void OnAppearing()
        {
            base.OnAppearing();
            await MainProgressBar.ProgressTo(1, 3000, Easing.Linear);


            var postData = "";

            try
            {
                System.Diagnostics.Debug.WriteLine(" Bio PostData " + postData);
                GetOnlineRequest sendrequest  = new GetOnlineRequest("http://mymedbay.com/link.php", "POST", postData);
                string           LoginDetails = sendrequest.GetResponse();
                System.Diagnostics.Debug.WriteLine("Returned Data " + LoginDetails);

                if (LoginDetails[0] == 'h')
                {
                    var requestPulled = LoginDetails.Split('~');
                    SessionStorage.IPPORT     = requestPulled[0];
                    SessionStorage.updateLink = requestPulled[1];
                }
                else
                {
                    await DisplayAlert("Server Error", "Sorry our onlinebanking platform is down at the moment. please try again later", "OK");

                    await MainProgressBar.ProgressTo(1, 1000, Easing.Linear);
                    await DisplayAlert("Alert", "System logging out", "ok");

                    Thread.CurrentThread.Abort();
                }
            }
            catch (Exception n)
            {
                System.Diagnostics.Debug.WriteLine(" Exception Caught" + n.ToString());

                await DisplayAlert("Network Error", " Please Check Your internet connection \n" + n.Message, "OK");

                await MainProgressBar.ProgressTo(1, 1000, Easing.Linear);
                await DisplayAlert("Alert", "System logging out", "ok");

                Thread.CurrentThread.Abort();
            }

            await Navigation.PushModalAsync(new LoginPage());



            // await Navigation.PushModalAsync(new LoginPage());
        }
        private async void Testing()
        {
            test = await QD.GetItemsAsync(1);

            //MainListView.ItemsSource =await Data;
            Question.Text = test.Question;
            OptionA.Text  = test.OptionA;
            OptionB.Text  = test.OptionB;
            OptionC.Text  = test.OptionC;
            OptionD.Text  = test.OptionD;
            await DisplayAlert("MockTest", "Ready when you are...", "Start Test");

            MainLayout.IsVisible = true;
            watch.Start();
            await MainProgressBar.ProgressTo(1, 100000, Easing.Linear);
        }
Beispiel #9
0
        // args.Elapsed.ToString("c") args.End.ToShortTimeString()
        private void OnEstimation(object sender, EstimateEventArgs args)
        {
            if (args.Source != null)
            {
                if (args.Source is FileDetails)
                {
                    var details = (FileDetails)args.Source;

                    SetStatus(details.RelativePath, MessageState.OK);
                }
            }

            Invoke((MethodInvoker) delegate {
                MainProgressBar.Maximum = args.Total;
                MainProgressBar.Value   = args.Counter > MainProgressBar.Maximum ? MainProgressBar.Maximum : args.Counter;
                //MainProgressBar.Value = (int)(args.Percentage * 100);
                MainProgressBar.Refresh();
            });
        }
Beispiel #10
0
        protected override async void OnAppearing()
        {
            //spacingLabel.Text = "";
            //statusLabel.Text = "Updating Content";
            await MainProgressBar.ProgressTo(0.5, 500, Easing.Linear);

            await MainProgressBar.ProgressTo(0.9, 900, Easing.Linear);

            await MainProgressBar.ProgressTo(1, 1000, Easing.Linear);

            if (!string.IsNullOrEmpty(libary.LibName))
            {
                Application.Current.MainPage = new MainTabPage(libary);
            }
            else
            {
                Application.Current.MainPage = new NavigationPage(new PickerPage());
            }
        }
        protected async override void OnAppearing()
        {
            base.OnAppearing();
            DateTime endTime   = new DateTime(_shift.Year, _shift.Month, _shift.Day, _shift.Hour, _shift.Minute, 0);
            DateTime startTime = DateTime.Now;
            TimeSpan span      = endTime.Subtract(startTime);

            var v = CrossVibrate.Current;

            await MainProgressBar.ProgressTo(1.0, (uint)span.Minutes *60 *1000, Easing.Linear);

            DependencyService.Get <IMessage>().LongAlert("Nu börjar arbetspasset!");
            if (_shift.Priority == true)
            {
                DependencyService.Get <IMessage>().LongAlert("Passet är prioriterat");
            }

            v.Vibration(TimeSpan.FromSeconds(1));
        }
        /// <summary>
        /// Animate the MainProgressBar based on the radiobutton selected.
        /// </summary>
        private async Task AnimateMainProgressBarAsync()
        {
            uint   ProgressBarAnimationLength             = 3000;
            Easing SelectedEasingMode                     = Easing.CubicInOut;
            Dictionary <String, Easing> EasingModeOptions = new Dictionary <string, Easing>()
            {
                { "Cubic In", Easing.CubicIn },
                { "Cubic Out", Easing.CubicOut },
                { "Cubic In Out", Easing.CubicInOut },
                { "Sin In", Easing.SinIn },
                { "Sin Out", Easing.SinOut },
                { "Sin In Out", Easing.SinInOut },
                { "Bounce In", Easing.BounceIn },
                { "Bounce Out", Easing.BounceOut },
                { "Spring In", Easing.SpringIn },
                { "Spring Out", Easing.SpringOut },
                { "Linear", Easing.Linear }
            };

            //Update the easing mode according to whichever radiobutton is checked.
            foreach (RadioButton RadLoadOption in GrdLoadModeOptions.Children.OfType <RadioButton>().Where(x => x.IsChecked))
            {
                try
                {
                    SelectedEasingMode = EasingModeOptions[(string)RadLoadOption.Content];
                }
                catch
                {
                    await DisplayAlert("Error", "A non-existent load mode was selected", "Cancel");
                }
            }
            //Start the MainProgressBar animation and update the load count after it's done.
            await MainProgressBar.ProgressTo(1, ProgressBarAnimationLength, SelectedEasingMode);

            await Task.Delay(250);

            MainProgressBar.Progress   = 0;
            MainProgressBarLoadCount  += 1;
            IsMainProgressBarActivated = false;
            LblLoadCount.FormattedText.Spans[1].Text = MainProgressBarLoadCount.ToString();
        }
Beispiel #13
0
        protected override async void OnAppearing()
        {
            base.OnAppearing();
            var showAlert = false;



            mainLabel1.Text = "";
            MainLabel.Text  = "Connecting";
            await MainProgressBar.ProgressTo(0.5, 500, Easing.Linear);

            await MainProgressBar.ProgressTo(0.9, 900, Easing.Linear);

            await MainProgressBar.ProgressTo(1, 1000, Easing.Linear);


            Application.Current.MainPage = new Library.MainTabPage(Lib);



            //MainPage.Appearing();
        }
Beispiel #14
0
        protected override async void OnAppearing()
        {
            base.OnAppearing();
            var showAlert = false;



            mainLabel1.Text = "Eckhart Public Library";
            MainLabel.Text  = "Updating content, please be patient...";
            try
            {
                await dataStore.SyncNewsAsync();

                await MainProgressBar.ProgressTo(0.5, 500, Easing.Linear);

                await dataStore.SyncCalendarAsync();

                await MainProgressBar.ProgressTo(0.9, 900, Easing.Linear);

                //var CalenderEvents = await dataStore.GetCalendarAsync();
                //var NewsModel = await dataStore.GetNewsAsync();
            }
            catch (Exception ex)
            {
                showAlert = true;
            }
            if (showAlert)
            {
                await DisplayAlert("Uh oh :(", "Unable to get locations", "OK");
            }

            await MainProgressBar.ProgressTo(1, 1000, Easing.Linear);


            Application.Current.MainPage = new Library.MainTabPage();
            //MainPage.Appearing();
        }
Beispiel #15
0
        private void LevelTimer_Tick(object sender, EventArgs e)
        {
            if (reset)
            {
                MainProgressBar.Value = 0;
                reset = false;
                MainProgressBar.PerformStep();
            }
            else
            {
                MainProgressBar.PerformStep();
            }

            if (MainProgressBar.Value + MainProgressBar.Step > MainProgressBar.Maximum)
            {
                reset = true;
            }

            if (Scenario.Equals("LoadLevel"))
            {
                LevelTimer.Interval  = rand.Next(1, 3) * 1000;
                MainProgressBar.Step = rand.Next(1, 10);
            }
        }
Beispiel #16
0
 protected async override void OnDisappearing()
 {
     base.OnDisappearing();
     await MainProgressBar.ProgressTo(0, 0, Easing.Linear);
 }
Beispiel #17
0
 public void SetProgress(int P)
 {
     MainProgressBar.EditValue = P;
     MainProgressBar.Refresh();
 }
Beispiel #18
0
 private void button1_Click(object sender, EventArgs e)
 {
     MainTimer.Start();
     MainProgressBar.Increment(10);
     ProgressBarComplete();
 }
 private void ProgressCallback(double progress)
 {
     MainProgressBar.Invoke((Action <double>)(unused => MainProgressBar.Value = (int)(progress * 100)), progress);
 }
Beispiel #20
0
        async void Main(int loadingMs)
        {
            await MainProgressBar.ProgressTo(1, (uint)Math.Max(loadingMs - RELEASE_MS, 0), Easing.SinIn);

            End();
        }
        public async Task Main(int loadingMs)
        {
            await MainProgressBar.ProgressTo(1, (uint)Math.Max(loadingMs - RELEASE_MS, 0), Easing.SinIn);

            await End();
        }
        void ReleaseDesignerOutlets()
        {
            if (AlignXButton != null)
            {
                AlignXButton.Dispose();
                AlignXButton = null;
            }

            if (BrightnessSlider != null)
            {
                BrightnessSlider.Dispose();
                BrightnessSlider = null;
            }

            if (BrightnessToolItem != null)
            {
                BrightnessToolItem.Dispose();
                BrightnessToolItem = null;
            }

            if (CancelToolItem != null)
            {
                CancelToolItem.Dispose();
                CancelToolItem = null;
            }

            if (EditThumbsButton != null)
            {
                EditThumbsButton.Dispose();
                EditThumbsButton = null;
            }

            if (FrameSelectedLabel != null)
            {
                FrameSelectedLabel.Dispose();
                FrameSelectedLabel = null;
            }

            if (FrameSelectSlider != null)
            {
                FrameSelectSlider.Dispose();
                FrameSelectSlider = null;
            }

            if (GraphResetButton != null)
            {
                GraphResetButton.Dispose();
                GraphResetButton = null;
            }

            if (MainGraph != null)
            {
                MainGraph.Dispose();
                MainGraph = null;
            }

            if (MainProgressBar != null)
            {
                MainProgressBar.Dispose();
                MainProgressBar = null;
            }

            if (MainTable != null)
            {
                MainTable.Dispose();
                MainTable = null;
            }

            if (MainTabView != null)
            {
                MainTabView.Dispose();
                MainTabView = null;
            }

            if (MetadataToolItem != null)
            {
                MetadataToolItem.Dispose();
                MetadataToolItem = null;
            }

            if (OpenFileToolItem != null)
            {
                OpenFileToolItem.Dispose();
                OpenFileToolItem = null;
            }

            if (ProcessToolItem != null)
            {
                ProcessToolItem.Dispose();
                ProcessToolItem = null;
            }

            if (Statuslabel != null)
            {
                Statuslabel.Dispose();
                Statuslabel = null;
            }

            if (TabChangeButton != null)
            {
                TabChangeButton.Dispose();
                TabChangeButton = null;
            }

            if (ThumbEditView != null)
            {
                ThumbEditView.Dispose();
                ThumbEditView = null;
            }

            if (ThumbViewGraph != null)
            {
                ThumbViewGraph.Dispose();
                ThumbViewGraph = null;
            }

            if (ThumbViewList != null)
            {
                ThumbViewList.Dispose();
                ThumbViewList = null;
            }

            if (YToEndButton != null)
            {
                YToEndButton.Dispose();
                YToEndButton = null;
            }

            if (YToStartButton != null)
            {
                YToStartButton.Dispose();
                YToStartButton = null;
            }
        }
        public async Task End()
        {
            await MainProgressBar.ScaleYTo(0, RELEASE_MS, Easing.SinIn);

            await PopupNavigation.Instance.PopAsync(false);
        }