Exemple #1
0
    public IEnumerator TestPoolGameObject()
    {
        var core = new Core();

        core.Add(new ManagerUpdate());
        core.Add(new ManagerTimers());

        var poolParent = new GameObject("Pools");

        var pool = new PoolGameObject(poolParent.transform);

        var pref = new GameObject("TestPrefab");

        pool.Register(pref, 3);

        for (var i = 0; i < 20; i++)
        {
            var instance = pool.GetInstance(pref);

            yield return(new WaitForSecondsRealtime(Random.Range(.05f, .3f)));

            this.DoActionWithDelay(() => pool.ReturnInstance(instance), Random.Range(.1f, .5f));
        }

        yield return(null);
    }
Exemple #2
0
		/// <summary>
		/// Builds up a set of options the control can use (i.e. jQuery UI control supports).  Which is
		/// then used in rendering the JavaScript required to initialise the control properties.
		/// </summary>
		/// <param name="options">Collection to add the identified options to</param>
		override protected internal void DiscoverOptions(Core.ScriptOptions options) {
			if (this.Disabled) {
				// BUG: There seems to be a bug in jQuery UI meaning disabling all the tabs
				// doesn't work, so disable each tab manually. The overall "disabled" flag
				// is kept as false so we use the List<int> entry point instead.
				this.DisabledArray.Clear();
				for (int i=0; i < this.Tabs._Panes._Panes.Count(); i++) {
					this.DisabledArray.Add(i);
				}				
				// Following line is left here for when the jQuery UI library is fixed.
				//options.Add(this.Disabled, "disable", this.Disabled.JsBool());
			}
			if (this.DisabledArray != null && this.DisabledArray.Count() > 0) {
				options.Add("disabled", this.DisabledArray.JsArray());
			}
			options.Add(!this.IsNullOrEmpty(this.Fx), "fx", this.Fx);
			options.Add(!this.IsNullEmptyOrDefault(this.Evt, DEFAULT_EVENT), "event", this.Evt.InDoubleQuotes());
			options.Add(this.Cache, "cache", this.Cache.JsBool() );
			options.Add(!this.IsNullOrEmpty(this.AjaxOptions), "ajaxOptions", this.AjaxOptions);
			options.Add(this.Collapsible, "collapsible", this.Collapsible.JsBool() );
			// Cookie is a little bit different because it's an object, so just add it's options in
			options.Add(this.Cookie.Options.GetCookieScriptOption());
			options.Add(!this.IsNullEmptyOrDefault(this.IdPrefix, DEFAULT_ID_PREFIX), "idPrefix", this.IdPrefix.InDoubleQuotes());
			options.Add(!this.IsNullEmptyOrDefault(this.PanelTemplate, DEFAULT_PANEL_TEMPLATE), "panelTemplate", this.PanelTemplate.InDoubleQuotes());
			options.Add(!this.IsNullEmptyOrDefault(this.Spinner, DEFAULT_SPINNER), "spinner", this.Spinner.InDoubleQuotes());
			options.Add(!this.IsNullEmptyOrDefault(this.TabTemplate, DEFAULT_TAB_TEMPLATE), "tabTemplate", this.TabTemplate.InDoubleQuotes());
			if (this.Tabs.Panes.HasSelectedTab() && this.Tabs.Panes.GetSelectedTab().Index > 0) {
				options.Add( this.Tabs.Panes.HasSelectedTab(), "selected", this.Tabs.Panes.GetSelectedTab().Index.ToString() );
			}
		}
Exemple #3
0
		/// <summary>
		/// Builds up a set of options the control can use (i.e. jQuery UI control supports).  Which is
		/// then used in rendering the JavaScript required to initialise the control properties.
		/// </summary>
		/// <param name="options">Collection to add the identified options to</param>
		override protected internal void DiscoverOptions(Core.ScriptOptions options) {
			options.Add(!this.IsNullOrEmpty(this.AppendTo), "appendTo", this.AppendTo.InDoubleQuotes());
			options.Add(this.Disabled, "disabled", this.Disabled.JsBool());
			options.Add(!this.IsNullEmptyOrDefault(this.Icons, DEFAULT_ICONS), "icons", "{{ button: {0} }}", this.Icons.InDoubleQuotes());
			options.Add(this.Position.Options.GetPositionScriptOption());
			if (this.Width.HasValue) {
				options.Add(this.Width.HasValue, "width", this.Width.Value.ToString());
			}
		}
