Пример #1
0
        public ShopViewModel()
        {
            this.GoBackCmd = new Command(async() => {
                await IoC.Get <INavigationService>()
                .GoBackAsync();
            });

            this.ShowDetailCmd = new Command((o) => {
                var d = (GoodsInfo)o;
                IoC.Get <INavigationService>()
                .For <GoodsViewModel>()
                .WithParam(v => v.ID, d.ID)
                .Navigate();
            });

            this.ShowCatalogCmd = new Command(async() => {
                await PopupHelper.PopupAsync <CatalogViewModel>();
            });

            this.GotoPrevCmd = new Command(async() => {
                await this.LoadPrev();
            });

            this.GotoNextCmd = new Command(async() => {
                await this.LoadNext();
            });
        }
Пример #2
0
        private void DownloadIndex(Action <string> onFinished)
        {
            try
            {
                var ec = new FileDownload();

                var pd = new ProgressDialog(this);
                pd.SetMessage(Resources.GetText(Resource.String.Download_LoadingData));
                pd.SetCancelable(false);
                pd.Show();

                ec.OnFinishedAction = (result) =>
                {
                    MainThread.BeginInvokeOnMainThread(() =>
                    {
                        onFinished.Invoke(result);
                        pd.Hide();
                    });
                };
                ec.OnError = (message) =>
                {
                    MainThread.BeginInvokeOnMainThread(() =>
                    {
                        pd.Hide();
                        PopupHelper.ErrorDialog(this, Resource.String.Download_ErrorDownloading, message);
                    });
                };

                ec.Execute(GpxFileProvider.GetIndexUrl());
            }
            catch (Exception ex)
            {
                PopupHelper.ErrorDialog(this, Resource.String.Download_ErrorDownloading, ex.Message);
            }
        }
Пример #3
0
        private void ResetPasswordButton_Click(object sender, EventArgs e)
        {
            const string POPUP_CAPTION = "Сброс пароля";

            var selectedDto = GetSelectedDto();

            if (selectedDto == null)
            {
                return;
            }

            var message = string.Format(@"Сбросить пароль для пользователя ""{0}""?", selectedDto);

            if (!PopupHelper.ShowYesNoDialog(this, message, POPUP_CAPTION))
            {
                return;
            }

            var errorMessage = IoCContainer.Get <ISecurityService>().ResetPassword(selectedDto);

            if (!string.IsNullOrEmpty(errorMessage))
            {
                PopupHelper.ShowError(this, errorMessage, POPUP_CAPTION);
                return;
            }

            var infoMessage =
                string.Format(
                    @"Пароль для пользователя ""{0}"" сброшен. Письмо с новым паролем отправлено на электронную почту пользователя.",
                    selectedDto);

            PopupHelper.ShowInfo(this, infoMessage, POPUP_CAPTION);
        }
Пример #4
0
        public RootViewModel(SimpleContainer container, INavigationService ns)
        {
            this.SubVMs = new List <BaseVM>()
            {
                container.GetInstance <HomeViewModel>(),
                container.GetInstance <OrderCenterViewModel>(),
                container.GetInstance <MyViewModel>()
            };
            this.CurrentVM = this.SubVMs.First();

            this.FlipPosCmd = new Command(o => {
                var pos      = ((string)o).ToInt();
                this.FlipPos = pos;
                this.NotifyOfPropertyChange(() => this.FlipPos);
            });

            this.ChoiceCityCmd = new Command(async() => {
                await PopupHelper.PopupAsync <ChoiceProvinceViewModel>();
            });

            this.ShowMsgCmd = new Command(async() => {
                await ns.NavigateToViewModelAsync <MessageListViewModel>();
            });

            this.City = PropertiesHelper.Get <string>("MyCity") ?? "城市";

            MessagingCenter.Subscribe <ChoiceCityViewModel, string>(this, ChoiceCityViewModel.MESSAGE_KEY, async(vm, city) => {
                this.City = city;
                this.NotifyOfPropertyChange(() => this.City);
                PropertiesHelper.Set("MyCity", this.City);
                await PropertiesHelper.Save();
            });
        }
