Пример #1
0
 /// <summary>
 /// Set the ToolTip when mouse move.
 /// </summary>
 /// <param name="sender">Canvas from grasshopper canvas.</param>
 /// <param name="e">CanvasMouseEvent</param>
 protected void SetToolTip(GH_Canvas sender, GH_CanvasMouseEvent e)
 {
     if (Tips == null)
     {
         return;
     }
     if (pivot == e.ControlLocation)
     {
         if (stopwatch.IsRunning && stopwatch.ElapsedMilliseconds > this.TipsRelay)
         {
             if (!showed)
             {
                 Point location = new Point(e.ControlLocation.X + 30, e.ControlLocation.Y - 30);
                 tip.Show(LanguagableComponent.GetTransLation(Tips), sender, location, this.TipsRelay);
                 showed = true;
             }
         }
         else
         {
             stopwatch.Start();
         }
     }
     else
     {
         showed = false;
         tip.Hide(sender);
         pivot = e.ControlLocation;
     }
 }
Пример #2
0
        protected override void LanguageChanged()
        {
            #region Top Tree Translate
            WindowTitle.Text     = LanguagableComponent.GetTransLation(new string[] { "Param Settings Window", "参数设定窗口" });
            FilterButton.ToolTip = LanguagableComponent.GetTransLation(new string[] { "Click to add the components selected on the canvas to list.", "点击以将在画布中选中的运算器添加到列表当中" });

            HintAssist.SetHint(SearchBox, new Label()
            {
                Content             = LanguagableComponent.GetTransLation(new string[] { "Search", "搜索" }),
                HorizontalAlignment = HorizontalAlignment.Center,
                VerticalAlignment   = VerticalAlignment.Center
            });
            #endregion

            #region Major Box
            EditColumn.Header         = LanguagableComponent.GetTransLation(new string[] { "Edit", "编辑" });
            TypeNameColumn.Header     = LanguagableComponent.GetTransLation(new string[] { "Type Name", "类型名称" });
            TypeFullNameColumn.Header = LanguagableComponent.GetTransLation(new string[] { "Type FullName", "类型全名" });
            AssemNameColumn.Header    = LanguagableComponent.GetTransLation(new string[] { "Assembly Name", "类库名称" });
            AssemIdColumn.Header      = LanguagableComponent.GetTransLation(new string[] { "Assembly Guid", "类库全局唯一标识符(Guid)" });

            FirstExpenderName.Text     = LanguagableComponent.GetTransLation(new string[] { "Filter", "过滤器" });
            SecondExpenderName.ToolTip = LanguagableComponent.GetTransLation(new string[] { "Column Visibility", "列可视性" });
            #endregion

            #region B0ttom Four Translate
            FileOption.ToolTip      = LanguagableComponent.GetTransLation(new string[] { "File Option", "文件选项" });
            AsDefaultButton.ToolTip = LanguagableComponent.GetTransLation(new string[] { "Click to save as template.", "点击以保存一个模板。" });
            ImportButton.ToolTip    = LanguagableComponent.GetTransLation(new string[] { "Click to import a file.", "点击以导入一个文件。" });
            ExportButton.ToolTip    = LanguagableComponent.GetTransLation(new string[] { "Click to export a file.", "点击以导出一个文件。" });

            CancelButton.ToolTip = LanguagableComponent.GetTransLation(new string[] { "Click to cancel the changes and close this window.", "单击以取消修改,并关闭此窗口。" });
            OKButton.ToolTip     = LanguagableComponent.GetTransLation(new string[] { "Click to comfirm the change and close the window.", "单击以确认修改并关闭窗口。" });
            #endregion
        }
        private void ImportButton_Click(object sender, RoutedEventArgs e)
        {
            System.Windows.Forms.OpenFileDialog openFileDialog = new System.Windows.Forms.OpenFileDialog();
            openFileDialog.Title = LanguagableComponent.GetTransLation(new string[] { "Select a template", "选择一个模板" });


            openFileDialog.Filter = "*.txt|*.txt";


            openFileDialog.FileName = string.Empty;


            openFileDialog.Multiselect = false;


            openFileDialog.RestoreDirectory = true;


            if (openFileDialog.ShowDialog() == System.Windows.Forms.DialogResult.OK)
            {
                string path   = openFileDialog.FileName;
                string result = Owner.Readtxt(path);
                Owner.UpdateAllProxy();
                SetShowProxy(Owner.AllProxy);

                MessageBox.Content       = result;
                MessageSnackBar.IsActive = true;
            }
        }