Exemple #4
0
		/// <summary>
		/// Builds up a set of options the control can use (i.e. jQuery UI control supports).  Which is
		/// then used in rendering the JavaScript required to initialise the control properties.
		/// </summary>
		/// <param name="options">Collection to add the identified options to</param>
		override protected internal void DiscoverOptions(Core.ScriptOptions options) {
			options.Add(this.Disabled, "disabled", this.Disabled.JsBool());
			options.Add(!this.IsNullEmptyOrDefault(this.Icons, DEFAULT_ICONS), "icons", "{{ submenu: {0} }}", this.Icons.InDoubleQuotes());
			options.Add(!this.IsNullEmptyOrDefault(this.Menus, DEFAULT_MENUS), "menus", this.Menus.InDoubleQuotes() );
			options.Add(!this.IsNullEmptyOrDefault(this.Role, DEFAULT_ROLE), "role", this.Role.InDoubleQuotes());

			// Position is a little bit different because it's an object, so just add it's options in
			options.Add(this.Position.Options.GetPositionScriptOption());
		}
Exemple #5
0
		/// <summary>
		/// Builds up a set of options the control can use (i.e. jQuery UI control supports).  Which is
		/// then used in rendering the JavaScript required to initialise the control properties.
		/// </summary>
		/// <param name="options">Collection to add the identified options to</param>
		override protected internal void DiscoverOptions(Core.ScriptOptions options) {
			options.Add(this.Disabled, "disabled", this.Disabled.JsBool());
			options.Add(!this.Text, "text", this.Text.JsBool());
			
			// icons must be set as a pair
			string iconSetting = "";
			if (!this.IsNullOrEmpty(this.PrimaryIconClass) || !this.IsNullOrEmpty(this.SecondaryIconClass)) {
				iconSetting = string.Format("{{ primary: '{0}', secondary: '{1}' }}", this.PrimaryIconClass, this.SecondaryIconClass);
				options.Add("icons", iconSetting);
			}
		}
Exemple #6
0
		/// <summary>
		/// Builds up a set of options the control can use (i.e. jQuery UI control supports).  Which is
		/// then used in rendering the JavaScript required to initialise the control properties.
		/// </summary>
		/// <param name="options">Collection to add the identified options to</param>
		override protected internal void DiscoverOptions(Core.ScriptOptions options) {
			// default is "disable"
			options.Add(this.Disabled, "disabled", this.Disabled.JsBool());

			options.Add(!this.IsNullOrEmpty(this.Source), "source", this.Source);
			options.Add(!this.IsNullEmptyOrDefault(this.AppendTo, DEFAULT_APPEND_TO), "appendTo", this.AppendTo.InDoubleQuotes());
			options.Add(this.AutoFocus, "autoFocus", this.AutoFocus.JsBool());
			options.Add(!this.IsDefault(this.Delay, DEFAULT_DELAY), "delay", this.Delay.ToString());
			options.Add(!this.IsDefault(this.MinimumLength, DEFAULT_MINIMUM_LENGTH), "minLength", this.MinimumLength.ToString());

			// Position is a little bit different because it's an object, so just add it's options in
			options.Add(this.Position.Options.GetPositionScriptOption());
		}
Exemple #7
0
        private void CreateCoreList()
        {
            Core.Add(new TwitterResource
            {
                User = DataTransfer.CurrentAccount,
                Type = ResourceType.Home
            });

            Core.Add(new TwitterResource
            {
                User = DataTransfer.CurrentAccount,
                Type = ResourceType.Mentions
            });

            Core.Add(new TwitterResource
            {
                User = DataTransfer.CurrentAccount,
                Type = ResourceType.Messages
            });

            Core.Add(new TwitterResource
            {
                User = DataTransfer.CurrentAccount,
                Type = ResourceType.Favorites
            });
        }