Пример #5
0
        private void OnUpdateElevation()
        {
            if (Peaks360Lib.Utilities.GpsUtils.IsGPSLocation(_editTextLatitude.Text, _editTextLongitude.Text, _editTextAltitude.Text))
            {
                try
                {
                    if (!TryGetGpsLocation(out var location))
                    {
                        PopupHelper.ErrorDialog(this, Resource.String.EditPoi_WrongFormat);
                        return;
                    }

                    if (TryGetElevation(location, out var altitude))
                    {
                        _editTextAltitude.Text = $"{altitude:F0}";
                    }
                    else
                    {
                        PopupHelper.ErrorDialog(this, Resource.String.EditPoi_AltitudeNotUpdated, Resources.GetText(Resource.String.EditPoi_MissingElevationData));
                    }
                }
                catch (Exception ex)
                {
                    PopupHelper.ErrorDialog(this, Resource.String.EditPoi_AltitudeNotUpdated, ex.Message);
                }
            }
        }
Пример #6
0
 private void onLoadedInternal(Base.ISettings settings)
 {
     this.fadeMsg                     = FindResource("fadeMsg") as Storyboard;
     this.fadeMsg.Completed          += showNextMessage;
     this.WindowStartupLocation       = WindowStartupLocation.Manual;
     this.Dispatcher.ShutdownStarted += saveConfig;
     if (Owner != null)
     {
         Owner.Closing += onOwnerClosing;
     }
     this.mybox.Closed += onUnexpectedlyClosed;
     this.Left          = SystemParameters.WorkArea.Width;
     this.Top           = 0;
     this.Hide();
     if (settings != null)
     {
         var boxSettings    = settings.get(Constant.FloatingboxKey, new WidgetSettings());
         var popMsgSettings = settings.get(Constant.FloatingPopMsgKey, new WidgetSettings());
         boxSettings    = WidgetSettings.match(boxSettings, SystemParameters.WorkArea);
         popMsgSettings = WidgetSettings.match(popMsgSettings, SystemParameters.WorkArea);
         System.Diagnostics.Debug.WriteLine($"Loading location {boxSettings.XOffset},{boxSettings.YOffset}");
         System.Diagnostics.Debug.WriteLine($"Loading location {popMsgSettings.XOffset},{popMsgSettings.YOffset}");
         PopupHelper.SetSettings(mybox, boxSettings);
         PopupHelper.SetSettings(popMsg, popMsgSettings);
     }
     PopupHelper.SetVisible(mybox, true);
 }
Пример #7
0
    public void ReadFromSourceUSBA()
    {
        uint offset = sbc.GetDefaultOffset();
        AutoInjector platformInjector;
#if UNITY_STANDALONE || UNITY_EDITOR
        platformInjector = usbInjector;
#else
        platformInjector = usbaInjector;
#endif
        platformInjector.SetWriteOffset(offset);
        platformInjector.ValidateEnabled = UI_Settings.GetValidateData();
        try
        {
            InjectionResult injectionResult = platformInjector.Read(true);
            if (injectionResult != InjectionResult.Success)
            {
                Debug.Log(injectionResult.ToString());
#if UNITY_STANDALONE || UNITY_EDITOR
                PopupHelper.CreateError(injectionResult.ToString(), 2f);
#endif
            }
        }
        catch (Exception ex)
        {
            Debug.LogError(ex.Message);
            UISB.ConnectedText.text = (ex.Message);
            UISB.SetConnected(false);
#if UNITY_STANDALONE || UNITY_EDITOR
            PopupHelper.CreateError(ex.Message, 2f);
#endif
        }
    }
Пример #8
0
    private Villager2 loadVillagerExternal(int index, bool includeHouses)
    {
        try
        {
            byte[] loaded = CurrentConnection.ReadBytes(CurrentVillagerAddress + (uint)(index * Villager2.SIZE), Villager2.SIZE);

            if (villagerIsNull(loaded))
            {
                return(null);
            }

            // reload all houses
            if (includeHouses)
            {
                loadAllHouses();
            }

            return(new Villager2(loaded));
        }
        catch (Exception e)
        {
            Debug.LogError(e.Message);
            PopupHelper.CreateError(e.Message, 2f);
            return(null);
        }
    }
