Skip to content

Commit b2c52cb

Browse files
committed
Revise assembly tree related to eliminate gaps
1 parent 8f64fe8 commit b2c52cb

File tree

18 files changed

+347
-587
lines changed

18 files changed

+347
-587
lines changed
Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
using System;
2+
using System.Collections.Generic;
3+
using System.Windows;
4+
5+
namespace System.Windows
6+
{
7+
/// <summary>
8+
/// Minimal shim of WPF's DataObject for portability.
9+
/// Note: This is intentionally small — only members required by the port are implemented.
10+
/// </summary>
11+
public class DataObject : IDataObject
12+
{
13+
readonly Dictionary<string, object?> storage = new Dictionary<string, object?>();
14+
15+
public DataObject()
16+
{
17+
}
18+
19+
public object? GetData(string format)
20+
{
21+
storage.TryGetValue(format, out var value);
22+
return value;
23+
}
24+
25+
public bool GetDataPresent(string format)
26+
{
27+
return storage.ContainsKey(format);
28+
}
29+
30+
public void SetData(string format, object? data)
31+
{
32+
storage[format] = data;
33+
}
34+
35+
public void SetText(string text)
36+
{
37+
SetData(DataFormats.Text, text);
38+
SetData(DataFormats.UnicodeText, text);
39+
}
40+
41+
public void SetText(string text, TextDataFormat format)
42+
{
43+
// only handle basic CSV or Plain text as Text
44+
SetText(text);
45+
}
46+
47+
// Pasting handler helpers (no-op for Avalonia port; provided for compile-time compatibility)
48+
public static void AddPastingHandler(object target, Action<object, DataObjectPastingEventArgs> handler)
49+
{
50+
// No-op: Avalonia handles paste differently. Handlers in code will not be invoked.
51+
}
52+
53+
public static void AddSettingDataHandler(object target, Action<object, DataObjectSettingDataEventArgs> handler)
54+
{
55+
// No-op placeholder for WPF compatibility.
56+
}
57+
}
58+
}
Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
using System;
2+
3+
namespace System.Windows
4+
{
5+
public sealed class DataObjectPastingEventArgs : EventArgs
6+
{
7+
public IDataObject SourceDataObject { get; }
8+
public bool IsDragDrop { get; }
9+
public string Format { get; }
10+
public bool Cancel { get; private set; }
11+
12+
public DataObjectPastingEventArgs(IDataObject dataObject, bool isDragDrop, string format)
13+
{
14+
SourceDataObject = dataObject;
15+
IsDragDrop = isDragDrop;
16+
Format = format;
17+
}
18+
19+
public void CancelCommand()
20+
{
21+
Cancel = true;
22+
}
23+
}
24+
25+
public sealed class DataObjectSettingDataEventArgs : EventArgs
26+
{
27+
public IDataObject DataObject { get; }
28+
public string Format { get; }
29+
30+
public DataObjectSettingDataEventArgs(IDataObject dataObject, string format)
31+
{
32+
DataObject = dataObject;
33+
Format = format;
34+
}
35+
}
36+
37+
public enum TextDataFormat
38+
{
39+
Text,
40+
UnicodeText,
41+
CommaSeparatedValue,
42+
Html
43+
}
44+
45+
public static class DataFormats
46+
{
47+
public const string Text = "Text";
48+
public const string UnicodeText = "UnicodeText";
49+
public const string FileDrop = "FileDrop";
50+
public const string Html = "HTML";
51+
public const string CommaSeparatedValue = "Csv";
52+
}
53+
}
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
using System;
2+
3+
namespace System.Windows
4+
{
5+
/// <summary>
6+
/// Minimal shim of WPF's <c>IDataObject</c> used by the port.
7+
/// Only implements the members referenced by the ILSpy port.
8+
/// </summary>
9+
public interface IDataObject
10+
{
11+
object? GetData(string format);
12+
13+
bool GetDataPresent(string format);
14+
15+
void SetData(string format, object? data);
16+
}
17+
}

src/ProjectRover/AppShim.cs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,11 @@ internal record ExceptionData(Exception Exception)
1717
}
1818

1919
public Window MainWindow { get; set; } // TODO: proper shim
20+
21+
public static void UnhandledException(Exception exception)
22+
{
23+
// TODO:
24+
}
2025
}
2126
}
2227

Lines changed: 17 additions & 0 deletions
Loading
Lines changed: 13 additions & 0 deletions
Loading
Lines changed: 17 additions & 0 deletions
Loading
Lines changed: 17 additions & 0 deletions
Loading
Lines changed: 13 additions & 0 deletions
Loading

0 commit comments

Comments
 (0)