Пример #4
0
        protected override void LanguageChanged()
        {
            #region Top Tree Translate
            WindowTitle.Text = LanguagableComponent.GetTransLation(new string[] { "Select one component", "选择一个运算器" });
            HintAssist.SetHint(SearchBox, new Label()
            {
                Content             = LanguagableComponent.GetTransLation(new string[] { "Search", "搜索" }),
                HorizontalAlignment = HorizontalAlignment.Center,
                VerticalAlignment   = VerticalAlignment.Center
            });
            CancelButton.ToolTip = LanguagableComponent.GetTransLation(new string[] { "Click to cancel the changes and close this window.", "单击以取消修改,并关闭此窗口。" });
            OKButton.ToolTip     = LanguagableComponent.GetTransLation(new string[] { "Click to comfirm the change and close the window.", "单击以确认修改并关闭窗口。" });

            #endregion

            #region Major Box
            IconColumn.Header        = LanguagableComponent.GetTransLation(new string[] { "Icon", "图标" });
            FullNameColumn.Header    = LanguagableComponent.GetTransLation(new string[] { "FullName", "全名" });
            CategoryColumn.Header    = LanguagableComponent.GetTransLation(new string[] { "Category", "类别" });
            SubcategoryColumn.Header = LanguagableComponent.GetTransLation(new string[] { "Subcategory", "子类别" });
            ExposureColumn.Header    = LanguagableComponent.GetTransLation(new string[] { "Exposure", "分栏" });
            GuidColumn.Header        = LanguagableComponent.GetTransLation(new string[] { "Guid", "全局唯一标识符(Guid)" });

            FirstExpenderName.Text = LanguagableComponent.GetTransLation(new string[] { "Filter", "过滤器" });
            #endregion
        }
        internal void WindowSwitchControl_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            if (MajorGrid == null || ButtonPanel == null)
            {
                return;
            }

            MajorGrid.Children.Clear();
            ButtonPanel.Children.Clear();
            switch (SelectionBox.SelectedIndex)
            {
            case 0:
                #region Add major
                ColorPicker color = new ColorPicker()
                {
                    Color = this.WireColor
                };
                MajorGrid.Children.Add(color);
                #endregion

                #region Add Button
                ButtonPanel.Children.Add(CreateARespondIconButton(PackIconKind.Refresh, System.Drawing.Color.DarkRed,
                                                                  (x, y) => { this.SetWireColor(ColorExtension.ConvertToMediaColor(this._wireColor)); this._proxy.Owner.ExpireSolution(true); },
                                                                  LanguagableComponent.GetTransLation(new string[] { "Reset", "重置" })));

                ButtonPanel.Children.Add(CreateARespondIconButton(PackIconKind.Refresh, System.Drawing.Color.DimGray,
                                                                  (x, y) => { this.SetWireColor(color); this._proxy.Owner.ExpireSolution(true); },
                                                                  LanguagableComponent.GetTransLation(new string[] { "Refresh", "刷新" })));

                SelectionBox.SelectionChanged += (x, y) => { this.SetWireColor(color); };
                OKButton.Click += (x, y) => { this.SetWireColor(color); };
                #endregion
                break;

            case 1:
                #region Add major
                MajorGrid.Children.Add(CreateDataGrid(true));
                #endregion

                #region Add Button
                IOControlButton(true);
                #endregion
                break;

            case 2:
                #region Add major
                MajorGrid.Children.Add(CreateDataGrid(false));
                #endregion

                #region Add Button
                IOControlButton(false);
                #endregion
                break;

            default:
                throw new ArgumentOutOfRangeException("selectedindex", "index is out of range.");
            }
        }