Пример #9
0
    public void loadVillager(int index)
    {
        try
        {
            byte[] loaded = CurrentConnection.ReadBytes(CurrentVillagerAddress + (uint)(index * Villager.SIZE), Villager.SIZE);

            if (villagerIsNull(loaded))
            {
                return;
            }

            currentlyLoadedVillagerIndex = index;
            loadedVillager = new Villager(loaded);

            // get their house
            byte[] loadedHouse = CurrentConnection.ReadBytes(CurrentVillagerHouseAddress + (uint)(currentlyLoadedVillagerIndex * VillagerHouse.SIZE), VillagerHouse.SIZE);
            loadedVillagerHouse = new VillagerHouse(loadedHouse);

            VillagerToUI(loadedVillager);
        }
        catch (Exception e)
        {
            Debug.LogError(e.Message);
            PopupHelper.CreateError(e.Message, 2f);
        }
    }
Пример #10
0
 private static void AfterWrite(InjectionResult r)
 {
     Debug.Log($"Write result: {r}");
     if (r != InjectionResult.Success)
         if (r != InjectionResult.Same)
             PopupHelper.CreateError($"Write result: {r}", 2f);
 }
Пример #11
0
    private void loadVillagerData()
    {
        try
        {
            string newVillager   = Selector.LastSelectedVillager;
            byte[] villagerDump  = ((TextAsset)Resources.Load("DefaultVillagers/" + newVillager + "V")).bytes;
            byte[] villagerHouse = ((TextAsset)Resources.Load("DefaultVillagers/" + newVillager + "H")).bytes;
            if (villagerDump == null || villagerHouse == null)
            {
                return;
            }

            Villager newV = new Villager(villagerDump);
            newV.SetMemories(loadedVillager.GetMemories());
            newV.CatchPhrase = GameInfo.Strings.GetVillagerDefaultPhrase(newVillager);
            VillagerHouse newVH = new VillagerHouse(villagerHouse);
            newVH.NPC1 = loadedVillagerHouse.NPC1;


            loadedVillager      = newV;
            loadedVillagerHouse = newVH;

            SetCurrentVillager(true);
            TenVillagers[currentlyLoadedVillagerIndex].texture = SpriteBehaviour.PullTextureFromParser(villagerSprites, newVillager);
            VillagerToUI(loadedVillager);
        }
        catch (Exception e)
        {
            Debug.LogError(e.Message);
            PopupHelper.CreateError(e.Message, 2f);
        }
    }
Пример #12
0
    private void setCurrentVillager(bool includeHouse)
    {
        if (currentlyLoadedVillagerIndex == -1)
        {
            return;
        }

        try
        {
            byte[] villager = loadedVillager.Data;
            CurrentConnection.WriteBytes(villager, CurrentVillagerAddress + (uint)(currentlyLoadedVillagerIndex * Villager.SIZE));

            if (includeHouse)
            {
                CurrentConnection.WriteBytes(loadedVillagerHouse.Data, CurrentVillagerHouseAddress + (uint)(currentlyLoadedVillagerIndex * VillagerHouse.SIZE));
            }


            if (UI_ACItemGrid.LastInstanceOfItemGrid != null)
            {
                UI_ACItemGrid.LastInstanceOfItemGrid.PlayHappyParticles();
            }
        }
        catch (Exception e)
        {
            Debug.LogError(e.Message);
            PopupHelper.CreateError(e.Message, 2f);
        }
    }
Пример #13
0
        public override IEnumerable <Wait> RoutineUse(Creature user, object target)
        {
            Consume();
            ShowSkill(user);
            user.VisualPose = user.FlickPose(CreaturePose.Cast, CreaturePose.Stand, 70);
            //TODO: roar?
            //TODO: jump visual, screenshake, screen distort
            yield return(user.WaitSome(50));

            user.VisualPosition = user.SlideJump(user.VisualPosition(), new Vector2(user.X, user.Y) * 16, 16, LerpHelper.Linear, 20);
            yield return(user.WaitSome(20));

            new ScreenShakeRandom(user.World, 6, 30, LerpHelper.Linear);
            new SeismArea(user.World, user.Tiles, 10);
            var            tileSet     = user.Tile.GetNearby(user.Mask.GetRectangle(user.X, user.Y), 6).Shuffle(Random);
            List <Wait>    quakes      = new List <Wait>();
            HashSet <Tile> tiles       = new HashSet <Tile>();
            PopupHelper    popupHelper = new PopupHelper();

            foreach (Tile tile in tileSet.Take(8))
            {
                quakes.Add(Scheduler.Instance.RunAndWait(RoutineQuake(user, tile, 3, tiles, popupHelper)));
            }
            new ScreenFlashLocal(user.World, () => ColorMatrix.Ender(), user.VisualTarget, 60, 150, 100, 50);
            yield return(new WaitAll(quakes));

            popupHelper.Finish();
            yield return(user.WaitSome(20));
        }