Exemple #8
0
		/// <summary>
		/// Builds up a set of options the control can use (i.e. jQuery UI control supports).  Which is
		/// then used in rendering the JavaScript required to initialise the control properties.
		/// </summary>
		/// <param name="options">Collection to add the identified options to</param>
		override protected internal void DiscoverOptions(Core.ScriptOptions options) {
			if (this.Disabled) {
				// BUG: There seems to be a bug in jQuery UI meaning disabling all the tabs
				// doesn't work, so disable each tab manually. The overall "disabled" flag
				// is kept as false so we use the List<int> entry point instead.
				this.DisabledArray.Clear();
				for (int i=0; i < this.Tabs._Panes._Panes.Count(); i++) {
					this.DisabledArray.Add(i);
				}				
				// Following line is left here for when the jQuery UI library is fixed.
				//options.Add(this.Disabled, "disable", this.Disabled.JsBool());
			}
			if (this.DisabledArray != null && this.DisabledArray.Count() > 0) {
				options.Add("disabled", this.DisabledArray.JsArray());
			}
			options.Add(!this.IsNullEmptyOrDefault(this.Evt, DEFAULT_EVENT), "event", this.Evt.InDoubleQuotes());
			options.Add(!this.IsNullEmptyOrDefault(this.HeightStyle, DEFAULT_HEIGHT_STYLE), "heightStyle", this.HeightStyle.InDoubleQuotes());
			options.Add(this.Collapsible, "collapsible", this.Collapsible.JsBool() );
			// Show and hide are a little bit different because it's an object, so just add it's options in
			options.Add(this.ShowAnimation.Options.GetAnimationScriptOption());
			options.Add(this.HideAnimation.Options.GetAnimationScriptOption());
			if (this.Tabs.Panes.HasActiveTab() && this.Tabs.Panes.GetActiveTab().Index > 0) {
				options.Add( this.Tabs.Panes.HasActiveTab(), "active", this.Tabs.Panes.GetActiveTab().Index.ToString() );
			}
		}
Exemple #9
0
		/// <summary>
		/// Builds up a set of options the control can use (i.e. jQuery UI control supports).  Which is
		/// then used in rendering the JavaScript required to initialise the control properties.
		/// </summary>
		/// <param name="options">Collection to add the identified options to</param>
		override protected internal void DiscoverOptions(Core.ScriptOptions options) {
			options.Add(!this.IsNullOrEmpty(this.Content) && !this.IsEmptyQuotes(this.Content), "content", this.Content);
			options.Add(this.Disabled, "disabled", this.Disabled.JsBool());
			options.Add(!this.IsNullEmptyOrDefault(this.Items, DEFAULT_ITEMS), "items", this.Items);
			options.Add(!this.IsNullOrEmpty(this.ToolTipClass), "tooltipClass", this.ToolTipClass.InDoubleQuotes());
			options.Add(this.Track, "track", this.Track.JsBool());			
			// Position and Animation is a little bit different because it's an object, so just add it's options in
			options.Add(this.Position.Options.GetPositionScriptOption());
			options.Add(this.ShowAnimation.Options.GetAnimationScriptOption());
			options.Add(this.HideAnimation.Options.GetAnimationScriptOption());
		}
Exemple #10
0
 void DrawAddServer()
 {
     if (GUILayout.Button(addServerText, buttonStyle))
     {
         var server = new Configuration.Server();
         config.Configuration.Servers.Add(server);
         config.Save();
         core.Add(server.Create());
     }
 }
Exemple #11
0
 public Vector2 Filter(Vector2 point)
 {
     Core.Add(point);
     try
     {
         return(Core.IsReady ? Core.Predict(DateTime.UtcNow, Offset) : point);
     }
     catch
     {
         Log.Write("MeLFilter", "Unknown error in MeLCore", LogLevel.Error);
         return(point);
     }
 }
Exemple #12
0
        protected override IEnumerator InitData()
        {
            var process = base.InitData();

            while (process.MoveNext())
            {
                yield return(null);
            }

            Core.Add <DataGameState>();

            Core.Add <DataSpheres>();

            Core.Add <DataUIManager>();
        }
Exemple #13
0
 private CharNames(int id, string defaultName, Func <CommandSettings, IList <string> > wordsSelector,
                   int saveMapRecordOffset,
                   GameMoments allowNamingAfter = GameMoments.AfterBarretNamed,
                   bool included = true)
 {
     _wordsSelector   = wordsSelector;
     AllowNamingAfter = allowNamingAfter;
     Id                  = id;
     DefaultName         = defaultName;
     SaveMapRecordOffset = saveMapRecordOffset;
     if (included)
     {
         Core.Add(this);
     }
     All.Add(this);
 }
        public GeneratorActionResult ExecuteAction(GeneratorArguments arguments, Core.InputFields.ActionInputValues values, Dictionary<string, string> parameters)
        {
            url = parameters["url"];
            token = parameters["token"];

            try
            {
                values.Add("CloneUrl", GetCloneUrl(values.GetString("projectId")));
            }
            catch (Exception ex)
            {
                return new GeneratorActionResult(false, ex.Message);
            }

            return new GeneratorActionResult(true, "");
        }
