Example #1
0
        public override UserControl[] GetPropertiesControls()
        {
            FilePathControl imgctrl = new FilePathControl()
            {
                Filter = "Images|*.bmp;*.jpg;*.png;*.ico", Value = Image, Title = "Image"
            };
            BoolControl boolctrl = new BoolControl()
            {
                Title = LocalizationManager.Get("State Dependent"), Value = IsStateDependent, Visibility = System.Windows.Visibility.Visible
            };
            ScriptControl control = GetPropertyControl <ScriptControl>();

            control.VerticalAlignment = System.Windows.VerticalAlignment.Stretch;
            control.Commands.Clear();
            foreach (var item in Commands)
            {
                if (item.AdditionalParameters.Count == 0)
                {
                    for (int i = 0; i < 10; i++)
                    {
                        item.AdditionalParameters.Add(new One <string>());
                    }
                }
                control.Commands.Add(new vMixControlButtonCommand()
                {
                    Action = item.Action, Collapsed = item.Collapsed, Input = item.Input, InputKey = item.InputKey, Parameter = item.Parameter, StringParameter = item.StringParameter, AdditionalParameters = item.AdditionalParameters
                });
            }
            return(base.GetPropertiesControls().Concat(new UserControl[] { imgctrl, boolctrl, control }).ToArray());
        }
        public override UserControl[] GetPropertiesControls()
        {
            IntControl periodInt = GetPropertyControl <IntControl>();

            periodInt.Title = LocalizationManager.Get("Update Period");
            periodInt.Value = Period;

            FilePathControl providerPath = GetPropertyControl <FilePathControl>();

            providerPath.Filter = "External Data|*.dll";
            providerPath.Value  = DataProviderPath;
            periodInt.Value     = Period;

            BoolControl loopBool = GetPropertyControl <BoolControl>();

            loopBool.Value = RestartData;
            loopBool.Title = LocalizationManager.Get("Loop Data");
            loopBool.Tag   = "RD";

            var props = base.GetPropertiesControls();

            foreach (var prop in props.OfType <BoolControl>())
            {
                prop.Visibility = Visibility.Collapsed;
            }
            return((new UserControl[] { periodInt, providerPath, loopBool }).Concat(props).ToArray());
        }
Example #3
0
        public FilePathNode(Core.VplControl hostCanvas) : base(hostCanvas)
        {
            AddOutputPortToNode("String", typeof(string));

            FilePathControl filePathControl = new FilePathControl();

            filePathControl.Button.Click += button_Click;

            AddControlToNode(filePathControl);
        }
Example #4
0
 public static IControl Create(
     IEditorFactory editors,
     IAttribute <string> property,
     IObservable <AbsoluteDirectoryPath> projectRoot,
     FileFilter[] fileFilters,
     Text placeholderText = default(Text),
     Text toolTip         = default(Text),
     Text dialogCaption   = default(Text))
 {
     return(Layout.Dock()
            .Right(editors.ExpressionButton(property))
            .Fill(FilePathControl.Create(property.StringValue, projectRoot, fileFilters, placeholderText, toolTip, dialogCaption)));
 }
Example #5
0
        public override UserControl[] GetPropertiesControls()
        {
            IntControl control = GetPropertyControl <IntControl>();

            control.Title = LocalizationManager.Get("Update Period");
            control.Value = Period;

            FilePathControl control1 = GetPropertyControl <FilePathControl>();

            control1.Filter = "External Data|*.dll";
            control1.Value  = DataProviderPath;
            control.Value   = Period;

            BoolControl control2 = GetPropertyControl <BoolControl>();

            control2.Value = RestartData;
            control2.Title = LocalizationManager.Get("Loop Data");
            control2.Tag   = "RD";

            var props = base.GetPropertiesControls();

            props.OfType <BoolControl>().First().Visibility = System.Windows.Visibility.Collapsed;
            return((new UserControl[] { control, control1, control2 }).Concat(props).ToArray());
        }