Пример #6
0
        /// <summary>
        /// Need Feed Back!
        /// </summary>
        /// <param name="path"></param>
        public string Readtxt(string path)
        {
            normalExceptionGuid = new List <Guid>();
            pluginExceptionGuid = new List <Guid>();

            if (path == null)
            {
                return(null);
            }

            int succeedCount = 0;
            int failCount    = 0;

            IO_Helper.ReadFileInLine(path, (str, index) =>
            {
                string[] strs = str.Split(',');
                foreach (var guid in strs)
                {
                    if (guid != "")
                    {
                        try
                        {
                            Guid uid = new Guid(guid);
                            switch (index)
                            {
                            case 0:
                                if (!normalExceptionGuid.Contains(uid))
                                {
                                    normalExceptionGuid.Add(uid);
                                }
                                break;

                            case 1:
                                if (!pluginExceptionGuid.Contains(uid))
                                {
                                    pluginExceptionGuid.Add(uid);
                                }
                                break;
                            }
                            succeedCount++;
                        }
                        catch
                        {
                            failCount++;
                        }
                    }
                }
            });

            string all = succeedCount.ToString() + LanguagableComponent.GetTransLation(new string[] { " data imported successfully!", "个数据导入成功!" });

            if (failCount > 0)
            {
                all += "\n" + failCount.ToString() + LanguagableComponent.GetTransLation(new string[] { " data imported failed!", "个数据导入失败!" });
            }
            return(all);
        }
 private void DataGridPropertyChange()
 {
     if (DataGridCheckBox != null)
     {
         bool IsNormal = WindowSwitchControl.SelectedIndex == 0;
         ((Label)DataGridCheckBox.Header).Content = IsNormal ? LanguagableComponent.GetTransLation(new string[] { "Normal", "常规项" }) : LanguagableComponent.GetTransLation(new string[] { "Plugin", "插件项" });
         DataGridCheckBox.Binding = new Binding(IsNormal ? "IsExceptNormal" : "IsExceptPlugin");
     }
 }
Пример #8
0
        public static void CreateNewObject(IGH_DocumentObject obj, IGH_Param target, bool isInputSide, int index = 0, float leftMove = 100, string init = null)
        {
            if (obj == null)
            {
                return;
            }

            PointF comRightCenter = new PointF(target.Attributes.Bounds.Left + (isInputSide ? -leftMove:(leftMove + target.Attributes.Bounds.Width)),
                                               target.Attributes.Bounds.Top + target.Attributes.Bounds.Height / 2);

            if (obj is GH_Component)
            {
                GH_Component com = obj as GH_Component;

                CanvasRenderEngine.AddAObjectToCanvas(com, comRightCenter, false, init);

                if (isInputSide)
                {
                    target.AddSource(com.Params.Output[index]);
                }
                else
                {
                    com.Params.Input[index].AddSource(target);
                }
                //com.Params.Output[outIndex].Recipients.Add(target);

                target.OnPingDocument().NewSolution(false);
            }
            else if (obj is IGH_Param)
            {
                IGH_Param param = obj as IGH_Param;

                CanvasRenderEngine.AddAObjectToCanvas(param, comRightCenter, false, init);

                if (isInputSide)
                {
                    target.AddSource(param);
                }
                else
                {
                    param.AddSource(target);
                }

                target.OnPingDocument().NewSolution(false);
            }
            else
            {
                target.AddRuntimeMessage(GH_RuntimeMessageLevel.Error, LanguagableComponent.GetTransLation(new string[]
                {
                    "The added object is not a Component or Parameters!", "添加的对象不是一个运算器或参数!",
                }));
            }
        }