Exemple #15
0
        public override void UpdateState(SyntheticTabletReport report)
        {
            var now      = DateTime.UtcNow;
            var reportMs = (now - lastTime).TotalMilliseconds;

            reportMsAvg    += (reportMs - reportMsAvg) / 50.0;
            lastTime        = now;
            SyntheticReport = new SyntheticTabletReport(report);
            if (reportMs > 100)
            {
                reportMsAvg = 4;
            }
            if (reportMs >= reportMsAvg * 0.75)
            {
                Core.Add(report.Position);
            }
        }
        public GeneratorActionResult ExecuteAction(GeneratorArguments arguments, Core.InputFields.ActionInputValues values, Dictionary<string, string> parameters)
        {
            url = parameters["url"];
            token = parameters["token"];
            moveToken = parameters["moveToken"];

            try
            {
                var projectId = CreateProject(arguments.Name, "", "Websites");
                values.Add("projectId", projectId);
            }
            catch (Exception ex)
            {
                return new GeneratorActionResult(false, ex.Message);
            }

            return new GeneratorActionResult(true, "");
        }
Exemple #17
0
 public Vector2 Filter(Vector2 point)
 {
     Core.Add(point);
     try
     {
         var a = Core.IsReady ? Core.Predict(Offset) : point;
         rateLimit = false;
         return(a);
     }
     catch
     {
         if (!rateLimit)
         {
             Log.Write("MeLFilter", "Unknown error in MeLCore", LogLevel.Error);
             rateLimit = true;
         }
         return(point);
     }
 }
Exemple #18
0
        IEnumerator Start()
        {
            /*Core.Add<SystemEventsManager>();
             * Core.Add<TerminalManager>();
             * Core.Add<BundlesManager>();
             * Core.Add<PrefsManager>();
             * Core.Add<DBManager>();
             * Core.Add<CoreScenesManager>();
             * Core.Add<ContextManager>();*/

            foreach (var man in preloadManagers)
            {
                Core.Add(man);
            }

            Core.AttachManagers();

            yield return(LoadingScenes());
        }
Exemple #19
0
        protected override IEnumerator InitSystems()
        {
            var process = base.InitData();

            while (process.MoveNext())
            {
                yield return(null);
            }

            Core.Add <GameStateManagingSystem>();

            Core.Add <SpheresSpawnSystem>();

            Core.Add <SpheresManagingSystem>();
            Core.Add <SpawnRandomCountSpheresSystem>();
            Core.Add <SpheresCountGameOverSystem>();

            Core.Add <UIControllerSystem>();
            Core.Add <UIGameSystem>();
        }
        protected virtual IEnumerator InitModules()
        {
            if (_modules == null)
            {
                yield break;
            }

            foreach (var module in _modules)
            {
                if (!module)
                {
                    continue;
                }

                if (module is IAsyncAwake)
                {
                    var process = Core.AddAsync(module);

                    while (process.MoveNext())
                    {
                        yield return(null);
                    }
                }
                else
                {
                    Core.Add(module);
                }
            }
        }
