Beispiel #1
0
        /// <summary>
        /// Initializes a new instance of the <see cref="ManagedDialog" /> class.
        /// </summary>
        public ManagedDialog()
        {
            AvaloniaXamlLoader.Load(this);
            AddHandler(PointerPressedEvent, OnPointerPressed, RoutingStrategies.Tunnel);
            quickLinksRoot = this.FindControl <Control>("QuickLinks");
            filesView      = this.FindControl <Avalonia.Controls.ListBox>("Files");
            var locManager = DIResolver.Get <ILocalizationManager>();

            fileName           = this.FindControl <TextBox>("fileName");
            fileName.Watermark = locManager.GetResource(LocalizationResources.FileDialog.FileName);
            filter             = this.FindControl <ComboBox>("filter");
            var correctingInput = false;

            fileName.PropertyChanged += (sender, args) =>
            {
                if (args.Property != TextBox.TextProperty)
                {
                    return;
                }
                if (correctingInput)
                {
                    return;
                }
                correctingInput = true;
                async Task updateText()
                {
                    await Task.Delay(1);

                    Model.FileName  = Model.FileName.GenerateValidFileName();
                    correctingInput = false;
                }

                updateText().ConfigureAwait(false);
            };
            var showHiddenFiles = this.FindControl <TextBlock>("showHiddenFiles");

            showHiddenFiles.Text = locManager.GetResource(LocalizationResources.FileDialog.ShowHiddenFiles);
            var ok = this.FindControl <Button>("ok");

            ok.Content = locManager.GetResource(LocalizationResources.FileDialog.OK);
            var cancel = this.FindControl <Button>("cancel");
            var name   = this.FindControl <TextBlock>("name");

            name.Text = locManager.GetResource(LocalizationResources.FileDialog.Name);
            var date = this.FindControl <TextBlock>("dateModified");

            date.Text = locManager.GetResource(LocalizationResources.FileDialog.DateModified);
            var type = this.FindControl <TextBlock>("type");

            type.Text = locManager.GetResource(LocalizationResources.FileDialog.Type);
            var size = this.FindControl <TextBlock>("size");

            size.Text      = locManager.GetResource(LocalizationResources.FileDialog.Size);
            cancel.Content = locManager.GetResource(LocalizationResources.FileDialog.Cancel);
        }
        public DisassemblyView()
		{
			InitializeComponent();

            disassemblyList = this.FindControl<ListBox>("disassemblyList");

            disassemblyList.SelectionChanged += (sender, e) =>
            {
                var list = disassemblyList.Items as IList;

                if (list.Count > 0)
                {
                    if (list.Count >= disassemblyList.SelectedIndex + 8)
                    {
                        disassemblyList.ScrollIntoView(list[disassemblyList.SelectedIndex + 8]);
                    }

                    if (disassemblyList.SelectedIndex >= 8)
                    {
                        disassemblyList.ScrollIntoView(list[disassemblyList.SelectedIndex - 8]);
                    }
                }
            };
		}