예제 #1
0
 private void CodeEditor_Drop(object sender, DragEventArgs e)
 {
     if (e.Data.GetDataPresent("assetFormat"))
     {
         AssetItem asset = e.Data.GetData("assetFormat") as AssetItem;
         try
         {
             CodeEditor.Load(asset.filepath);
         }catch (System.IO.IOException ex)
         {
             WPFHelper.InvalidateControl(this, ex.Message);
             return;
         }
         loadedFile = asset.filepath;
         statusText = "Loaded: " + loadedFile;
     }
 }
예제 #2
0
        private void UserControl_Loaded(object sender, RoutedEventArgs e)
        {
            if (!loaded)
            {
                loaded = true;

                if (DataContext == null)
                {
                    WPFHelper.InvalidateControl(this, "Value Null");
                    return;
                }

                //get the bound object type's sanitized name
                string typetype = (string)DataPropertyTypeDeducer.Instance.Convert((DataContext as PropertyValueConverter.PropertyInfo).PropertyValue, (DataContext as PropertyValueConverter.PropertyInfo).PropertyType, null, null);
                if (typetype == null)
                {
                    DataControlPanel.Content = (this.FindResource("PS_NULLPTR") as DataTemplate).LoadContent();
                    return;
                }

                //find corresponding PS template
                DataTemplate template = null;
                try
                {
                    if (typetype.Contains("Container"))
                    {
                        string underlyingtypename = typetype.Split('|').Last();
                        typetype = "Container";
                    }
                    template = this.FindResource("PS_" + typetype) as DataTemplate;
                }
                catch (System.Windows.ResourceReferenceKeyNotFoundException)
                {
                    //could not find a ps template, try to recurse properties
                    template = this.FindResource("PS_RecurseProps") as DataTemplate;
                    //DataControlPanel.MinHeight = ps.Height;

                    //WPFHelper.InvalidateControl(this, "[" + typetype + "] type inv.");
                }

                DataControlPanel.Content = template.LoadContent();
            }
        }
예제 #3
0
        private void AddItemButton_Click(object sender, RoutedEventArgs e)
        {
            object obj = null;

            if (ci.GetParameters().Count() > 0)
            {
                obj = ci.Invoke(new object[] { new char[] { ' ' } });
            }
            else
            {
                obj = ci.Invoke(null);
            }
            MethodInfo mi = (this.DataContext.GetType().GetMethod("Add"));

            if (mi == null)
            {
                WPFHelper.InvalidateControl(this, "No Add Function on Container");
            }
            object cont = (this.DataContext);

            object[] prms = { obj };
            EditorSubsystemManaged.getInstance().QueueAction(() => { mi.Invoke(cont, prms); });
        }