Exemple #21
0
		/// <summary>
		/// Builds up a set of options the control can use (i.e. jQuery UI control supports).  Which is
		/// then used in rendering the JavaScript required to initialise the control properties.
		/// </summary>
		/// <param name="options">Collection to add the identified options to</param>
		override protected internal void DiscoverOptions(Core.ScriptOptions options) {
			options.Add(this.Disabled, "disabled", this.Disabled.JsBool());
			options.Add(!this.IsNullEmptyOrDefault(this.Animate, DEFAULT_ANIMATE), "animate", this.Animate.InDoubleQuotes());
			options.Add(this.Collapsible, "collapsible", this.Collapsible.JsBool());
			options.Add(!this.IsNullEmptyOrDefault(this.HeadingTag, DEFAULT_HEADING_TAG), "heading", this.HeadingTag.InDoubleQuotes());
			options.Add(!this.IsNullEmptyOrDefault(this.HeightStyle, DEFAULT_HEIGHT_STYLE), "heightStyle", this.HeightStyle.InDoubleQuotes());
			options.Add(!this.IsNullEmptyOrDefault(this.Event, DEFAULT_EVENT), "event", this.Event.InSingleQuotes() );
			
			if (AreIconsEnabled()) {
				if (!AreIconsDefaults())
					options.Add( "icons", "{{ 'header': '{0}', 'activeHeader': '{1}' }}", this.HeaderIconClass, this.activeHeaderIconClass );
			} else {
				// icons disabled
				options.Add("icons", false.JsBool());
			}
			
			int activeIndex = this.Accordion.Panels.GetActivePaneIndex();
			if (activeIndex > 0) {
				options.Add( this.Accordion.Panels.HasActivePane(), "active", activeIndex.ToString() );
			}
		}
Exemple #22
0
		/// <summary>
		/// Builds up a set of options the control can use (i.e. jQuery UI control supports).  Which is
		/// then used in rendering the JavaScript required to initialise the control properties.
		/// </summary>
		/// <param name="options">Collection to add the identified options to</param>
		override protected internal void DiscoverOptions(Core.ScriptOptions options) {
			options.Add(GetPositionScriptOption(false/*asChild*/));
		}
Exemple #23
0
		/// <summary>
		/// Builds up a set of options the control can use (i.e. jQuery UI control supports).  Which is
		/// then used in rendering the JavaScript required to initialise the control properties.
		/// </summary>
		/// <param name="options">Collection to add the identified options to</param>
		override protected internal void DiscoverOptions(Core.ScriptOptions options) {
			options.Add(this.Disabled, "disabled", this.Disabled.JsBool());
			options.Add(!this.IsNullEmptyOrDefault(this.Animated, DEFAULT_ANIMATED), "animated", this.Animated.InDoubleQuotes());
			options.Add(!this.AutoHeight, "autoHeight", this.AutoHeight.JsBool());
			options.Add(this.ClearStyle, "clearStyle", this.ClearStyle.JsBool());
			options.Add(this.Collapsible, "collapsible", this.Collapsible.JsBool());
			options.Add(!this.IsNullEmptyOrDefault(this.HeadingTag, DEFAULT_HEADING_TAG), "heading", this.HeadingTag.InDoubleQuotes());
			options.Add(this.FillSpace, "fillSpace", this.FillSpace.JsBool());
			options.Add(this.Navigation, "navigation", this.Navigation.JsBool());
			options.Add(!this.IsNullOrEmpty(this.NavigationFilter),"navigationFilter", this.NavigationFilter);
			options.Add(!this.IsNullEmptyOrDefault(this.Event, DEFAULT_EVENT), "event", this.Event.InSingleQuotes() );
			
			// icons have to be set as a pair
			if (AreIconsEnabled()) {
				bool addNormalIcon = !string.IsNullOrEmpty(this.HeaderIconClass) && this.HeaderIconClass != DEFAULT_HEADER_ICON_CLASS;
				bool addSelectedIcon = !string.IsNullOrEmpty(this.HeaderSelectedIconClass) && this.HeaderSelectedIconClass != DEFAULT_HEADER_SELECTED_ICON_CLASS;
				if (addNormalIcon || addSelectedIcon) {
					options.Add( "icons", "{{ 'header': '{0}', 'headerSelected': '{1}' }}", this.HeaderIconClass, this.HeaderSelectedIconClass );
				}
			}
			
			int activeIndex = this.Accordion.Panels.GetActivePaneIndex();
			if (activeIndex > 0) {
				options.Add( this.Accordion.Panels.HasActivePane(), "active", activeIndex.ToString() );
			}
		}
Exemple #24
0
		/// <summary>
		/// Builds up a set of options the control can use (i.e. jQuery UI control supports).  Which is
		/// then used in rendering the JavaScript required to initialise the control properties.
		/// </summary>
		/// <param name="options">Collection to add the identified options to</param>
		override protected internal void DiscoverOptions(Core.ScriptOptions options) {
			options.Add(this.Disabled, "disabled", this.Disabled.JsBool());
			options.Add(this.Value != DEFAULT_VALUE, "value", this.Value.ToString());
		}
