示例#1
0
        private void UpdateControls()
        {
            LabelWord.StringValue = _wordViewModel.Word;

            for (int i = StackViewOpslagsords.Views.Length - 1; i >= 0; i--)
            {
                StackViewOpslagsords.RemoveView(StackViewOpslagsords.Views[i]);
            }

            for (int i = 0; i < _wordViewModel.VariationUrls?.Count; i++)
            {
                var button = new NSButton();
                button.SetButtonType(NSButtonType.OnOff);
                button.BezelStyle = NSBezelStyle.RegularSquare;
                button.Title      = _wordViewModel.VariationUrls[i].Word;

                if (txtLookUp.StringValue.Equals(_wordViewModel.VariationUrls[i].Word, StringComparison.InvariantCultureIgnoreCase))
                {
                    button.State = NSCellStateValue.On;
                }

                button.Tag        = i;
                button.Activated += async delegate {
                    await VariantButtonClicked(button);
                };

                StackViewOpslagsords.AddView(button, NSStackViewGravity.Trailing);
            }

            LabelDefinitions.StringValue   = _wordViewModel.Definitions;
            LabelPronunciation.StringValue = _wordViewModel.Pronunciation;
            LabelEndings.StringValue       = _wordViewModel.Endings;
            LabelExamples.StringValue      = _wordViewModel.Examples;

            if (!string.IsNullOrEmpty(_wordViewModel.Sound))
            {
                ButtonPlaySound.Enabled = true;
                ButtonSaveSound.Enabled = true;
            }
            else
            {
                ButtonPlaySound.Enabled = false;
                ButtonSaveSound.Enabled = false;
            }
        }
示例#2
0
        void ReleaseDesignerOutlets()
        {
            if (ActivityLog != null)
            {
                ActivityLog.Dispose();
                ActivityLog = null;
            }

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

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

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

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

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

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

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

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

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

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

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