Пример #9
0
        private void DialogHost_DialogOpened(object sender, MaterialDesignThemes.Wpf.DialogOpenedEventArgs eventArgs)
        {
            IndexTextBox.Text       = null;
            ActiveBorder.Visibility = Visibility.Visible;
            this.ComponentName.Text = _selectedProxy.FullName;
            System.Drawing.Bitmap bitmap = CanvasRenderEngine.GetObjectBitmap(_selectedProxy.CreateObejct(), this._isInput, out _);
            ShowcaseImage.Source = CanvasRenderEngine.BitmapToBitmapImage(bitmap);

            this.DialogCancelButton.Content = LanguagableComponent.GetTransLation(new string[] { "CANCEL", "取消" });
            this.DialogFinishButton.Content = LanguagableComponent.GetTransLation(new string[] { "ACCEPT", "接受" });
            HintAssist.SetHint(this.IndexTextBox, _isInput ? LanguagableComponent.GetTransLation(new string[] { "Output Index", "输出端索引" }) :
                               LanguagableComponent.GetTransLation(new string[] { "Input Index", "输入端索引" }));
        }
        private void IOControlButton(bool isInput)
        {
            ButtonPanel.Children.Add(CreateARespondIconButton(PackIconKind.Plus, System.Drawing.Color.LightSeaGreen,
                                                              (x, y) => { new SelectOneParamWindow(_paramOwner, isInput, _proxy)
                                                                          {
                                                                              Owner = this
                                                                          }.Show();
                                                                          ActiveBorder.Visibility  = Visibility.Visible;
                                                                          this.IsEnabled           = false;
                                                                          MessageBox.Content       = LanguagableComponent.GetTransLation(new string[] { "Please finish the child window first.", "请先完成子窗口。" });
                                                                          MessageSnackBar.IsActive = true; },
                                                              LanguagableComponent.GetTransLation(new string[] { "Add", "添加" })));

            ButtonPanel.Children.Add(CreateARespondIconButton(PackIconKind.Minus, System.Drawing.Color.DarkRed,
                                                              (x, y) =>
            {
                if (this.MajorGrid.Children.Count == 0)
                {
                    return;
                }
                if (!(this.MajorGrid.Children[0] is DataGrid))
                {
                    return;
                }
                DataGrid grid = this.MajorGrid.Children[0] as DataGrid;
                List <AddProxyParams> restProxies = new List <AddProxyParams>();
                for (int i = 0; i < grid.Items.Count; i++)
                {
                    DataGridRow ObjRow = (DataGridRow)(grid.ItemContainerGenerator.ContainerFromIndex(i));
                    if (ObjRow != null)
                    {
                        if (!ObjRow.IsSelected)
                        {
                            restProxies.Add(isInput ? InputProxy[i] : OutputProxy[i]);
                        }
                    }
                }

                if (isInput)
                {
                    InputProxy       = restProxies.ToArray();
                    grid.ItemsSource = InputProxy;
                }
                else
                {
                    OutputProxy      = restProxies.ToArray();
                    grid.ItemsSource = OutputProxy;
                }
            },
                                                              LanguagableComponent.GetTransLation(new string[] { "Remove", "删除" })));
        }
Пример #11
0
 private void DialogHost_DialogOpened(object sender, MaterialDesignThemes.Wpf.DialogOpenedEventArgs eventArgs)
 {
     ActiveBorder.Visibility = Visibility.Visible;
     HintAssist.SetHint(DialogSelect, new Label()
     {
         Content             = LanguagableComponent.GetTransLation(new string[] { "Select Mode", "选择模式" }),
         HorizontalAlignment = HorizontalAlignment.Center,
         VerticalAlignment   = VerticalAlignment.Center
     });
     ColorMode.Content    = LanguagableComponent.GetTransLation(new string[] { "Wire Color", "连线颜色" });
     InputMode.Content    = LanguagableComponent.GetTransLation(new string[] { "Input Control", "输入控制项" });
     OutputMode.Content   = LanguagableComponent.GetTransLation(new string[] { "Output Control", "输出控制项" });
     DialogAccept.Content = LanguagableComponent.GetTransLation(new string[] { "ACCEPT", "接受" });
 }
        private DataGrid CreateDataGrid(bool isInput)
        {
            DataGrid dataGrid = new DataGrid()
            {
                SelectionUnit       = DataGridSelectionUnit.FullRow,
                CanUserSortColumns  = true,
                SelectionMode       = DataGridSelectionMode.Extended,
                AutoGenerateColumns = false,
            };

            DataGridAssist.SetCellPadding(dataGrid, new Thickness(4, 2, 2, 2));

            #region Add a iconColumn
            DataGridTemplateColumn iconColumn = new DataGridTemplateColumn()
            {
                Header      = LanguagableComponent.GetTransLation(new string[] { "Icon", "图标" }),
                MinWidth    = 24,
                CanUserSort = false,
            };
            FrameworkElementFactory spFactory = new FrameworkElementFactory(typeof(Image));
            spFactory.SetBinding(Image.SourceProperty, new Binding("ShowIcon"));
            spFactory.SetValue(Image.HorizontalAlignmentProperty, HorizontalAlignment.Center);
            spFactory.SetValue(Image.MaxHeightProperty, 24.0);
            spFactory.SetValue(Image.MaxWidthProperty, 24.0);
            iconColumn.CellTemplate = new DataTemplate()
            {
                DataType   = typeof(AddProxyParams),
                VisualTree = spFactory,
            };
            dataGrid.Columns.Add(iconColumn);
            #endregion

            #region Add other column
            dataGrid.Columns.Add(GetATextColumn("Name", LanguagableComponent.GetTransLation(new string[] { "Name", "名称" })));
            string indexHeader = isInput ? LanguagableComponent.GetTransLation(new string[] { "Input Index", "输入端序号" }) :
                                 LanguagableComponent.GetTransLation(new string[] { "Output Index", "输出端序号" });
            dataGrid.Columns.Add(GetATextColumn("Index", indexHeader));
            dataGrid.Columns.Add(GetATextColumn("Category", LanguagableComponent.GetTransLation(new string[] { "Category", "类别" })));
            dataGrid.Columns.Add(GetATextColumn("Subcategory", LanguagableComponent.GetTransLation(new string[] { "Subcategory", "子类别" })));
            dataGrid.Columns.Add(GetATextColumn("Exposure", LanguagableComponent.GetTransLation(new string[] { "Exposure", "分栏" })));
            dataGrid.Columns.Add(GetATextColumn("Guid", LanguagableComponent.GetTransLation(new string[] { "Guid", "全局唯一标识符(Guid)" })));
            #endregion

            dataGrid.ItemsSource = isInput ? InputProxy : OutputProxy;
            return(dataGrid);
        }
        private void ExportButton_Click(object sender, RoutedEventArgs e)
        {
            System.Windows.Forms.SaveFileDialog saveFileDialog = new System.Windows.Forms.SaveFileDialog();

            saveFileDialog.Title    = LanguagableComponent.GetTransLation(new string[] { "Set a Paht", "设定一个路径" });
            saveFileDialog.Filter   = "*.txt|*.txt";
            saveFileDialog.FileName = "Infoglasses_Default";
            saveFileDialog.SupportMultiDottedExtensions = false;
            saveFileDialog.RestoreDirectory             = true;

            if (saveFileDialog.ShowDialog() == System.Windows.Forms.DialogResult.OK)
            {
                string path = saveFileDialog.FileName;
                MessageBox.Content       = Owner.Writetxt(path);
                MessageSnackBar.IsActive = true;
            }
        }