Example #6
0
        public IControl View(IProject project, IDialog <object> dialog)
        {
            var newFile = Property.Create("");
            var files   = new ListBehaviorSubject <IFilePath>();

            project.FilePath.Select(SketchImportUtils.SketchListFilePath)
            .Where(path => File.Exists(path.NativePath))
            .Select(SketchFilePaths).Do(paths =>
            {
                foreach (var absoluteFilePath in paths)
                {
                    files.OnAdd(absoluteFilePath);
                }
            })
            .Subscribe();

            var addNewSketchFileCommand =
                Command.Create(newFile
                               .CombineLatest(project.RootDirectory,
                                              (pathString, rootDir) =>
            {
                if (!string.IsNullOrWhiteSpace(pathString))
                {
                    var path = FilePath.Parse(pathString);

                    if (_fileSystem.Exists((path as IAbsolutePath) ?? rootDir.Combine((RelativeFilePath)path)))
                    {
                        return(Optional.Some(path));
                    }
                }
                return(Optional.None());
            })
                               .WherePerElement(path => SketchImportUtils.IsSketchFile(path) && !files.Value.Contains(path))
                               .SelectPerElement(
                                   path => (Action)(() =>
            {
                _logger.Info("Adding sketch file to watch: " + path);
                files.OnAdd(path);
                newFile.Write("");
            })));

            var content = Layout.Dock()
                          .Top(
                Layout.StackFromLeft(
                    Label.Create(
                        "Add sketch files to import symbols from",
                        font: Theme.DefaultFont,
                        textAlignment: TextAlignment.Left,
                        color: Theme.DescriptorText))
                .CenterHorizontally())
                          .Top(Spacer.Medium)
                          .Bottom(
                Layout.Dock()
                .Right(
                    AddButton(addNewSketchFileCommand)
                    .SetToolTip("Import sketch symbols from this file")
                    .Center())
                .Right(Spacer.Small)
                .Fill(
                    FilePathControl.Create(
                        newFile,
                        project.RootDirectory,
                        new[] { new FileFilter("Sketch files", SketchImportUtils.SketchExtention) },
                        "Add sketch file",
                        "Enter path of new sketch file to add here, or click browse button",
                        "Open")))
                          .Fill(
                files
                .ToObservableImmutableList()
                .SelectPerElement(
                    filePath =>
            {
                var highlightSketchFileControl = new BehaviorSubject <bool>(false);
                var fileExists = project.RootDirectory.Select(
                    root => File.Exists(FilePath.ParseAndMakeAbsolute(filePath, root).NativePath));

                return(highlightSketchFileControl
                       .DistinctUntilChanged()
                       .CombineLatest(fileExists,
                                      (highlight, exists) =>
                {
                    return Layout.Dock()
                    .Bottom(Spacer.Smaller)
                    .Right(
                        RemoveButton(Command.Enabled(() => { files.OnRemove(files.Value.IndexOf(filePath)); }))
                        .SetToolTip("Remove sketch file from watch list"))
                    .Right(Spacer.Small)
                    .Fill(
                        Label.Create(
                            Observable.Return(filePath.ToString()).AsText(),
                            color: exists?Theme.DefaultText: Theme.ErrorColor,
                            font: Theme.DefaultFont)
                        .CenterVertically()).SetToolTip(exists ? default(Text) : "Can't find file " + filePath)
                    .OnMouse(
                        entered: Command.Enabled(() => { highlightSketchFileControl.OnNext(true); }),
                        exited: Command.Enabled(() => highlightSketchFileControl.OnNext(false)))
                    .WithPadding(new Points(2))
                    .WithBackground(highlight ? Theme.FaintBackground : Theme.PanelBackground);
                })
                       .Switch());
            })
                .StackFromTop()
                .MakeScrollable());

            return
                (ConfirmCancelControl.Create(
                     close: Command.Enabled(() => { _isVisible.OnNext(false); }),
                     confirm: Command.Enabled(
                         () => { project.FilePath.Select(SketchImportUtils.SketchListFilePath).Do(path => { WriteSketchFilePaths(path, files.Value); }).Subscribe(); }),
                     fill: content.WithMediumPadding(), cancel: null, confirmText: null, cancelText: null, confirmTooltip: null)
                 .WithMacWindowStyleCompensation()                        // order of window style compensation and with background is important
                 .WithBackground(Theme.PanelBackground));
        }