Пример #14
0
        void PositionPopup()
        {
            if (disposed)
            {
                return;
            }
            var  newZoomLevel = wpfTextView.ZoomLevel;
            bool updateZoom   = newZoomLevel != oldZoomLevel;

            if (updateZoom)
            {
                oldZoomLevel = newZoomLevel;
                // Make sure it can use the new scale transform
                popup.IsOpen = false;
            }

            var t = GetTriggerLine();

            if (t != null)
            {
                var extent = t.Item1.GetExtendedCharacterBounds(t.Item2);
                popup.HorizontalOffset = extent.Left - wpfTextView.ViewportLeft;
                popup.VerticalOffset   = extent.Bottom - wpfTextView.ViewportTop;
            }

            if (updateZoom)
            {
                PopupHelper.SetScaleTransform(wpfTextView, popup);
            }

            popup.IsOpen = true;
        }
Пример #15
0
        private void OnUpdateElevation()
        {
            if (Peaks360Lib.Utilities.GpsUtils.IsGPSLocation(_editTextLatitude.Text, _editTextLongitude.Text, _editTextAltitude.Text))
            {
                try
                {
                    if (!TryGetGpsLocation(out var location, false))
                    {
                        PopupHelper.ErrorDialog(this, Resource.String.PhotoParameters_SetCameraLocationFirst);
                        return;
                    }

                    if (TryGetElevation(location, out var altitude))
                    {
                        location.Altitude = altitude;
                        UpdateCameraAltitude(location);
                    }
                    else
                    {
                        PopupHelper.ErrorDialog(this, Resource.String.EditPoi_AltitudeNotUpdated, Resources.GetText(Resource.String.EditPoi_MissingElevationData));
                    }
                }
                catch (Exception ex)
                {
                    PopupHelper.ErrorDialog(this, Resource.String.EditPoi_AltitudeNotUpdated, ex.Message);
                }
            }
        }
Пример #16
0
    public void loadVillager(int index)
    {
        try
        {
            byte[] loaded = CurrentConnection.ReadBytes(CurrentVillagerAddress + (uint)(index * Villager2.SIZE), Villager2.SIZE);

            if (villagerIsNull(loaded))
            {
                return;
            }

            // reload all houses
            loadAllHouses();

            currentlyLoadedVillagerIndex = index;
            loadedVillager = new Villager2(loaded);

            VillagerToUI(loadedVillager);
        }
        catch (Exception e)
        {
            Debug.LogError(e.Message);
            PopupHelper.CreateError(e.Message, 2f);
        }
    }
Пример #17
0
        public void OnClick(View v)
        {
            switch (v.Id)
            {
            case Resource.Id.buttonCameraLocationInfo:
                PopupHelper.InfoDialog(this, Resource.String.PhotoParameters_CameraLocationInfo);
                break;

            case Resource.Id.buttonViewDirectionInfo:
                PopupHelper.InfoDialog(this, Resource.String.PhotoParameters_ViewDirectionInfo);
                break;

            case Resource.Id.buttonViewAnglesInfo:
                PopupHelper.InfoDialog(this, Resource.String.PhotoParameters_ViewAnglesInfo);
                break;

            case Resource.Id.buttonLocation:
                OnCameraLocationClicked();
                break;

            case Resource.Id.buttonMap:
                OnOpenMapClicked();
                break;

            case Resource.Id.buttonBearing:
                OnCameraDirectionClicked();
                break;
            }
        }
Пример #18
0
        private void OnSave()
        {
            _item.Name = _editTextName.Text;

            if (!TryGetGpsLocation(out var location))
            {
                PopupHelper.ErrorDialog(this, Resource.String.EditPoi_WrongFormat);
                return;
            }

            _item.Latitude  = location.Latitude;
            _item.Longitude = location.Longitude;
            _item.Altitude  = location.Altitude;
            _item.Category  = _category;
            _item.Country   = _country;
            if (_id == -1)
            {
                Context.Database.InsertItemAsync(_item);
            }
            else
            {
                Context.Database.UpdateItem(_item);
            }

            var resultIntent = new Intent();

            resultIntent.PutExtra("Id", _item.Id);
            SetResult(RESULT_OK, resultIntent);
            Finish();
        }
