Exemplo n.º 1
0
        /// <inheritdoc/>
        public override void SetText(SetTextEventArgs args)
        {
            if (args == null)
            {
                return;
            }

            PSPropertyInfo pi = args.File.Data as PSPropertyInfo;

            if (pi == null)
            {
                args.Result = JobResult.Ignore;
                return;
            }

            try
            {
                object value;
                string text = args.Text.TrimEnd();
                if (pi.TypeNameOfValue.EndsWith("]", StringComparison.Ordinal))
                {
                    ArrayList lines = new ArrayList();
                    foreach (var line in FarNet.Works.Kit.SplitLines(text))
                    {
                        lines.Add(line);
                    }
                    value = lines;
                }
                else
                {
                    value = text;
                }

                A.SetPropertyValue(ItemPath, pi.Name, Converter.Parse(pi, value));
                PropertyPanel.WhenPropertyChanged(ItemPath);
            }
            catch (RuntimeException ex)
            {
                if (args.UI)
                {
                    A.Msg(ex);
                }
            }
        }
Exemplo n.º 2
0
        /// <inheritdoc/>
        public override void UICreateFile(CreateFileEventArgs args)
        {
            if (args == null)
            {
                return;
            }

            // call
            Explorer.CreateFile(args);
            if (args.Result != JobResult.Done)
            {
                return;
            }

            // update that panel if the path is the same
            PropertyPanel that = TargetPanel as PropertyPanel;

            if (that != null && that.Explorer.ItemPath == Explorer.ItemPath)
            {
                that.UpdateRedraw(true);
            }
        }