Пример #14
0
        public override string GetValue(out bool isNull)
        {
            GH_ParamAccess access = GH_ParamAccess.item;
            string         result;

            if (ParamControlHelper.GetData(this, out access, out result))
            {
                this.Access = access;
                isNull      = false;
                return(result);
            }
            else
            {
                this.Access = access;
                isNull      = true;
                return(LanguagableComponent.GetTransLation(new string[] { "Click Me To Set!", "点我以设置!" }));
            }
        }
        protected override void LanguageChanged()
        {
            #region Top Tree Translate
            ColorMode.Content  = LanguagableComponent.GetTransLation(new string[] { "Wire Color", "连线颜色" });
            InputMode.Content  = LanguagableComponent.GetTransLation(new string[] { "Input Control", "输入控制项" });
            OutputMode.Content = LanguagableComponent.GetTransLation(new string[] { "Output Control", "输出控制项" });
            #endregion

            #region Major Box
            WindowSwitchControl_SelectionChanged(null, null);
            #endregion

            #region B0ttom Four Translate

            CancelButton.ToolTip = LanguagableComponent.GetTransLation(new string[] { "Click to cancel the changes and close this window.", "单击以取消修改,并关闭此窗口。" });
            OKButton.ToolTip     = LanguagableComponent.GetTransLation(new string[] { "Click to comfirm the change and close the window.", "单击以确认修改并关闭窗口。" });
            #endregion
        }