Пример #19
0
        protected override void OnActivityResult(int requestCode, [GeneratedEnum] Result resultCode, Intent data)
        {
            base.OnActivityResult(requestCode, resultCode, data);
            if (resultCode == PoiSelectActivity.RESULT_OK)
            {
                var id = data.GetLongExtra("Id", 0);

                var selectedPoint = (id == (long)PoiId.CURRENT_LOCATION)
                    ? PoiSelectActivity.GetMyLocationPoi(AppContext)
                    : AppContext.Database.GetItem(id);

                if (requestCode == PoiSelectActivity.REQUEST_SELECT_CAMERADIRECTION)
                {
                    if (!TryGetGpsLocation(out GpsLocation location, false))
                    {
                        PopupHelper.ErrorDialog(this, Resource.String.PhotoParameters_SetCameraLocationFirst);
                    }
                    var bearing = GpsUtils.QuickBearing(location, new GpsLocation(selectedPoint.Longitude, selectedPoint.Latitude, selectedPoint.Altitude));
                    UpdateHeading(bearing);
                }
                else if (requestCode == PoiSelectActivity.REQUEST_SELECT_CAMERALOCATION)
                {
                    var location = new GpsLocation(selectedPoint.Longitude, selectedPoint.Latitude, selectedPoint.Altitude);
                    UpdateCameraLocation(location);
                    UpdateCameraAltitude(location);
                }
            }
        }
Пример #20
0
 private void dragPopMsgOnMouseLButtonDown(object sender, MouseButtonEventArgs e)
 {
     if (e.LeftButton == MouseButtonState.Pressed)
     {
         PopupHelper.dragPopup();
     }
 }
Пример #21
0
    public void GetMoneyValues()
    {
        try
        {
            byte[] bytes;

            //money
            bytes = CurrentConnection.ReadBytes(CurrentMoneyAddress, ENCRYPTIONSIZE);
            currentUtil.LoadBank(bytes);

            //miles
            bytes = CurrentConnection.ReadBytes(CurrentMilesAddress, ENCRYPTIONSIZE * 2);
            currentUtil.LoadMilesNow(bytes); currentUtil.LoadMilesForever(bytes);

            //wallet
            bytes = CurrentConnection.ReadBytes(CurrentWalletAddress, ENCRYPTIONSIZE);
            currentUtil.LoadPouch(bytes);

            //poki
            bytes = CurrentConnection.ReadBytes(OffsetHelper.PokiAddress, ENCRYPTIONSIZE);
            currentUtil.LoadPoki(bytes);

            moneyToUI();
        }
        catch (Exception e)
        {
            Debug.LogError(e.Message);
            PopupHelper.CreateError(e.Message, 2f);
        }
    }
        void reportResults(GraphicsLayerResult result)
        {
            if (!waitedForDoubleClick && !initiatedByTouch)
            {
                identifyTaskResults.Add(result);
                return;
            }
            if (doNotShowResults)
            {
                removeBusyIndicator(); return;
            }
            PendingIdentifies--;

            if (result != null && result.Results != null)
            {
                List <PopupItem> popupItems = PopupHelper.GetPopupItems(result.Results, result.Layer);
                popupItems.ForEach(p => _popupInfo.PopupItems.Add(p));
            }

            removeBusyIndicator();
            if (_popupInfo.PopupItems.Count > 0)
            {
                if (_popupInfo.SelectedIndex < 0)
                {
                    _popupInfo.SelectedIndex = 0;
                }

                PopupHelper.ShowPopup(_popupInfo, clickPoint);
            }
        }
        public void Print()
        {
            PrintableLikelyRepurchases printable = new PrintableLikelyRepurchases(ViewState["LikelyRepurchases"] as IList <LikelyRepurchasesLine>, ViewState["RetentionSchedule"] as RetentionSchedule, QueryString.ViewIDValue);
            string script = PopupHelper.ShowPopup(printable, Server);

            ScriptManager.RegisterClientScriptBlock(this, GetType(), "Popup", script, true);
        }
