Beispiel #1
0
    protected void exec(object sender, EventArgs e)
    {
        String query = InputTextView.getText();

        try
        {
            OutputTextView.overriteText(sqlCommonExecuter(query));
            OutputTextView.postscriptText("Query executed.\n");
        }
        catch (Exception exc)
        {
            OutputTextView.postscriptText(exc.Message);
        }
    }
    protected virtual void Preferences_OnActivated(object sender, System.EventArgs e)
    {
        PrefWin Pref = new PrefWin();

        Pref.DebugFile = DebugFile;

        Pref.PipeFont   = PipeTextView.Style.FontDescription.ToString();
        Pref.TextFont   = InputTextView.Style.FontDescription.ToString();
        Pref.ErrorsFont = ErrorsTextView.Style.FontDescription.ToString();

        Pref.WrapText = InputTextView.WrapMode != WrapMode.None;
        Pref.CommandAutoCompletion = commandAutoCompletion;

        try
        {
            if (Pref.Run() == (int)ResponseType.Ok)
            {
                DebugFile = Pref.DebugFile;

                PipeTextView.ModifyFont(Pango.FontDescription.FromString(Pref.PipeFont));
                ArgsEntry.ModifyFont(Pango.FontDescription.FromString(Pref.PipeFont));
                InputTextView.ModifyFont(Pango.FontDescription.FromString(Pref.TextFont));
                OutputTextView.ModifyFont(Pango.FontDescription.FromString(Pref.TextFont));
                ErrorsTextView.ModifyFont(Pango.FontDescription.FromString(Pref.ErrorsFont));

                if (Pref.WrapText)
                {
                    InputTextView.WrapMode  = WrapMode.Word;
                    OutputTextView.WrapMode = WrapMode.Word;
                }
                else
                {
                    InputTextView.WrapMode  = WrapMode.None;
                    OutputTextView.WrapMode = WrapMode.None;
                }

                commandAutoCompletion = Pref.CommandAutoCompletion;

                SaveConfiguration();
            }
        }

        finally
        {
            Pref.Destroy();
        }
    }
Beispiel #3
0
        public void UpdateInputHeight(CGSize newSize)
        {
            // prevent duplication call after change contentSize below
            if (_shouldSkipUpdateInputHeight)
            {
                _shouldSkipUpdateInputHeight = false;
                return;
            }

            _shouldSkipUpdateInputHeight = true;

            InputTextView.ScrollEnabled = newSize.Height >= InputTextViewMaxHeightConstraint.Constant;

            // contentSize is not adjusted correctly when scrollEnabled is changed
            InputTextView.ContentSize = InputTextView.SizeThatFits(InputTextView.Frame.Size);

            InputTextView.InvalidateIntrinsicContentSize();
            InvalidateIntrinsicContentSize();
        }
Beispiel #4
0
        private void OpenAttachPanel()
        {
            Execute.BeginOnUIThread(() =>
            {
                var key = _simpleImagePicker.ViewModel.ImageCacheKey;
                if (key == _previewImageKey)
                {
                    return;
                }

                EditImageContainerHeightConstraint.Constant = 72;
                EditImageContainer.Hidden = false;
                InputTextView.BecomeFirstResponder();
                InvokeTopContainersHeightChangedIfNeeded();
                InvalidateIntrinsicContentSize();

                _previewImageKey = key;

                ImageService.Instance
                .LoadFile(key)
                .DownSampleInDip(60, 60)
                .IntoAsync(AttachedImageView);
            });
        }
    /// <summary>
    /// Configures the application.
    /// </summary>
    private void LoadConfiguration()
    {
        try
        {
            if (!File.Exists(ConfigFile))
            {
                // Configuration file doesn't exist. Create it:

                string configContents =
                    "<Config>" + System.Environment.NewLine +
                    "  <DebugFile>" + applDataFolder + System.IO.Path.DirectorySeparatorChar + "Debug.txt</DebugFile>" + System.Environment.NewLine +
                    "  <TextWrapping>True</TextWrapping>" + System.Environment.NewLine +
                    "  <CmdAutoCompletion>True</CmdAutoCompletion>" + System.Environment.NewLine +
                    "  <PipeFont>FreeMono Bold 10</PipeFont>" + System.Environment.NewLine +
                    "  <TextFont>FreeMono 10</TextFont>" + System.Environment.NewLine +
                    "  <ErrorFont>FreeMono 10</ErrorFont>" + System.Environment.NewLine +
                    "</Config>" + System.Environment.NewLine;

                File.WriteAllText(ConfigFile, configContents);
            }

            // Load the configuration file:

            XmlDocument XmlDoc = new XmlDocument();
            XmlDoc.Load(ConfigFile);
            XmlElement RootElem = XmlDoc["Config"];

            // Configure debugging:

            XmlElement Elem = RootElem["DebugFile"];
            DebugFile = Elem.InnerText;

            // Configure text wrapping:

            Elem = RootElem["TextWrapping"];

            if (Elem.InnerText.ToUpper() == "TRUE")
            {
                InputTextView.WrapMode  = WrapMode.Word;
                OutputTextView.WrapMode = WrapMode.Word;
            }
            else
            {
                InputTextView.WrapMode  = WrapMode.None;
                OutputTextView.WrapMode = WrapMode.None;
            }

            // Configure command auto-completion:

            Elem = RootElem["CmdAutoCompletion"];
            commandAutoCompletion = Elem.InnerText.ToUpper() == "TRUE";

            // Configure fonts:

            string tempStr = LoadFont("PipeFont", RootElem);
            PipeTextView.ModifyFont(Pango.FontDescription.FromString(tempStr));
            ArgsEntry.ModifyFont(Pango.FontDescription.FromString(tempStr));
            InputTextView.ModifyFont(Pango.FontDescription.FromString(LoadFont("TextFont", RootElem)));
            OutputTextView.ModifyFont(Pango.FontDescription.FromString(LoadFont("TextFont", RootElem)));
            ErrorsTextView.ModifyFont(Pango.FontDescription.FromString(LoadFont("ErrorFont", RootElem)));
        }

        catch (Exception)
        {
            throw new PipeWrenchEngineException("Could not create/load app. configuration (" +
                                                ConfigFile + ").");
        }
    }
        void ReleaseDesignerOutlets()
        {
            if (AttachedImageView != null)
            {
                AttachedImageView.Dispose();
                AttachedImageView = null;
            }

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

            if (EditMessageHeaderLabel != null)
            {
                EditMessageHeaderLabel.Dispose();
                EditMessageHeaderLabel = null;
            }
        }
Beispiel #7
0
 public void StartEditing(string originalMessageBody)
 {
     EditingText.Text = originalMessageBody;
     InputTextView.BecomeFirstResponder();
 }