Пример #16
0
        private void IndexTextBox_TextChanged(object sender, TextChangedEventArgs e)
        {
            DialogFinishButton.IsEnabled = true;
            SelectedMessage.Text         = SelectedParam.Text = null;
            System.Drawing.Bitmap bitmap;

            SelectedMessage.Foreground = new SolidColorBrush(ColorExtension.ConvertToMediaColor(System.Drawing.Color.DimGray));

            byte index;

            if (byte.TryParse(IndexTextBox.Text, out index))
            {
                IGH_Param dataType;
                bitmap = CanvasRenderEngine.GetObjectBitmap(_selectedProxy.CreateObejct(), this._isInput, out dataType, index);
                if (bitmap != null)
                {
                    ShowcaseImage.Source = CanvasRenderEngine.BitmapToBitmapImage(bitmap);
                    SelectedParam.Text   = $"{dataType.Name} [{dataType.Type.Name}]";
                    if (this._proxy.TypeFullName != dataType.Type.FullName)
                    {
                        SelectedMessage.Text      += LanguagableComponent.GetTransLation(new string[] { "Data Type is not the Same!", "数据类型并不一致!" });
                        SelectedMessage.Foreground = new SolidColorBrush(ColorExtension.ConvertToMediaColor(System.Drawing.Color.DarkOrange));
                    }
                }
                else
                {
                    bitmap = CanvasRenderEngine.GetObjectBitmap(_selectedProxy.CreateObejct(), this._isInput, out _);
                    SelectedMessage.Text         = LanguagableComponent.GetTransLation(new string[] { "Input data is out of range!", "输入数据超出索引阈值!" });
                    SelectedMessage.Foreground   = new SolidColorBrush(ColorExtension.ConvertToMediaColor(System.Drawing.Color.DarkRed));
                    DialogFinishButton.IsEnabled = false;
                }
            }
            else
            {
                bitmap = CanvasRenderEngine.GetObjectBitmap(_selectedProxy.CreateObejct(), this._isInput, out _);
                SelectedMessage.Text         = LanguagableComponent.GetTransLation(new string[] { "Please input a number between 0 - 255!", "请输入一个0 - 255的数值!" });
                SelectedMessage.Foreground   = new SolidColorBrush(ColorExtension.ConvertToMediaColor(System.Drawing.Color.DarkRed));
                DialogFinishButton.IsEnabled = false;
            }
            ShowcaseImage.Source = CanvasRenderEngine.BitmapToBitmapImage(bitmap);
            this._paramIndex     = index;
        }
Пример #17
0
        public ComTypeInfo(IGH_DocumentObject obj)
        {
            this.Category    = obj.HasCategory ? obj.Category : LanguagableComponent.GetTransLation(new string[] { "<Unnamed Category>", "<未命名类别>" });
            this.Subcategory = obj.HasSubCategory ? obj.SubCategory : LanguagableComponent.GetTransLation(new string[] { "<Unnamed Subcategory>", "<未命名子类>" });
            this.Name        = obj.Name;
            this.Description = obj.Description;
            #region
            Bitmap bitmap = new Bitmap(obj.Icon_24x24, 20, 20);
            this.Icon = CanvasRenderEngine.BitmapToBitmapImage(bitmap);
            #endregion

            this.Exposure = obj.Exposure;
            this.Guid     = obj.ComponentGuid;


            Type            type = obj.GetType();
            GH_AssemblyInfo lib  = null;

            Isvalid = true;

            if (type == null)
            {
                this.FullName = "";
            }
            else
            {
                this.FullName = type.FullName;
                lib           = GetGHLibrary(type);
            }

            this.PluginLocation = lib.Location;
            this.ShowLocation   = this.PluginLocation;
            this.IsPlugin       = !lib.IsCoreLibrary;

            if (lib != null)
            {
                this.AssemblyName   = lib.Name;
                this.AssemblyAuthor = lib.AuthorName;
            }

            this.Tip = CreateTip();
        }
        protected override void LanguageChanged()
        {
            #region Top Tree Translate
            WindowTitle.Text            = LanguagableComponent.GetTransLation(new string[] { "Exception Window", "除去项窗口" });
            WindowSwitchControl.ToolTip = LanguagableComponent.GetTransLation(new string[] { "Click to switch between normal showcase and plugin showcase.", "点击以在常规展示和插件展示中切换。" });
            NormalMode.Content          = LanguagableComponent.GetTransLation(new string[] { "Normal", "常规项" });
            PluginMode.Content          = LanguagableComponent.GetTransLation(new string[] { "Plugin", "插件项" });
            FilterButton.ToolTip        = LanguagableComponent.GetTransLation(new string[] { "Click to add the components selected on the canvas to list.", "点击以将在画布中选中的运算器添加到列表当中" });

            HintAssist.SetHint(SearchBox, new Label()
            {
                Content             = LanguagableComponent.GetTransLation(new string[] { "Search", "搜索" }),
                HorizontalAlignment = HorizontalAlignment.Center, VerticalAlignment = VerticalAlignment.Center
            });
            #endregion

            #region Major Box
            DataGridPropertyChange();
            IconColumn.Header        = LanguagableComponent.GetTransLation(new string[] { "Icon", "图标" });
            FullNameColumn.Header    = LanguagableComponent.GetTransLation(new string[] { "FullName", "全名" });
            CategoryColumn.Header    = LanguagableComponent.GetTransLation(new string[] { "Category", "类别" });
            SubcategoryColumn.Header = LanguagableComponent.GetTransLation(new string[] { "Subcategory", "子类别" });
            ExposureColumn.Header    = LanguagableComponent.GetTransLation(new string[] { "Exposure", "分栏" });
            GuidColumn.Header        = LanguagableComponent.GetTransLation(new string[] { "Guid", "全局唯一标识符(Guid)" });

            FirstExpenderName.Text     = LanguagableComponent.GetTransLation(new string[] { "Filter", "过滤器" });
            SecondExpenderName.ToolTip = LanguagableComponent.GetTransLation(new string[] { "Column Visibility", "列可视性" });
            #endregion

            #region B0ttom Four Translate
            FileOption.ToolTip      = LanguagableComponent.GetTransLation(new string[] { "File Option", "文件选项" });
            AsDefaultButton.ToolTip = LanguagableComponent.GetTransLation(new string[] { "Click to save as template.", "点击以保存一个模板。" });
            ImportButton.ToolTip    = LanguagableComponent.GetTransLation(new string[] { "Click to import a file.", "点击以导入一个文件。" });
            ExportButton.ToolTip    = LanguagableComponent.GetTransLation(new string[] { "Click to export a file.", "点击以导出一个文件。" });

            CancelButton.ToolTip  = LanguagableComponent.GetTransLation(new string[] { "Click to cancel the changes and close this window.", "单击以取消修改,并关闭此窗口。" });
            RefreshButton.ToolTip = LanguagableComponent.GetTransLation(new string[] { "Click to refresh the component.", "单击以刷新运算器。" });
            OKButton.ToolTip      = LanguagableComponent.GetTransLation(new string[] { "Click to comfirm the change and close the window.", "单击以确认修改并关闭窗口。" });
            #endregion
        }
