53 lines
1.3 KiB
C#
53 lines
1.3 KiB
C#
using System.Collections.Generic;
|
|
using System.Collections.ObjectModel;
|
|
using System.Diagnostics;
|
|
using System.IO;
|
|
using System.Threading.Tasks;
|
|
using Flawless.Abstraction;
|
|
using Flawless.Client.Models;
|
|
using Flawless.Core.Modal;
|
|
using ReactiveUI.SourceGenerators;
|
|
|
|
namespace Flawless.Client.ViewModels.ModalBox;
|
|
|
|
public partial class MergeDialogViewModel : ViewModelBase
|
|
{
|
|
[Reactive] private string _ws;
|
|
|
|
[Reactive] private string _final;
|
|
|
|
[Reactive] private string _leftFile; // Local file
|
|
|
|
[Reactive] private string _rightFile; // Remote file
|
|
|
|
public MergeDialogViewModel(string ws, string final, string fileWorkPath, string leftFile, string rightFile)
|
|
{
|
|
_ws = ws;
|
|
_final = final;
|
|
_leftFile = leftFile;
|
|
_rightFile = rightFile;
|
|
}
|
|
|
|
[ReactiveCommand]
|
|
private async Task RaiseMergeToolsAsync(string fileWorkPath)
|
|
{
|
|
var result = Process.Start($"meld \"{LeftFile}\" \"{RightFile}\"");
|
|
}
|
|
|
|
[ReactiveCommand]
|
|
private Task UseLeftFileAsync()
|
|
{
|
|
return UseFileAsync(LeftFile);
|
|
}
|
|
|
|
[ReactiveCommand]
|
|
private Task UseRightFileAsync()
|
|
{
|
|
return UseFileAsync(RightFile);
|
|
}
|
|
|
|
private async Task UseFileAsync(string path)
|
|
{
|
|
File.Copy(path, _final, true);
|
|
}
|
|
} |