Exemple #25
0
		/// <summary>
		/// Builds up a set of options the control can use (i.e. jQuery UI control supports).  Which is
		/// then used in rendering the JavaScript required to initialise the control properties.
		/// </summary>
		/// <param name="options">Collection to add the identified options to</param>
		override protected internal void DiscoverOptions(Core.ScriptOptions options) {
			bool bValue = false; int nValue = 0;

			// properties
			options.Add(this.Disabled, "disabled", this.Disabled.JsBool());
			if (bool.TryParse(this.Animate, out bValue)) { 
				options.Add( bValue, "animate", bValue.JsBool() );
			} else if (int.TryParse(this.Animate, out nValue)) {
				options.Add( "animate", nValue.ToString() ); 
			} else {
				options.Add( "animate", this.Animate.InDoubleQuotes());
			}
			options.Add(this.Min != DEFAULT_MIN, "min", this.Min.ToString());
			options.Add(this.Max != DEFAULT_MAX, "max", this.Max.ToString());
			options.Add(this.Orientation != DEFAULT_ORIENTATION, "orientation", Core.Orientation.OrientationToString(this.Orientation).InDoubleQuotes());
			if (bool.TryParse(this.Range, out bValue)) {
				options.Add(bValue, "range", bValue.JsBool());
			} else {
				options.Add(!this.IsNullOrEmpty(this.Range), "range", this.Range.InDoubleQuotes());
			}
			options.Add(this.Step != DEFAULT_STEP, "step", this.Step.ToString());
			options.Add(this.Value != DEFAULT_VALUE, "value", this.Value.ToString());
			options.Add(this.Values != null && this.Values.Any(), "values", this.Values.JsArray());
		}
Exemple #26
0
		/// <summary>
		/// Builds up a set of options the control can use (i.e. jQuery UI control supports).  Which is
		/// then used in rendering the JavaScript required to initialise the control properties.
		/// </summary>
		/// <param name="options">Collection to add the identified options to</param>
		override protected internal void DiscoverOptions(Core.ScriptOptions options) {
			options.Add(this.Disabled, "disabled", this.Disabled.JsBool());
			options.Add(!this.AutoOpen, "autoOpen", this.AutoOpen.JsBool());
			options.Add(!this.CloseOnEscape, "closeOnEscape", this.CloseOnEscape.JsBool());
			options.Add(!this.IsNullEmptyOrDefault(this.CloseText, DEFAULT_CLOSE_TEXT), "closeText", this.CloseText.InDoubleQuotes());
			options.Add(!this.IsNullOrEmpty(this.DialogClass), "dialogClass", this.DialogClass.InDoubleQuotes());
			options.Add(!this.Draggable, "draggable", this.Draggable.JsBool());

			if (!this.IsNullEmptyOrDefault(this.Height, DEFAULT_HEIGHT)) {
				if (this.IsNumeric(this.Height))
					options.Add("height", this.Height);
				else 
					options.Add("height", this.Height.InDoubleQuotes());
			}

			options.Add(!this.IsNullOrEmpty(this.Hide), "hide", this.Hide);
			options.Add(this.MinWidth != DEFAULT_MIN_WIDTH, "minWidth", this.MinWidth.ToString());
			options.Add(!this.IsNullEmptyOrDefault(this.MaxWidth, DEFAULT_MAX_WIDTH), "maxWidth", this.MaxWidth);
			options.Add(this.MinHeight != DEFAULT_MIN_HEIGHT, "minHeight", this.MinHeight.ToString());
			options.Add(!this.IsNullEmptyOrDefault(this.MaxHeight, DEFAULT_MAX_HEIGHT), "maxHeight", this.MaxHeight);
			options.Add(this.Modal, "modal", this.Modal.JsBool());

			if (this.Position != null && this.Position.Any() && !this.Position[0].IgnorantEquals(Options.DEFAULT_POSITION)) {
				if (this.Position.Count() == 1) {
					// only "left", "right", etc is supported in single mode
					options.Add("position", this.Position[0].InDoubleQuotes());

				} else {
					// if it's a numeric list, don't add quotes otherwise we do
					if (this.IsNumeric(this.Position[0]))
						options.Add("position", this.Position.JsArray());
					else 
						options.Add("position", this.Position.JsArray(false/*singleQuotes*/));
				}
			}

			options.Add(!this.Resizable, "resizable", this.Resizable.JsBool());
			options.Add(!this.IsNullOrEmpty(this.Show), "show", this.Show);
			options.Add(!this.Stack, "stack", this.Stack.JsBool());
			options.Add(!this.IsNullOrEmpty(this.Title), "title", this.Title.InDoubleQuotes());
			options.Add(this.Width != DEFAULT_WIDTH, "width", this.Width.ToString());
			options.Add(this.ZIndex != DEFAULT_ZINDEX, "zIndex", this.ZIndex.ToString());

			if (this.ButtonOptions != null && this.ButtonOptions.Buttons.Any()) {
				options.Add(this.ButtonOptions.GetButtonsScriptOptions());
			}
		}