Пример #19
0
        public ComTypeInfo(IGH_ObjectProxy proxy)
        {
            this.Category    = proxy.Desc.HasCategory ? proxy.Desc.Category : LanguagableComponent.GetTransLation(new string[] { "<Unnamed Category>", "<未命名类别>" });
            this.Subcategory = proxy.Desc.HasSubCategory ? proxy.Desc.SubCategory : LanguagableComponent.GetTransLation(new string[] { "<Unnamed Subcategory>", "<未命名子类>" });
            this.Name        = proxy.Desc.Name;
            this.Description = proxy.Desc.Description;
            #region
            Bitmap bitmap = new Bitmap(proxy.Icon, 20, 20);
            this.Icon = CanvasRenderEngine.BitmapToBitmapImage(bitmap);
            #endregion

            this.Exposure = proxy.Exposure;
            this.Guid     = proxy.Guid;

            Isvalid = true;

            Type            type = proxy.Type;
            GH_AssemblyInfo lib  = null;

            if (type == null)
            {
                this.FullName = "";
            }
            else
            {
                this.FullName = type.FullName;
                lib           = GetGHLibrary(type);
            }

            this.IsPlugin = checkisPlugin(proxy, lib);

            if (lib != null)
            {
                this.AssemblyName   = lib.Name;
                this.AssemblyAuthor = lib.AuthorName;
            }

            this.Tip = CreateTip();
        }
Пример #20
0
        public string Writetxt(string path)
        {
            if (string.IsNullOrEmpty(path))
            {
                return(LanguagableComponent.GetTransLation(new string[] { "Failed to get path.", "获取位置失败!" }));
            }
            IO_Helper.WriteString(path, () =>
            {
                string normalGuids = "";
                if (normalExceptionGuid.Count > 0)
                {
                    normalGuids = this.normalExceptionGuid[0].ToString();
                    for (int i = 1; i < normalExceptionGuid.Count; i++)
                    {
                        normalGuids += ',';
                        normalGuids += normalExceptionGuid[i].ToString();
                    }
                }

                string pluginGuids = "";
                if (pluginExceptionGuid.Count > 0)
                {
                    pluginGuids = this.pluginExceptionGuid[0].ToString();
                    for (int i = 1; i < pluginExceptionGuid.Count; i++)
                    {
                        pluginGuids += ',';
                        pluginGuids += pluginExceptionGuid[i].ToString();
                    }
                }

                return(normalGuids + "\n" + pluginGuids);
            });


            return(LanguagableComponent.GetTransLation(new string[] { "Export successfully! \n Location: ", "导出成功!\n 位置:" }) + path);
        }