예제 #1
0
        public async Task <DialogResult> ShowDialog(Window window)
        {
            var dialog = new Avalonia.Controls.OpenFileDialog {
                AllowMultiple   = AllowMultiple,
                Directory       = InitialDirectory,
                InitialFileName = FileName,
                Title           = Title,
                Filters         = filters
            };

            var files = await dialog.ShowAsync(window.window);

            FileNames.Clear();
            FileNames.AddRange(files.Select(f => Path.GetFullPath(f)));

            return(FileNames.Count > 0 ? DialogResult.OK : DialogResult.Cancel);
        }
예제 #2
0
        private void ProcessEntry(Entry entry, string outputFolder)
        {
            var file = entry.ProjectFile;
            var type = file.Format;

            if (!Modules.TryGetValue(type, out var module))
            {
                Log.Error($"Module {type} not found for {file.Path} item.");
                return;
            }

            Modules.IModule moduleInstance;
            try
            {
                moduleInstance = module.CreateInstance(new Modules.ModuleInit()
                {
                    FileName       = file.Path,
                    OutputFileName = null,
                    Parameters     = file.Parameters.ToArray(),
                    InputPath      = Project.WorkingDirectory,
                    OutputPath     = outputFolder
                });
            }
            catch (Exception e)
            {
                Log.Error($"Module {type} initialization exception on {file.Path}: {e.Message}");
                return;
            }

            lock (FileNames)
            {
                FileNames.AddRange(moduleInstance.OutputFileNames);
            }

            try
            {
                moduleInstance.Build();
            }
            catch (Exception e)
            {
                moduleInstance.Clean();
                Log.Error($"Module {type} export exception on {file.Path}: {e.Message}");
                return;
            }
        }
예제 #3
0
        /// <summary>
        /// Shows the dialog to the user.
        /// </summary>
        /// <param name="owner">The window that owns this dialog.</param>
        public async Task <DialogResult> ShowDialog(Form owner)
        {
            var dialog = new Modern.WindowKit.Controls.OpenFileDialog {
                AllowMultiple   = AllowMultiple,
                Directory       = InitialDirectory,
                InitialFileName = FileName,
                Title           = Title,
                Filters         = filters
            };

            var files = await dialog.ShowAsync(owner.window);

            FileNames.Clear();

            if (files?.Any() == true)
            {
                FileNames.AddRange(files.Select(f => Path.GetFullPath(f)));
            }

            return(FileNames.Count > 0 ? DialogResult.OK : DialogResult.Cancel);
        }
예제 #4
0
 public LintingResult(params string[] fileNames)
 {
     FileNames.AddRange(fileNames);
 }