Exemple #27
0
        /// <summary>
        /// </summary>
        /// <param name="aFile"> </param>
        /// <param name="aSize"> </param>
        /// <returns> </returns>
        public FilePart Part(Core.File aFile, Int64 aSize)
        {
            FilePart returnPart = null;

            IEnumerable<FilePart> parts = aFile.Parts;
            if (!parts.Any() && aSize == 0)
            {
                returnPart = new FilePart {StartSize = aSize, CurrentSize = aSize, StopSize = aFile.Size, Checked = true};
                aFile.Add(returnPart);
            }
            else
            {
                // first search incomplete parts not in use
                foreach (FilePart part in parts)
                {
                    Int64 size = part.CurrentSize - Settings.Instance.FileRollbackBytes;
                    if (part.State == FilePart.States.Closed && (size < 0 ? 0 : size) == aSize)
                    {
                        returnPart = part;
                        break;
                    }
                }
                // if multi dling is enabled
                if (returnPart == null && Settings.Instance.EnableMultiDownloads)
                {
                    // now search incomplete parts in use
                    foreach (FilePart part in parts)
                    {
                        if (part.State == FilePart.States.Open)
                        {
                            // split the part
                            if (part.StartSize < aSize && part.StopSize > aSize)
                            {
                                returnPart = new FilePart {StartSize = aSize, CurrentSize = aSize, StopSize = part.StopSize};

                                // update previous part
                                part.StopSize = aSize;
                                part.Commit();
                                aFile.Add(returnPart);
                                break;
                            }
                        }
                    }
                }
            }
            return returnPart;
        }
Exemple #28
0
        private void glControl1_MouseUp(object sender, MouseEventArgs e)
        {
            pc.SecondMousePos = mouse.MousePosition(e);

            switch (e.Button)
            {
            case MouseButtons.Left:
                switch (pc.CurrentTypeFigure)
                {
                case TypeFigures.Line:
                    _core.Add(pc.AddedFigure);
                    pc.AddedFigure.Id   = _core.Ids.ToString();
                    pc.AddedFigure.Name = "Line " + pc.AddedFigure.Id;
                    SetProperties(pc.AddedFigure);
                    treeView1.Nodes.Clear();
                    treeView1.Nodes.AddRange(_core.NodesForTree());
                    pc.AddedFigure = null;

                    break;

                case TypeFigures.Rect:
                    _core.Add(pc.AddedFigure);
                    pc.AddedFigure.Id   = _core.Ids.ToString();
                    pc.AddedFigure.Name = "Rectangle " + pc.AddedFigure.Id;
                    SetProperties(pc.AddedFigure);
                    treeView1.Nodes.Clear();
                    treeView1.Nodes.AddRange(_core.NodesForTree());
                    pc.AddedFigure = null;
                    break;

                case TypeFigures.Ellipsoid:
                    _core.Add(pc.AddedFigure);
                    pc.AddedFigure.Id   = _core.Ids.ToString();
                    pc.AddedFigure.Name = "Ellipsoid " + pc.AddedFigure.Id;
                    SetProperties(pc.AddedFigure);
                    treeView1.Nodes.Clear();
                    treeView1.Nodes.AddRange(_core.NodesForTree());
                    pc.AddedFigure = null;
                    break;

                case TypeFigures.Polygon:
                    _core.Add(pc.AddedFigure);
                    pc.AddedFigure.Id   = _core.Ids.ToString();
                    pc.AddedFigure.Name = "Polygon " + pc.AddedFigure.Id;
                    SetProperties(pc.AddedFigure);
                    treeView1.Nodes.Clear();
                    treeView1.Nodes.AddRange(_core.NodesForTree());
                    pc.AddedFigure = null;
                    break;

                case TypeFigures.Curve:
                    _core.Add(pc.AddedFigure);
                    pc.AddedFigure.Id   = _core.Ids.ToString();
                    pc.AddedFigure.Name = "Curve " + pc.AddedFigure.Id;
                    SetProperties(pc.AddedFigure);
                    treeView1.Nodes.Clear();
                    treeView1.Nodes.AddRange(_core.NodesForTree());
                    pc.AddedFigure = null;
                    break;

                case TypeFigures.None:
                    pc.IsMove = false;
                    if (pc.Group.SelectingFigure != null)
                    {
                        pc.AWF         = ActionWithFigure.None;
                        pc.IsMovePoint = false;
                        pc.IsMoveEdge  = false;
                    }
                    break;

                default:
                    break;
                }
                break;

            case MouseButtons.Right:
                break;

            default:
                break;
            }
            treeView1.ExpandAll();
        }
