public void Connect(object obj) { if (obj is int) { //내부 _SourceType = SubtitleSourceTypes.Internal; _ConnectedSource = obj; } else { //외부 } }
public void Connect(object obj) { if (obj is PropertySet) { var ps = obj as PropertySet; if (ps.ContainsKey("Key")) { object key = ps["Key"]; if (key is int) { //내부 _SourceType = SubtitleSourceTypes.Internal; _ConnectedSource = key; } else { PropertySet options = null; if (ps.ContainsKey("Options")) { options = ps["Options"] as PropertySet; } //외부 _SourceType = SubtitleSourceTypes.External; //키가 URI의 경우 (외부 자막) if (key is string) { _ConnectedSource = ExternalSubtitleSource.CreateExternalSubtitleSourceFromUri(this, key as string, options); } //키가 파일 스트림의 경우 (외부 자막) else if (key is IRandomAccessStream) { _ConnectedSource = ExternalSubtitleSource.CreateExternalSubtitleSourceFromStream(this, key as IRandomAccessStream, null); } } } } }