示例#1
0
        object ParseValueFromTextBox(out bool invalid)
        {
            var control   = (IHCTextBox)CreatedControlInsidePropertyItemControl;
            var netType   = Property.Type.GetNetType();
            var unrefType = ReferenceUtility.GetUnreferencedType(netType);

            try
            {
                invalid = false;

                var text = control.TextBox.Text;

                if (typeof(ICanParseFromAndConvertToString).IsAssignableFrom(unrefType))
                {
                    var parseMethod = unrefType.GetMethod("Parse", BindingFlags.Public | BindingFlags.Static);
                    if (parseMethod != null)
                    {
                        return(parseMethod.Invoke(null, new object[] { text }));
                    }
                }

                return(SimpleTypes.ParseValue(unrefType, text));
            }
            catch
            {
                invalid = true;
                return(null);
            }
        }
        private void TrackBar_ValueChanged(object sender, EventArgs e)
        {
            if (trackBarDisableValueChangedEvent)
            {
                return;
            }

            if (!trackBarFocused)
            {
                return;
            }

            //begin modifying. save old values for undo
            if (!trackBarModifying)
            {
                trackBarItemInHierarchyToAddUndo = GetItemInHierarchyToRestoreValues();
                trackBarItemInHierarchyToAddUndo.SaveValuesToRestore();
                trackBarModifying = true;
            }

            var control  = (IHCTextBoxNumeric)CreatedControlInsidePropertyItemControl;
            var trackBar = control.TrackBar;

            trackBarDisableValueChangedEvent = true;

            var netType   = Property.Type.GetNetType();
            var unrefType = ReferenceUtility.GetUnreferencedType(netType);

            try
            {
                double doubleValue = range.GetValueFromTrackBar(IsInteger(), trackBar.Value);

                //conversion by means string
                string str;
                if (IsInteger())
                {
                    str = Convert.ToInt64(doubleValue).ToString();
                }
                else
                {
                    str = doubleValue.ToString();
                }
                var value = SimpleTypes.ParseValue(unrefType, str);

                SetValue(value, false);
            }
            catch
            {
            }

            trackBarDisableValueChangedEvent = false;
        }
示例#3
0
        /////////////////////////////////////////

        //internal class CoverControl : Control
        //{
        //	Label label;
        //	public CoverControl()
        //	{
        //		label = new Label() { Dock = DockStyle.Fill, TextAlign = ContentAlignment.MiddleCenter };
        //		Controls.Add( label );
        //		BackColor = Color.Black;
        //		Dock = DockStyle.Fill;
        //	}

        //	public void UpdateText( string text )
        //	{
        //		label.Text = text;
        //		Application.DoEvents();
        //	}
        //}

        /////////////////////////////////////////

        public EditorForm()
        {
            instance = this;

            //get CustomWindowsStyle project settings
            var customWindowsStyle = ProjectSettings.ReadParameterFromFile("CustomWindowsStyle");

            if (!string.IsNullOrEmpty(customWindowsStyle))
            {
                try
                {
                    KryptonToolkitSettings.AllowFormChrome = (bool)SimpleTypes.ParseValue(typeof(bool), customWindowsStyle);
                }
                catch { }
            }
            AllowFormChrome = KryptonToolkitSettings.AllowFormChrome;

            //if( /*showSplashScreenAtStartup &&*/ !Debugger.IsAttached )
            //{
            //	//Image image = MapEditor.Properties.Resources.MapEditorSplash;
            //	var splashForm = new SplashForm();// image );
            //	splashForm.Show();
            //}

            InitializeComponent();

            if (WinFormsUtility.IsDesignerHosted(this))
            {
                return;
            }

            ////!!!!new
            //buttonQATFormIntegration.Enabled = DWM.IsCompositionEnabled && AllowFormChrome;
            //allowFormChromeButton.Enabled = KryptonManager.AllowFormChrome;

            workspaceController = new WorkspaceControllerForForm(kryptonPanel, this);

            //EnableLocalization();

            EditorAssemblyInterface.Instance.InitializeWPFApplicationAndScriptEditor();
            //InitializeWPFApplication();
            //InitializeScriptEditor();

            //!!!!!тут?
            //QATButtonsInit();

            //apply editor settings
            EditorSettingsSerialization.Init();
            EditorFavorites.Init();
        }
示例#4
0
        void ThreadGetStoreItems()
        {
            try
            {
                string xml = "";
                string url = @"https://www.neoaxis.com/api/get_store_items";

                var request = (HttpWebRequest)WebRequest.Create(url);

                using (var response = (HttpWebResponse)request.GetResponse())
                    using (var stream = response.GetResponseStream())
                        using (var reader = new StreamReader(stream))
                            xml = reader.ReadToEnd();

                XmlDocument xDoc = new XmlDocument();
                xDoc.LoadXml(xml);

                var packages = new List <PackageManager.PackageInfo>();

                foreach (XmlNode itemNode in xDoc.GetElementsByTagName("item"))
                {
                    var info = new PackageManager.PackageInfo();
                    //info.Name = "None";
                    //info.Version = "1.0.0.0";

                    foreach (XmlNode child in itemNode.ChildNodes)
                    {
                        if (child.Name == "name")
                        {
                            info.Name = child.InnerText;
                        }
                        if (child.Name == "author")
                        {
                            info.Author = child.InnerText;
                        }
                        if (child.Name == "version")
                        {
                            info.Version = child.InnerText;
                        }
                        //if( child.Name == "only_pro" && !string.IsNullOrEmpty( child.InnerText ) )
                        //	info.OnlyPro = (bool)SimpleTypes.ParseValue( typeof( bool ), child.InnerText );
                        if (child.Name == "size")
                        {
                            double.TryParse(child.InnerText, out var size);
                            info.Size = (long)size;
                        }
                        if (child.Name == "download")
                        {
                            info.Download = child.InnerText;
                        }
                        if (child.Name == "secure_download" && !string.IsNullOrEmpty(child.InnerText))
                        {
                            info.SecureDownload = (bool)SimpleTypes.ParseValue(typeof(bool), child.InnerText);
                        }
                        if (child.Name == "description")
                        {
                            info.Description = child.InnerText;
                        }
                        if (child.Name == "date")
                        {
                            info.Date = child.InnerText;
                        }
                        if (child.Name == "files")
                        {
                            info.Files = child.InnerText;
                        }
                    }

                    packages.Add(info);
                }

                //sort by date
                CollectionUtility.MergeSort(packages, delegate(PackageManager.PackageInfo p1, PackageManager.PackageInfo p2)
                {
                    if (p1.Date != p2.Date)
                    {
                        return(-string.Compare(p1.Date, p2.Date));
                    }
                    return(0);
                });

                downloadedListOfPackages = packages;

                needUpdateList = true;
            }
            catch { }
        }