Пример #24
0
        void OnKeyUp(object sender, KeyEventArgs e)
        {
            switch (e.Key)
            {
            case Key.D:
            {
                if ((Keyboard.Modifiers & (ModifierKeys.Control | ModifierKeys.Alt)) == (ModifierKeys.Control | ModifierKeys.Alt))
                {
                    //TODO: close this on error/timeout
                    var panel = new StackPanel {
                        Orientation = Orientation.Horizontal
                    };
                    panel.Children.Add(new StatisticsPanel {
                            Margin = new Thickness(10)
                        });
                    panel.Children.Add(new ThrottlePanel {
                            Margin = new Thickness(10)
                        });

                    PopupHelper.PopupContent(DialogTitles.ThrottleSettings, panel);
                }
                break;
            }
            }
        }
Пример #25
0
        public override IEnumerable <Wait> RoutineUse(Creature user, object target)
        {
            if (target is Facing facing)
            {
                float centerAngle = GetFacingAngle(facing);
                Consume();

                float startAngle = centerAngle + StartAngle;
                float endAngle   = centerAngle + EndAngle;
                float radius     = Radius;

                float arcLength = (endAngle - startAngle) * radius;
                float arcSpeed  = ArcSpeed;

                List <Wait>    breaths     = new List <Wait>();
                HashSet <Tile> tiles       = new HashSet <Tile>();
                PopupHelper    popupHelper = new PopupHelper();
                for (float slide = 0; slide <= arcLength; slide += arcSpeed)
                {
                    float angle = MathHelper.Lerp(startAngle, endAngle, slide / arcLength);
                    breaths.Add(Scheduler.Instance.RunAndWait(RoutineBreath(user, angle, radius, tiles, popupHelper)));
                    yield return(user.WaitSome(5));
                }
                yield return(new WaitAll(breaths));

                popupHelper.Finish();
                AfterBreath(user, tiles);
            }
        }
Пример #26
0
        public async void OnClick(Android.Views.View v)
        {
            try
            {
                switch (v.Id)
                {
                case Resource.Id.buttonSave:
                    _photodata.Tag = _editTagEditText.Text;
                    Database.UpdateItem(_photodata);
                    _onFinished?.Invoke(Result.Ok);
                    Hide();
                    Dismiss();
                    break;

                case Resource.Id.buttonClose:
                    _onFinished?.Invoke(Result.Canceled);
                    Hide();
                    Dismiss();
                    break;
                }
            }
            catch (Exception ex)
            {
                PopupHelper.ErrorDialog(Context, ex.Message);
            }
        }
Пример #27
0
    public void SetMoneyValues()
    {
        try
        {
            byte[] bytes;

            //money
            bytes = new byte[ENCRYPTIONSIZE];
            currentUtil.Bank.Write(bytes, 0);
            CurrentConnection.WriteBytes(bytes, CurrentMoneyAddress);

            //miles
            bytes = new byte[ENCRYPTIONSIZE * 2];
            currentUtil.MilesNow.Write(bytes, 0); currentUtil.MilesNow.Write(bytes, ENCRYPTIONSIZE);
            CurrentConnection.WriteBytes(bytes, CurrentMilesAddress);

            //wallet
            bytes = new byte[ENCRYPTIONSIZE];
            currentUtil.Pouch.Write(bytes, 0);
            CurrentConnection.WriteBytes(bytes, CurrentWalletAddress);

            if (UI_ACItemGrid.LastInstanceOfItemGrid != null)
            {
                UI_ACItemGrid.LastInstanceOfItemGrid.PlayHappyParticles();
            }
        }
        catch (Exception e)
        {
            Debug.LogError(e.Message);
            PopupHelper.CreateError(e.Message, 2f);
        }
    }
Пример #28
0
        /// <summary>Call this method in Loaded event as the event will be automatically
        /// deregistered when the FrameworkElement has been unloaded. </summary>
        public static void RegisterBackKey(Page page)
        {
            var callback = new TypedEventHandler <CoreDispatcher, AcceleratorKeyEventArgs>(
                delegate(CoreDispatcher sender, AcceleratorKeyEventArgs args)
            {
                if (!args.Handled && args.VirtualKey == VirtualKey.Back &&
                    (args.EventType == CoreAcceleratorKeyEventType.KeyDown ||
                     args.EventType == CoreAcceleratorKeyEventType.SystemKeyDown))
                {
                    var element = FocusManager.GetFocusedElement();
                    if (element is FrameworkElement && PopupHelper.IsInPopup((FrameworkElement)element))
                    {
                        return;
                    }

                    if (element is TextBox || element is PasswordBox || element is WebView)
                    {
                        return;
                    }

                    if (page.Frame.CanGoBack)
                    {
                        args.Handled = true;
                        page.Frame.GoBack();
                    }
                }
            });

            page.Dispatcher.AcceleratorKeyActivated += callback;

            SingleEvent.RegisterEvent(page,
                                      (p, h) => p.Unloaded += h,
                                      (p, h) => p.Unloaded -= h,
                                      (o, a) => { page.Dispatcher.AcceleratorKeyActivated -= callback; });
        }