Exemple #29
0
 public override void UpdateState(ITabletReport report)
 {
     SyntheticReport = new SyntheticTabletReport(report);
     Core.Add(report.Position);
 }
Exemple #30
0
		/// <summary>
		/// Builds up a set of options the control can use (i.e. jQuery UI control supports).  Which is
		/// then used in rendering the JavaScript required to initialise the control properties.
		/// </summary>
		/// <param name="options">Collection to add the identified options to</param>
		override protected internal void DiscoverOptions(Core.ScriptOptions options) {
			//bool bValue = false; int nValue = 0;

			options.Add(this.Disabled, "disabled", this.Disabled.JsBool());
			options.Add(!this.IsNullOrEmpty(this.Culture), "culture", this.Culture.InDoubleQuotes());

			if (!this.IsNullEmptyOrDefault(this.DownIconClass, DEFAULT_DOWN_ICON_CLASS) && !this.IsNullEmptyOrDefault(this.UpIconClass, DEFAULT_UP_ICON_CLASS)) {
				// output both
				options.Add("icons", "{{ down: {0}, up: {1} }}", this.DownIconClass.InDoubleQuotes(), this.UpIconClass.InDoubleQuotes());
			} else if (!this.IsNullEmptyOrDefault(this.DownIconClass, DEFAULT_DOWN_ICON_CLASS)) {
				// just down
				options.Add("icons", "{{ down: {0} }}", this.DownIconClass.InDoubleQuotes());
			} else if (!this.IsNullEmptyOrDefault(this.UpIconClass, DEFAULT_UP_ICON_CLASS)) {
				// just up
				options.Add("icons", "{{ up: {0} }}", this.UpIconClass.InDoubleQuotes());
			}

			if (this.IsBool(this.Incremental)) {
				bool value = bool.Parse(this.Incremental);
				options.Add(!value, "incremental", value.JsBool());
			} else {
				// assume it's using the function method
				options.Add(!this.IsNullOrEmpty(this.Incremental), "incremental", this.Incremental );
			}

			if (!this.IsNullEmptyOrDefault(this.Min, DEFAULT_MIN_VALUE)) {
				options.Add(this.IsNumeric(this.Min), "min", this.Min);
				options.Add(!this.IsNumeric(this.Min), "min", this.Min.InDoubleQuotes());
			}
			if (!this.IsNullEmptyOrDefault(this.Max, DEFAULT_MAX_VALUE)) {
				options.Add(this.IsNumeric(this.Max), "max", this.Max);
				options.Add(!this.IsNumeric(this.Max), "max", this.Max.InDoubleQuotes());
			}

			options.Add(!this.IsNullEmptyOrDefault(this.NumberFormat, DEFAULT_NUMBER_FORMAT), "numberFormat", this.NumberFormat.InDoubleQuotes());
			options.Add(!this.IsDefault(this.Page, DEFAULT_PAGE), "page", this.Page.ToString());

			if (!this.IsNullEmptyOrDefault(this.Step, DEFAULT_STEP)) {
				options.Add(this.IsNumeric(this.Step), "step", this.Step);
				options.Add(!this.IsNumeric(this.Step), "step", this.Step.InDoubleQuotes());
			}
		}