Пример #1
0
        private void ChooseImageClick(object sender, RoutedEventArgs e)
        {
            PropertyNode propNode = (PropertyNode)DataContext;

            string directory  = null;
            var    uriContext = propNode.Services.GetService <IUriContext>();

            if (uriContext != null && uriContext.BaseUri.IsFile)
            {
                directory = Path.GetDirectoryName(uriContext.BaseUri.LocalPath);
            }

            string fileName = propNode.Value as string;

            if (fileName != null && directory != null)
            {
                fileName = Path.Combine(directory, fileName);
            }
            ChooseImageDialog cid = new ChooseImageDialog();

            cid.SelectedFileName = fileName;
            cid.Owner            = WorkbenchSingleton.MainWindow;
            if (cid.ShowDialog() == true)
            {
                fileName = cid.SelectedFileName;
                if (fileName == null)
                {
                    propNode.Reset();
                }
                else
                {
                    propNode.Value = FileUtility.GetRelativePath(directory, fileName);
                }
            }
        }
Пример #2
0
		private void ChooseImageClick(object sender, RoutedEventArgs e)
		{
			PropertyNode propNode = (PropertyNode)DataContext;
			
			string directory = null;
			var uriContext = propNode.Services.GetService<IUriContext>();
			if (uriContext != null && uriContext.BaseUri.IsFile) {
				directory = Path.GetDirectoryName(uriContext.BaseUri.LocalPath);
			}
			
			string fileName = propNode.Value as string;
			if (fileName != null && directory != null) {
				fileName = Path.Combine(directory, fileName);
			}
			ChooseImageDialog cid = new ChooseImageDialog();
			cid.SelectedFileName = fileName;
			cid.Owner = SD.Workbench.MainWindow;
			if (cid.ShowDialog() == true) {
				fileName = cid.SelectedFileName;
				if (fileName == null) {
					propNode.Reset();
				} else {
					propNode.Value = FileUtility.GetRelativePath(directory, fileName);
				}
			}
		}
        private void ChooseImageClick(object sender, RoutedEventArgs e)
        {
            ChooseImageDialog cid = new ChooseImageDialog(PropertyNode);

            cid.ShowActivated = true;
            cid.Show();
        }
		 private void ChooseImageClick(object sender, RoutedEventArgs e)
        {
            ChooseImageDialog cid = new ChooseImageDialog(PropertyNode);
            cid.ShowActivated = true;
            cid.Show();
        }