Пример #29
0
        private void DownloadElevationData(DownloadedElevationData ded)
        {
            var edd = new ElevationDataDownload(new GpsLocation(ded.Longitude, ded.Latitude, 0), ded.Distance);

            var pd = new ProgressDialog(this);

            pd.SetMessage(Resources.GetText(Resource.String.Download_Progress_DownloadingElevationData));
            pd.SetCancelable(false);
            pd.SetProgressStyle(ProgressDialogStyle.Horizontal);
            pd.Max = 100;
            pd.Show();

            edd.OnFinishedAction = (result) =>
            {
                pd.Hide();
                if (!string.IsNullOrEmpty(result))
                {
                    PopupHelper.ErrorDialog(this, result);
                }
                else
                {
                    ded.SizeInBytes = edd.GetSize();
                    AppContext.DownloadedElevationDataModel.UpdateItem(ded);
                    Finish();
                }
            };
            edd.OnProgressChange = (progress) =>
            {
                MainThread.BeginInvokeOnMainThread(() => { pd.Progress = progress; });
                Thread.Sleep(50);
            };

            edd.Execute();
        }
Пример #30
0
        public void Print()
        {
            PrintableInvoiceBatchRepurchases printable = new PrintableInvoiceBatchRepurchases(ViewState["InvoiceBatch"] as InvoiceBatch, ViewState["Repurchases"] as IList <RepurchasesLine>, QueryString.ViewIDValue);
            string script = PopupHelper.ShowPopup(printable, Server);

            ScriptManager.RegisterClientScriptBlock(this, GetType(), "Popup", script, true);
        }
Пример #31
0
        /// <summary>
        ///     Builds the visual tree for the
        ///     <see cref="T:ModernUI.ExtendedToolkit.AutoCompleteBox" /> control
        ///     when a new template is applied.
        /// </summary>
        public override void OnApplyTemplate()
        {
            #if !SILVERLIGHT
            if (TextBox != null)
            {
                TextBox.PreviewKeyDown -= OnTextBoxPreviewKeyDown;
            }
            #endif
            if (DropDownPopup != null)
            {
                DropDownPopup.Closed -= DropDownPopup_Closed;
                DropDownPopup.FocusChanged -= OnDropDownFocusChanged;
                DropDownPopup.UpdateVisualStates -= OnDropDownPopupUpdateVisualStates;
                DropDownPopup.BeforeOnApplyTemplate();
                DropDownPopup = null;
            }

            base.OnApplyTemplate();

            // Set the template parts. Individual part setters remove and add
            // any event handlers.
            Popup popup = GetTemplateChild(ElementPopup) as Popup;
            if (popup != null)
            {
                DropDownPopup = new PopupHelper(this, popup);
                DropDownPopup.MaxDropDownHeight = MaxDropDownHeight;
                DropDownPopup.AfterOnApplyTemplate();
                DropDownPopup.Closed += DropDownPopup_Closed;
                DropDownPopup.FocusChanged += OnDropDownFocusChanged;
                DropDownPopup.UpdateVisualStates += OnDropDownPopupUpdateVisualStates;
            }
            SelectionAdapter = GetSelectionAdapterPart();
            TextBox = GetTemplateChild(AutoCompleteBox.ElementTextBox) as TextBox;
            #if !SILVERLIGHT
            if (TextBox != null)
            {
                TextBox.PreviewKeyDown += OnTextBoxPreviewKeyDown;
            }
            #endif
            Interaction.OnApplyTemplateBase();

            // If the drop down property indicates that the popup is open,
            // flip its value to invoke the changed handler.
            if (IsDropDownOpen && DropDownPopup != null && !DropDownPopup.IsOpen)
            {
                OpeningDropDown(false);
            }
        }