コード例 #1
0
        private void FindAddressButton_Click(object sender, RoutedEventArgs e)
        {
            graphicsLayer.ClearGraphics();
            AddressBorder.Visibility = Visibility.Collapsed;
            ResultsTextBlock.Visibility = Visibility.Collapsed;

            Locator locatorTask = new Locator("http://geocode.arcgis.com/arcgis/rest/services/World/GeocodeServer");
            locatorTask.AddressToLocationsCompleted += LocatorTask_AddressToLocationsCompleted;
            locatorTask.Failed += LocatorTask_Failed;

            AddressToLocationsParameters addressParams = new AddressToLocationsParameters()
            {
                OutSpatialReference = MyMap.SpatialReference
            };

            Dictionary<string, string> address = addressParams.Address;

            if (!string.IsNullOrEmpty(Address.Text))
                address.Add("Address", Address.Text);
            if (!string.IsNullOrEmpty(City.Text))
                address.Add("City", City.Text);
            if (!string.IsNullOrEmpty(StateAbbrev.Text))
                address.Add("Region", StateAbbrev.Text);
            if (!string.IsNullOrEmpty(Zip.Text))
                address.Add("Postal", Zip.Text);

            locatorTask.AddressToLocationsAsync(addressParams);
        }
コード例 #2
0
        private void FindAddressButton_Click(object sender, RoutedEventArgs e)

        {
   

            Locator locatorTask = new Locator("http://geocode.arcgis.com/arcgis/rest/services/World/GeocodeServer");

            locatorTask.AddressToLocationsCompleted += LocatorTask_AddressToLocationsCompleted;
            locatorTask.Failed += LocatorTask_Failed;
            AddressToLocationsParameters addressParams = new AddressToLocationsParameters();
            
            Dictionary<string, string> address = addressParams.Address;

            if (!string.IsNullOrEmpty(Address.Text))
                address.Add("Address", Address.Text);
            if (!string.IsNullOrEmpty(City.Text))
                address.Add("City", City.Text);
            if (!string.IsNullOrEmpty(State.Text))
                address.Add("Region", State.Text);
            if (!string.IsNullOrEmpty(Zip.Text))
                address.Add("Postal", Zip.Text);
            address.Add("forStorage", "true");
            address.Add("token","pgPwo32cfo-kLf0ABYjV9RZjxGNfFB4--xSkGLOY4bUx0UhmFMc0-06KJCPtx4uRsIGuO_9xn_cxI2G2w9IoD3hX7Q-LGulIg2VhKUcvklXu7CblMg1--yg5kznhXjSF");
            locatorTask.AddressToLocationsAsync(addressParams);
        }
コード例 #3
0
        public BatchGeocoding()
        {
            InitializeComponent();

            ESRI.ArcGIS.Client.Geometry.Envelope initialExtent =
                        new ESRI.ArcGIS.Client.Geometry.Envelope(
                    _mercator.FromGeographic(
                        new ESRI.ArcGIS.Client.Geometry.MapPoint(-117.387, 33.97)) as MapPoint,
                    _mercator.FromGeographic(
                        new ESRI.ArcGIS.Client.Geometry.MapPoint(-117.355, 33.988)) as MapPoint);

            initialExtent.SpatialReference = new SpatialReference(102100);

            MyMap.Extent = initialExtent;

            _locatorTask = new Locator("http://serverapps101.esri.com/arcgis/rest/services/USA_Geocode/GeocodeServer");
            _locatorTask.AddressesToLocationsCompleted += _locatorTask_AddressesToLocationsCompleted;
            _locatorTask.Failed += LocatorTask_Failed;

            geocodedResults = MyMap.Layers["LocationGraphicsLayer"] as GraphicsLayer;

            //List of addresses to geocode
            batchaddresses.Add(new Dictionary<string, string> { { "Street", "4409 Redwood Dr" }, { "Zip", "92501" } });
            batchaddresses.Add(new Dictionary<string, string> { { "Street", "3758 Cedar St" }, { "Zip", "92501" } });
            batchaddresses.Add(new Dictionary<string, string> { { "Street", "3486 Orange St" }, { "Zip", "92501" } });
            batchaddresses.Add(new Dictionary<string, string> { { "Street", "2999 4th St" }, { "Zip", "92507" } });
            batchaddresses.Add(new Dictionary<string, string> { { "Street", "3685 10th St" }, { "Zip", "92501" } });

            AddressListbox.ItemsSource = batchaddresses;
        }
コード例 #4
0
ファイル: UDPTransmitter.cs プロジェクト: Egipto87/DOOP.ec
 public UDPTransmitter(Uri uri, int bufferSize)
 {
     var addresses = System.Net.Dns.GetHostAddresses(uri.Host);
     int port = (uri.Port < 0 ? 0 : uri.Port);
     if (addresses != null && addresses.Length >= 1)
         this.locator = new Locator(addresses[0], port);
  }
コード例 #5
0
ファイル: UDPTransmitter.cs プロジェクト: Egipto87/DOOP.ec
        /// <summary>
        /// Constructor for UDPTransmitter.
        /// </summary>
        /// <param name="locator">Locator where the messages will be sent.</param>
        /// <param name="bufferSize">Size of the buffer that will be used to write messages.</param>
        public UDPTransmitter(Locator locator, int bufferSize)
        {
            this.locator = locator;
            this.bufferSize = bufferSize;


         }
コード例 #6
0
ファイル: LocatorFixture.cs プロジェクト: bnantz/NCS-V2-0
        public void AddingToSameKeyTwiceThrows()
        {
            object o = new object();
            IReadWriteLocator locator = new Locator();

            locator.Add("foo1", o);
            locator.Add("foo1", o);
        }
コード例 #7
0
        public void ResolveByType_WithRegisterdObject_ShouldBeAssignableToIDoSomething(Locator.Interface.IServiceLocator sut)
        {
            var instance = sut.Resolve(typeof(IDoSomething));

            instance.ShouldNotBeNull();

            instance.ShouldBeAssignableTo(typeof(IDoSomething));
        }
コード例 #8
0
		public void CannotCastAReadOnlyLocatorToAReadWriteLocator()
		{
			Locator innerLocator = new Locator();
			ReadOnlyLocator locator = new ReadOnlyLocator(innerLocator);

			Assert.IsTrue(locator.ReadOnly);
			Assert.IsNull(locator as IReadWriteLocator);
		}
コード例 #9
0
        public void GenericGetEnforcesDataType()
        {
            Locator innerLocator = new Locator();
            ReadOnlyLocator locator = new ReadOnlyLocator(innerLocator);

            innerLocator.Add(1, 2);

            locator.Get<string>(1);
        }
コード例 #10
0
        public void GenericGetWithSearchModeEnforcesDataType()
        {
            Locator innerLocator = new Locator();
            ReadOnlyLocator locator = new ReadOnlyLocator(innerLocator);

            innerLocator.Add(1, 2);

            locator.Get<string>(1, SearchMode.Local);
        }
コード例 #11
0
ファイル: LocatorEncoder.cs プロジェクト: Egipto87/DOOP.ec
        public static void GetLocator(this IoBuffer buffer, ref Locator obj)
        {
            obj.Kind = (LocatorKind)buffer.GetInt32();
            obj.Port = (int)buffer.GetInt32(); ;
            byte[] tmp = new byte[16];

            buffer.Get(tmp, 0, 16);
            obj.SocketAddressBytes = tmp;
        }
コード例 #12
0
ファイル: UDPReceiver.cs プロジェクト: Egipto87/DOOP.ec
 public UDPReceiver(Uri uri, int bufferSize)
 {
     this.uri = uri;
     this.bufferSize = bufferSize;
     var addresses = System.Net.Dns.GetHostAddresses(uri.Host);
     int port = (uri.Port < 0 ? 0 : uri.Port);
     if (addresses != null && addresses.Length >= 1)
         this.locator = new Locator(addresses[0], port);
 }
コード例 #13
0
ファイル: WebControl.cs プロジェクト: geeksree/cSharpGeeks
 public WebControl(Browser aBrowser, Locator aLocator)
 {
     myControlAccess = new ControlAccess();
     myControlAccess.Browser = aBrowser;
     myControlAccess.LocatorType = aLocator.LocatorType;
     myControlAccess.Locator = aLocator.ControlLocator;
     myControlAccess.ControlType = ControlType.Custom;
     myControlAccess.IntializeControlAccess();
     //Control = myControlAccess.GetControl();
 }
コード例 #14
0
		public void ReadOnlyLocatorCountReflectsInnerLocatorCount()
		{
			Locator innerLocator = new Locator();
			ReadOnlyLocator locator = new ReadOnlyLocator(innerLocator);

			innerLocator.Add(1, 1);
			innerLocator.Add(2, 2);

			Assert.AreEqual(innerLocator.Count, locator.Count);
		}
コード例 #15
0
        private void MyMap_MouseClick(object sender, ESRI.ArcGIS.Client.Map.MouseEventArgs e)
        {
            Locator locatorTask = new Locator("http://geocode.arcgis.com/arcgis/rest/services/World/GeocodeServer");
            locatorTask.LocationToAddressCompleted += LocatorTask_LocationToAddressCompleted;
            locatorTask.Failed += LocatorTask_Failed;

            // Tolerance (distance) specified in meters
            double tolerance = 30;
            locatorTask.LocationToAddressAsync(e.MapPoint, tolerance, e.MapPoint);
        }
コード例 #16
0
		public void ParentLocatorOfReadOnlyLocatorIsAlsoReadOnly()
		{
			Locator parentInnerLocator = new Locator();
			Locator childInnerLocator = new Locator(parentInnerLocator);
			ReadOnlyLocator childLocator = new ReadOnlyLocator(childInnerLocator);

			IReadableLocator parentLocator = childLocator.ParentLocator;

			Assert.IsTrue(parentLocator.ReadOnly);
			Assert.IsNull(parentLocator as IReadWriteLocator);
		}
コード例 #17
0
        /**
         * Copy an existing Locator or Locator2 object.
         * If the object implements Locator2, values of the
         * <em>encoding</em> and <em>version</em>strings are copied,
         * otherwise they set to <em>null</em>.
         *
         * @param locator The existing Locator object.
         */
        public Locator2Impl(Locator locator)
            : base(locator)
        {
            if (locator is Locator2)
            {
                Locator2 l2 = (Locator2)locator;

                version = l2.getXMLVersion();
                encoding = l2.getEncoding();
            }
        }
コード例 #18
0
		public void ItemsContainedInLocatorContainedInReadOnlyLocator()
		{
			Locator innerLocator = new Locator();
			ReadOnlyLocator locator = new ReadOnlyLocator(innerLocator);

			innerLocator.Add(1, 1);
			innerLocator.Add(2, 2);

			Assert.IsTrue(locator.Contains(1));
			Assert.IsTrue(locator.Contains(2));
			Assert.IsFalse(locator.Contains(3));
		}
コード例 #19
0
ファイル: PostActionsHelper.cs プロジェクト: tomdef/nTeamCity
        public static void AddBuildTags(TCConnection connection, string locatorBuildValue, Locator locator, params string[] tags)
        {
            var url = connection.UrlResolver.ResolveURL<BuildTagCollectionInfo>(locatorBuildValue, locator);
            RestRequest request = new RestRequest(url, Method.POST);

            BuildTagsInfo tagsInfo = new BuildTagsInfo()
            {
                Tags = tags
            };

            connection.CallPostRequest<BuildTagsInfo>(request, tagsInfo);
        }
コード例 #20
0
ファイル: ARPLocation.cs プロジェクト: pedroneto/Monografia
 ARPLocation(Locator locator)
 {
     if (locator==null){
       inputName = "unknown-source";
       publicId = "unknown-source";
       endLine = -1;
       endColumn = -1;
     }else {
     inputName = locator.getSystemId();
     endLine = locator.getLineNumber();
     endColumn = locator.getColumnNumber();
     publicId = locator.getPublicId();
     }
 }
コード例 #21
0
ファイル: LocatorFixture.cs プロジェクト: bnantz/NCS-V2-0
        public void AskingParentStopsAsSoonAsWeFindAMatch()
        {
            object o1 = new object();
            object o2 = new object();
            IReadWriteLocator rootLocator = new Locator();
            IReadWriteLocator childLocator = new Locator(rootLocator);
            IReadWriteLocator grandchildLocator = new Locator(childLocator);

            rootLocator.Add("foo", o1);
            childLocator.Add("foo", o2);

            object result = grandchildLocator.Get("foo", SearchMode.Up);

            Assert.IsNotNull(result);
            Assert.AreSame(o2, result);
        }
コード例 #22
0
        private void FindButton_Click(object sender, RoutedEventArgs e)
        {
            if (string.IsNullOrEmpty(SearchTextBox.Text))
                return;

            // Clear existing graphics for a new search
            FindResultLocationsGraphicsLayer.Graphics.Clear();
            MyLocationGraphicsLayer.Graphics.Clear();
            MyRoutesGraphicsLayer.Graphics.Clear();

            // Initialize the LocatorTask with the Esri World Geocoding Service
            var locatorTask = new Locator("http://geocode.arcgis.com/arcgis/rest/services/World/GeocodeServer");

            // In this sample, the center of the map is used as the location from which results will be ranked and distance calculated.
            // The distance from the location is optional.  Specifies the radius of an area around a point location which is used to boost
            // the rank of geocoding candidates so that candidates closest to the location are returned first. The distance value is in meters.
            LocatorFindParameters locatorFindParams = new LocatorFindParameters()
            {
                Text = SearchTextBox.Text,
                Location = MyMap.Extent.GetCenter(),
                Distance = MyMap.Extent.Width / 2,
                MaxLocations = 5,
                OutSpatialReference = MyMap.SpatialReference,
                SearchExtent = MyMap.Extent
            };
            locatorFindParams.OutFields.AddRange(new string[] { "PlaceName", "City", "Region", "Country", "Score", "Distance", "Type" });

            locatorTask.FindCompleted += (s, ee) =>
            {
                // When a Find operation is initiated, get the find results and add to a graphics layer for display in the map
                LocatorFindResult locatorFindResult = ee.Result;
                foreach (Location location in locatorFindResult.Locations)
                {
                    // Make sure results have the right spatial reference
                    location.Graphic.Geometry.SpatialReference = MyMap.SpatialReference;

                    FindResultLocationsGraphicsLayer.Graphics.Add(location.Graphic);
                }
            };

            locatorTask.Failed += (s, ee) =>
            {
                MessageBox.Show("Locator service failed: " + ee.Error);
            };

            locatorTask.FindAsync(locatorFindParams);
        }
コード例 #23
0
        public void BeginScopeRelease_WithRegisterdObject_ShouldBeAssignableToIDoSomething(Locator.Interface.IScopedServiceLocator sut)
        {
            using (sut.BeginScope())
            {
                var instance1 = sut.Resolve<IDoSomething>();

                var instance2 = sut.Resolve<IDoSomething>();

                instance1.ShouldBeAssignableTo(typeof(IDoSomething));

                instance2.ShouldBeAssignableTo(typeof(IDoSomething));

                instance1.ShouldBeSameAs(instance2);

                sut.Release(instance1);
            }
        }
コード例 #24
0
ファイル: StartMenu.cs プロジェクト: grimlor/GGJ_SpyHeart
    public void onLocationServerInitialized(Locator.LocationResult result)
    {
        Debug.Log(result.Message);

        if (result.Success)
        {
            try {
                API.Instance.Call("Register", onRegisterCompleted, Locator.Instance.GetLocation().latitude, Locator.Instance.GetLocation().longitude);
            } catch (System.Exception ex) {
                Gui.DebuggingLabel.text = ex.Message;
            }
        }
        else
        {
            Gui.DebuggingLabel.text = result.Message;
        }
    }
コード例 #25
0
ファイル: Compare.cs プロジェクト: fjiang2/sqlcon
        public static int GenerateRows(StreamWriter writer, TableSchema schema, Locator where, bool hasIfExists)
        {
            TableName tableName = schema.TableName;
            string sql = string.Format("SELECT * FROM {0}", tableName);
            if (where != null)
                sql = string.Format("SELECT * FROM {0} WHERE {1}", tableName, where);

            SqlCmd cmd = new SqlCmd(tableName.Provider, sql);
            TableClause script = new TableClause(schema);

            int count = 0;
            cmd.Read(
                reader =>
                {
                    DataTable schema1 = reader.GetSchemaTable();

                    string[] columns = schema1.AsEnumerable().Select(row => row.Field<string>("ColumnName")).ToArray();
                    object[] values = new object[columns.Length];

                    while (reader.HasRows)
                    {
                        while (reader.Read())
                        {
                            reader.GetValues(values);
                            if (hasIfExists)
                                writer.WriteLine(script.IF_NOT_EXISTS_INSERT(columns, values));
                            else
                                writer.WriteLine(script.INSERT(columns, values));

                            count++;
                            if (count % 5000 == 0)
                                writer.WriteLine(TableClause.GO);

                        }
                        reader.NextResult();
                    }
                });

            if (count != 0)
                writer.WriteLine(TableClause.GO);

            return count;
        }
        public RoutingDirectionsTaskAsync()
        {
            InitializeComponent();

            _locator = new Locator("http://geocode.arcgis.com/arcgis/rest/services/World/GeocodeServer");

            _routeTask = new RouteTask("http://sampleserver6.arcgisonline.com/arcgis/rest/services/NetworkAnalysis/SanDiego/NAServer/Route");

            _routeParams = new RouteParameters()
            {
                ReturnRoutes = false,
                ReturnDirections = true,
                DirectionsLengthUnits = esriUnits.esriMiles,
                Stops = _stops,
                UseTimeWindows = false,
            };

            _routeGraphicsLayer = (MyMap.Layers["MyRouteGraphicsLayer"] as GraphicsLayer);            
        }
コード例 #27
0
        private void MyMap_MapGesture(object sender, Map.MapGestureEventArgs e)
        {
            if (e.Gesture == GestureType.Tap && MyMap.Extent != null)
            {
                Locator locatorTask = new Locator("http://geocode.arcgis.com/arcgis/rest/services/World/GeocodeServer");
                locatorTask.LocationToAddressCompleted += LocatorTask_LocationToAddressCompleted;
                locatorTask.Failed += LocatorTask_Failed;

                // Tolerance (distance) specified in meters
                double tolerance = 30;
                locatorTask.LocationToAddressAsync(e.MapPoint, tolerance);

                Graphic graphic = new Graphic()
                {
                    Symbol = DefaultMarkerSymbol,
                    Geometry = e.MapPoint
                };
                GraphicsLayer graphicsLayer = MyMap.Layers["MyGraphicsLayer"] as GraphicsLayer;
                graphicsLayer.Graphics.Clear();
                graphicsLayer.Graphics.Add(graphic);
            }
        }
コード例 #28
0
        public void CanEnumerateItemsInReadOnlyLocator()
        {
            Locator innerLocator = new Locator();
            ReadOnlyLocator locator = new ReadOnlyLocator(innerLocator);

            innerLocator.Add(1, 1);
            innerLocator.Add(2, 2);

            bool sawOne = false;
            bool sawTwo = false;

            foreach (KeyValuePair<object, object> pair in locator)
            {
                if (pair.Key.Equals(1))
                    sawOne = true;
                if (pair.Key.Equals(2))
                    sawTwo = true;
            }

            Assert.IsTrue(sawOne);
            Assert.IsTrue(sawTwo);
        }
コード例 #29
0
        public WorldGeocoding()
        {
            InitializeComponent();

            // Initialize Locator with ArcGIS Online World Geocoding Service.  See http://geocode.arcgis.com for details and doc.
            _locatorTask = new Locator("http://geocode.arcgis.com/arcgis/rest/services/World/GeocodeServer");
            _locatorTask.FindCompleted += (s, a) =>
            {
                // When a Find operation is initiated, get the find results and add to a graphics layer for display in the map
                LocatorFindResult locatorFindResult = a.Result;
                foreach (Location location in locatorFindResult.Locations)
                {
                    FindResultLocationsGraphicsLayer.Graphics.Add(location.Graphic);
                }
            };
            _locatorTask.Failed += (s, e) =>
            {
                MessageBox.Show("Locator service failed: " + e.Error);
            };

            FindResultLocationsGraphicsLayer = MyMap.Layers["FindResultLocationsGraphicsLayer"] as GraphicsLayer;
        }
コード例 #30
0
        public RoutingDirections()
        {
            InitializeComponent();

            _routeParams = new RouteParameters()
            {
                ReturnRoutes = false,
                ReturnDirections = true,
                DirectionsLengthUnits = esriUnits.esriMiles,
                Stops = _stops,
                UseTimeWindows = false,
            };

            _routeTask =
                new RouteTask("http://sampleserver6.arcgisonline.com/arcgis/rest/services/NetworkAnalysis/SanDiego/NAServer/Route");
            _routeTask.SolveCompleted += routeTask_SolveCompleted;
            _routeTask.Failed += task_Failed;

            _locator =
                new Locator("http://geocode.arcgis.com/arcgis/rest/services/World/GeocodeServer");
            _locator.FindCompleted += locator_FindCompleted;
            _locator.Failed += task_Failed;
        }
コード例 #31
0
        protected override void Handle(ConnectionToGridiaServerHandler connection, JObject data)
        {
            var message = (string)data["message"];

            Locator.Get <HelpMenu>().AddAlert(message);
        }
コード例 #32
0
ファイル: BusManager.cs プロジェクト: alfishe/ZXMAK2
        public void LoadConfigXml(XmlNode busNode)
        {
            //LogAgent.Debug("time begin BusManager.LoadConfig");
            Disconnect();

            Name = null;
            if (busNode.Attributes["name"] != null)
            {
                Name = busNode.Attributes["name"].InnerText;
            }
            ModelId = ModelId.None;
            if (busNode.Attributes["modelId"] != null)
            {
                var value   = busNode.Attributes["modelId"].InnerText;
                var modelId = ModelId.None;
                if (!Enum.TryParse <ModelId>(value, out modelId))
                {
                    Logger.Warn("Unknown modelId: {0}", value);
                }
                else
                {
                    ModelId = modelId;
                }
            }

            // store old devices to allow reuse & save state
            var oldDevices = new Dictionary <string, BusDeviceBase>();

            foreach (BusDeviceBase device in m_deviceList)
            {
                oldDevices.Add(getDeviceKey(device.GetType()), device);
            }
            Clear();
            var orderCounter = 0;
            // "Device"
            var deviceNodes = busNode.ChildNodes
                              .OfType <XmlNode>()
                              .Where(node => string.Compare(node.Name, "Device", true) == 0)
                              .Where(node => !string.IsNullOrEmpty(GetAttrString(node, "type")))
                              .Where(node => GetAttrString(node, "type").Trim() != string.Empty);

            foreach (XmlNode node in deviceNodes)
            {
                try
                {
                    var fullTypeName = GetAttrString(node, "type");
                    var type         = GetTypeByName(fullTypeName, GetAttrString(node, "assembly"));
                    if (type == null)
                    {
                        Logger.Error("Type not found: {0}", fullTypeName);
                        continue;
                    }
                    if (!typeof(BusDeviceBase).IsAssignableFrom(type))
                    {
                        Logger.Error("Invalid Device: {0}", type.FullName);
                        continue;
                    }
                    BusDeviceBase device = null;
                    string        key    = getDeviceKey(type);
                    if (oldDevices.ContainsKey(key))
                    {
                        //reuse
                        device = oldDevices[key];
                    }
                    else
                    {
                        //create new
                        device = (BusDeviceBase)Activator.CreateInstance(type);
                    }
                    device.BusOrder = orderCounter++;

                    device.LoadConfigXml(node);
                    Add(device);
                }
                catch (Exception ex)
                {
                    Logger.Error(ex);
                    Locator.Resolve <IUserMessage>()
                    .Error("Load device failed: {0}", ex.Message);
                }
            }
            Sort();
            Connect();
            //LogAgent.Debug("time end BusManager.LoadConfig");
        }
コード例 #33
0
ファイル: RxApp.cs プロジェクト: oleg-abr/ReactiveUI
        static RxApp()
        {
#if !PORTABLE
            _TaskpoolScheduler = TaskPoolScheduler.Default;
#endif

            // Initialize this to false as most platforms do not support
            // range notification for INotifyCollectionChanged
#if WP8 || WINRT
            SupportsRangeNotifications = false;
#else
            SupportsRangeNotifications = true;
#endif

            Locator.RegisterResolverCallbackChanged(() => {
                if (Locator.CurrentMutable == null)
                {
                    return;
                }
                Locator.CurrentMutable.InitializeReactiveUI();
            });

            DefaultExceptionHandler = Observer.Create <Exception>(ex => {
                // NB: If you're seeing this, it means that an
                // ObservableAsPropertyHelper or the CanExecute of a
                // ReactiveCommand ended in an OnError. Instead of silently
                // breaking, ReactiveUI will halt here if a debugger is attached.
                if (Debugger.IsAttached)
                {
                    Debugger.Break();
                }

                RxApp.MainThreadScheduler.Schedule(() => {
                    throw new Exception(
                        "An OnError occurred on an object (usually ObservableAsPropertyHelper) that would break a binding or command. To prevent this, Subscribe to the ThrownExceptions property of your objects",
                        ex);
                });
            });

            if (ModeDetector.InUnitTestRunner())
            {
                LogHost.Default.Warn("*** Detected Unit Test Runner, setting MainThreadScheduler to CurrentThread ***");
                LogHost.Default.Warn("If we are not actually in a test runner, please file a bug\n\n");
                LogHost.Default.Warn("ReactiveUI acts differently under a test runner, see the docs\n");
                LogHost.Default.Warn("for more info about what to expect");

                _MainThreadScheduler = CurrentThreadScheduler.Instance;
                return;
            }
            else
            {
                LogHost.Default.Info("Initializing to normal mode");
            }

            if (_MainThreadScheduler == null)
            {
                _MainThreadScheduler = DefaultScheduler.Instance;
            }

            SuspensionHost = new SuspensionHost();
        }
コード例 #34
0
 public ListomatorShell()
 {
     InitializeComponent();
     BindingContext = Locator.GetClass <ListomatorShellViewModel>();
 }
コード例 #35
0
 public ManageItem(ToDoGroup group)
 {
     InitializeComponent();
     BindingContext = Locator.GetClass <ManageItemViewModel>(group);
 }
コード例 #36
0
 public WebListBox(Browser aBrowser, Locator aLocator)
     : base(aBrowser, aLocator.LocatorType, aLocator.ControlLocator, ControlType.ListBox)
 {
 }
コード例 #37
0
 /// <summary>
 /// Gets a url for a given <see cref="Locator"/> that's accessible by MediaInfo on the local machine
 /// </summary>
 /// <param name="locator"></param>
 /// <returns></returns>
 public Task <string> GetMediaInfoAccessibleLocation(Locator locator)
 {
     return(Task.FromResult(locator is LocalLocator local ? Path.Combine(local.FolderPath, local.FileName) : null));
 }
コード例 #38
0
 public static By ToWebDriverBy(this Locator locator)
 {
     return(LocatorHelper.GetWebDriverBy(locator));
 }
コード例 #39
0
 public T Find <T>(Locator locator) where T : IElement, new() => WebElementFactory.Create <T>(this, locator);
コード例 #40
0
 public void WaitForElementNotVisible(Locator locator, ILogger log)
 {
     throw new NotImplementedException();
 }
コード例 #41
0
        static async Task <Location> PlatformLocationAsync(GeolocationRequest request, CancellationToken cancellationToken)
        {
            await Permissions.EnsureGrantedAsync <Permissions.LocationWhenInUse>();

            Locator service = null;
            var     gps     = Platform.GetFeatureInfo <bool>("location.gps");
            var     wps     = Platform.GetFeatureInfo <bool>("location.wps");

            if (gps)
            {
                if (wps)
                {
                    service = new Locator(LocationType.Hybrid);
                }
                else
                {
                    service = new Locator(LocationType.Gps);
                }
            }
            else
            {
                if (wps)
                {
                    service = new Locator(LocationType.Wps);
                }
                else
                {
                    service = new Locator(LocationType.Passive);
                }
            }

            var tcs = new TaskCompletionSource <bool>();

            cancellationToken = Utils.TimeoutToken(cancellationToken, request.Timeout);
            cancellationToken.Register(() =>
            {
                service?.Stop();
                tcs.TrySetResult(false);
            });

            double KmToMetersPerSecond(double km) => km * 0.277778;

            service.LocationChanged += (s, e) =>
            {
                if (e.Location != null)
                {
                    lastKnownLocation.Accuracy  = e.Location.Accuracy;
                    lastKnownLocation.Altitude  = e.Location.Altitude;
                    lastKnownLocation.Course    = e.Location.Direction;
                    lastKnownLocation.Latitude  = e.Location.Latitude;
                    lastKnownLocation.Longitude = e.Location.Longitude;
                    lastKnownLocation.Speed     = KmToMetersPerSecond(e.Location.Speed);
                    lastKnownLocation.Timestamp = e.Location.Timestamp;
                }
                service?.Stop();
                tcs.TrySetResult(true);
            };
            service.Start();

            await tcs.Task;

            return(lastKnownLocation);
        }
コード例 #42
0
 public void Commit()
 {
     Locator.Commit(this.GraphScene.Requests);
 }
コード例 #43
0
 public DatePicker(Locator locator) : base(locator)
 {
 }
コード例 #44
0
        void Update()
        {
            if (inputEnabled)
            {
                if (Input.GetKeyDown(KeyCode.UpArrow))
                {
                    SetupCamera();
                }

                if (Input.GetKeyDown(KeyCode.LeftArrow))
                {
                    if (Locator.GetPlayerSuit().IsWearingHelmet())
                    {
                        Locator.GetPlayerSuit().RemoveHelmet();
                    }
                    else
                    {
                        Locator.GetPlayerSuit().PutOnHelmet();
                    }
                }

                if (Input.GetKeyDown(KeyCode.KeypadDivide))
                {
                    Time.timeScale = 0f;
                }

                if (Input.GetKeyDown(KeyCode.KeypadMultiply))
                {
                    Time.timeScale = 0.5f;
                }

                if (Input.GetKeyDown(KeyCode.KeypadMinus))
                {
                    Time.timeScale = 1f;
                }

                if (Input.GetKeyDown(KeyCode.Keypad0))
                {
                    _freeCam.transform.parent = Locator.GetPlayerTransform();
                }

                if (Input.GetKeyDown(KeyCode.Keypad1))
                {
                    _freeCam.transform.parent = Locator.GetSunTransform();
                }

                if (Input.GetKeyDown(KeyCode.Keypad2))
                {
                    _freeCam.transform.parent = Locator.GetAstroObject(AstroObject.Name.Comet).gameObject.transform;
                }

                if (Input.GetKeyDown(KeyCode.Keypad3))
                {
                    _freeCam.transform.parent = Locator.GetAstroObject(AstroObject.Name.CaveTwin).gameObject.transform;
                }

                if (Input.GetKeyDown(KeyCode.Keypad4))
                {
                    _freeCam.transform.parent = Locator.GetAstroObject(AstroObject.Name.TowerTwin).gameObject.transform;
                }

                if (Input.GetKeyDown(KeyCode.Keypad5))
                {
                    _freeCam.transform.parent = Locator.GetAstroObject(AstroObject.Name.TimberHearth).gameObject.transform;
                }

                if (Input.GetKeyDown(KeyCode.Keypad6))
                {
                    _freeCam.transform.parent = Locator.GetAstroObject(AstroObject.Name.BrittleHollow).gameObject.transform;
                }

                if (Input.GetKeyDown(KeyCode.Keypad7))
                {
                    _freeCam.transform.parent = Locator.GetAstroObject(AstroObject.Name.GiantsDeep).gameObject.transform;
                }

                if (Input.GetKeyDown(KeyCode.Keypad8))
                {
                    _freeCam.transform.parent = Locator.GetAstroObject(AstroObject.Name.DarkBramble).gameObject.transform;
                }

                if (Input.GetKeyDown(KeyCode.Keypad9))
                {
                    _freeCam.transform.position = Locator.GetPlayerTransform().position;
                }

                if (Input.GetKeyDown(KeyCode.KeypadPlus))
                {
                    _moveSpeed = 7f;
                }

                if (Input.GetKeyDown(KeyCode.KeypadEnter))
                {
                    _moveSpeed = 1000f;
                }

                if (Input.GetKeyDown(KeyCode.KeypadPeriod))
                {
                    if (mode)
                    {
                        mode = false;
                        if (_storedMode == InputMode.None)
                        {
                            _storedMode = InputMode.Character;
                        }
                        OWInput.ChangeInputMode(_storedMode);
                        GlobalMessenger <OWCamera> .FireEvent("SwitchActiveCamera", Locator.GetPlayerCamera());

                        _camera.enabled = false;
                        Locator.GetActiveCamera().mainCamera.enabled = true;
                    }
                    else
                    {
                        mode        = true;
                        _storedMode = OWInput.GetInputMode();
                        OWInput.ChangeInputMode(InputMode.None);
                        GlobalMessenger <OWCamera> .FireEvent("SwitchActiveCamera", _OWCamera);

                        Locator.GetActiveCamera().mainCamera.enabled = false;
                        _camera.enabled = true;
                    }
                }
            }
        }
コード例 #45
0
 static BaseUrlHelper()
 {
     Locator = ServiceLocator.Instance;
     Cache   = Locator.Resolve <ICacheProvider>();
 }
コード例 #46
0
        protected virtual Locator NewJazz_GetDatePickerTimeLocator(string itemKey)
        {
            string itemRealValue = ComboBoxItemRepository.GetComboBoxItemRealValue(itemKey);

            return(Locator.GetVariableLocator(ControlLocatorRepository.GetLocator(ControlLocatorKey.NewReactJSjazzDatePickerTimeItem), DATEPICKERITEMVARIABLENAME, itemRealValue));
        }
コード例 #47
0
ファイル: Main.cs プロジェクト: dragonrid/TSManagerment
        private void Main_Load(object sender, EventArgs e)
        {
            UserServices userServices = Locator.GetT <UserServices>();

            dataGridView1.DataSource = userServices.getAllUser();
        }
コード例 #48
0
ファイル: TextField.cs プロジェクト: YangEricLiu/Mento
 public TextField(Locator locator) : base(locator)
 {
 }
コード例 #49
0
        private void OnEvent(MonoBehaviour behaviour, Events ev)
        {
            bool flag = behaviour.GetType() == typeof(Flashlight) && ev == Events.AfterStart;

            if (flag)
            {
                foreach (var item in GameObject.FindObjectsOfType <ProbeCamera>())
                {
                    RenderTexture temp = new RenderTexture(512, 512, 16);
                    temp.Create();
                    item.SetValue("_longExposureSnapshotTexture", temp);
                    temp.SetValue("_origCullingMask", item.GetValue <int>("_origCullingMask") | OWLayerMask.probeLongExposureMask.value);
                }

                PlanetStructure inputStructure = new PlanetStructure
                {
                    name = "invisibleplanet",

                    primaryBody = Locator.GetAstroObject(AstroObject.Name.Sun),
                    aoType      = AstroObject.Type.Planet,
                    aoName      = AstroObject.Name.InvisiblePlanet,

                    position = new Vector3(0, 0, 30000),

                    makeSpawnPoint = true,

                    hasClouds       = true,
                    topCloudSize    = 650f,
                    bottomCloudSize = 600f,
                    cloudTint       = new Color32(0, 75, 15, 128),

                    hasWater  = true,
                    waterSize = 401f,

                    hasRain = true,

                    hasGravity   = true,
                    surfaceAccel = 12f,

                    hasMapMarker = true,

                    hasFog     = true,
                    fogTint    = new Color32(0, 75, 15, 128),
                    fogDensity = 0.75f,

                    hasOrbit = true
                };

                generatedPlanet = GenerateBody(inputStructure);

                if (inputStructure.primaryBody = Locator.GetAstroObject(AstroObject.Name.Sun))
                {
                    generatedPlanet.transform.parent = Locator.GetRootTransform();
                }
                else
                {
                    generatedPlanet.transform.parent = inputStructure.primaryBody.transform;
                }

                generatedPlanet.transform.position = inputStructure.position;
                generatedPlanet.SetActive(true);
            }
        }
コード例 #50
0
 IReadOnlyCollection <IWebElement> INative.FindElements(Locator locator) => DriverFactory.GetDriver.FindElements(locator.ToSeleniumLocator());
コード例 #51
0
        private void ProcessRequestFromClient(ObjectCommandEnvelope cmdMsg)
        {
            try
            {
                BaseCommand parsedCommand = null;
                switch (cmdMsg.Command.Type)
                {
                case CommandType.SubscribeArea:
                    parsedCommand = this.TellArea(cmdMsg, _ => new SubscribeAreaCommand(_));
                    break;

                case CommandType.UnsubscribeArea:
                    parsedCommand = this.TellArea(cmdMsg, _ => new UnsubscribeAreaCommand(_));
                    break;

                case CommandType.ObjectUpdatePosition:
                    parsedCommand = this.TellObject(cmdMsg, _ => new ObjectUpdatePositionCommand(_));
                    break;

                case CommandType.ObjectCreate:
                    parsedCommand = this.TellObject(cmdMsg, _ => new ObjectCreateCommand(_));
                    break;

                case CommandType.ObjectDestroy:
                    parsedCommand = this.TellObject(cmdMsg, _ => new ObjectDestroyCommand(_));
                    break;

                case CommandType.ObjectLock:
                    parsedCommand = this.TellObject(cmdMsg, _ => new ObjectLockCommand(_));
                    break;

                case CommandType.ObjectUnlock:
                    parsedCommand = this.TellObject(cmdMsg, _ => new ObjectUnlockCommand(_));
                    break;

                case CommandType.ObjectValueUpdate:
                    parsedCommand = this.TellObject(cmdMsg, _ => new ObjectValueUpdateCommand(_));
                    break;

                case CommandType.ObjectValueRemove:
                    parsedCommand = this.TellObject(cmdMsg, _ => new ObjectValueRemoveCommand(_));
                    break;

                case CommandType.EventPoint:
                    parsedCommand = this.TellEvent(cmdMsg, _ => new EventPointCommand(_), _ => new[] { Locator.GetAreaIdFromWorldPosition(_.TargetPosition) });
                    break;

                case CommandType.EventLine:
                    parsedCommand = this.TellEvent(cmdMsg, _ => new EventLineCommand(_), _ => Locator.GetAreaIdsWithinWorldBoundaries(_.StartPosition, _.EndPosition));
                    break;
                }

                string commandInfo = parsedCommand != null?parsedCommand.ToString() : string.Empty;

                this.log.Debug($"[Client:{this.state.ClientId} => Server] type: {cmdMsg.Command.Type} ({commandInfo})");
            }
#pragma warning disable CA1031 // Keine allgemeinen Ausnahmetypen abfangen
            catch (Exception e)
#pragma warning restore CA1031 // Keine allgemeinen Ausnahmetypen abfangen
            {
                this.Sender.Tell(new Failure()
                {
                    Exception = e
                });
            }
        }
コード例 #52
0
 IWebElement INative.FindElement(Locator locator, int index) => DriverFactory.GetDriver.FindElement(locator.ToSeleniumLocator());
コード例 #53
0
 public ManageItem(ToDoItem item)
 {
     InitializeComponent();
     BindingContext = Locator.GetClass <ManageItemViewModel>(item);
 }
コード例 #54
0
 public ActionLocationPickState(GridiaAction action)
 {
     _driver = Locator.Get <GridiaDriver>();
     _game   = Locator.Get <GridiaGame>();
     _action = action;
 }
コード例 #55
0
        private void LoadNewDefaultModelAndExtraStuff()
        {
            m_console = new DockableConsole("Log");
            Locator.Register(() => m_console, "console");

            List <OutbreakResponseTeam> orts = new List <OutbreakResponseTeam>();

            Dictionary <string, Tuple <int, Color> > ortCounts = new Dictionary <string, Tuple <int, Color> >();
            string  json = File.ReadAllText(@"Data/Governments.dat");
            dynamic d    = JObject.Parse(json);

            foreach (dynamic govt in d["Governments"])
            {
                string cc           = govt["cc"];
                int    numberOfORTs = govt["ORTs"];
                Color  color        = Color.FromName(govt["Color"].ToString());
                ortCounts.Add(cc, new Tuple <int, Color> (numberOfORTs, color));
            }

            WorldModel = new WorldModel(MapData.LoadFrom("Data/MapData.dat"), SimCountryData.LoadFrom("Data/CountryData.dat"), ortCounts);
            WorldModel.Executive.ClockAboutToChange += exec =>
            {
                DateTime newTime = ((IExecEvent)exec.EventList[0]).When;
                double   howMuch = 100 * (newTime - WorldModel.ExecutionParameters.StartTime).TotalHours /
                                   (WorldModel.ExecutionParameters.EndTime - WorldModel.ExecutionParameters.StartTime).TotalHours;

                m_statusStrip.InvokeIfRequired(strip =>
                {
                    ((ToolStripProgressBar)strip.Items["Progress"]).Value      = (int)howMuch;
                    ((ToolStripStatusLabel)strip.Items["DateTimeStatus"]).Text = newTime.ToString("dd MMM yyy HH:mm:ss");
                });
            };
            WorldModel.Controller.StateChanged += HandleStateChange;

            m_map = new DockableMap();
            m_map.AssignWorldModel(WorldModel);
            DockableTrendChart dc1 = new DockableTrendChart("Mortality");

            dc1.Bind(WorldModel,
                     new[]
            {
                GetTotal(n => n.Killed),
                GetTotal(n => n.Dead)
            },
                     new[]
            {
                "Killed",
                "Dead"
            });

            DockableTrendChart dc2 = new DockableTrendChart("Disease Stages");

            dc2.Bind(WorldModel,
                     new[]
            {
                GetTotal(n => n.ContagiousAsymptomatic),
                GetTotal(n => n.ContagiousSymptomatic),
                GetTotal(n => n.NonContagiousInfected),
                GetTotal(n => n.Immune),
            },
                     new[]
            {
                "ContagiousAsymptomatic",
                "ContagiousSymptomatic",
                "NonContagiousInfected",
                "Immune"
            });

            DockableRegionPieChart drpc1 = new DockableRegionPieChart("Nepal");

            drpc1.Bind(WorldModel, "NPL");
            drpc1.Show(m_dockPanel, DockState.DockLeft);

            DockableRegionPieChart drpc2 = new DockableRegionPieChart("Ireland");

            drpc2.Bind(WorldModel, "IRL");
            drpc2.Show(m_dockPanel, DockState.DockLeft);

            DockablePropertyGrid dpg = new DockablePropertyGrid()
            {
                SelectedObject = WorldModel.ExecutionParameters,
                TabText        = "Simulation Timing"
            };

            dpg.Show(m_dockPanel, DockState.DockLeft);

            DockablePropertyGrid country = new DockablePropertyGrid()
            {
                SelectedObject = WorldModel.CountryForCode("USA"),
                TabText        = "Selected Country",
                ToolTipText    = "Selected Country",
            };

            country.ToolbarVisible = false;
            m_map.CountrySelected += data => country.SelectedObject = data;

            m_map.MdiParent = this;
            m_map.Show(m_dockPanel, DockState.Document);
            ((DockableConsole)m_console).Show(m_dockPanel, DockState.DockBottom);
            country.Show(dpg.Pane, DockAlignment.Bottom, 0.6);
            dc1.Show(m_dockPanel, DockState.DockRight);
            dc2.Show(dc1.Pane, DockAlignment.Bottom, 0.5);
        }
コード例 #56
0
        protected virtual Locator GetInnerMonthPickerMonthLocator(string itemKey)
        {
            string itemRealValue = ComboBoxItemRepository.GetComboBoxItemRealValue(itemKey);

            return(Locator.GetVariableLocator(ControlLocatorRepository.GetLocator(ControlLocatorKey.InnerMonthPickerMonthItem), DATEPICKERITEMVARIABLENAME, itemRealValue));
        }
コード例 #57
0
 public IEnumerable <T> FindAll <T>(Locator locator) where T : IElement, new() => WebElementsCollectionFactory.Create <T>(this, locator);
コード例 #58
0
 private void Start()
 {
     m_World = Locator <IWorld> .GetService();
 }
コード例 #59
0
 public void setDocumentLocator(Locator locator)
 {
 }
コード例 #60
0
            public override Texture GetTexture(int spriteIndex)
            {
                var textures = Locator.Get <TextureManager>(); // :(

                return(textures.Items.GetTextureForSprite(spriteIndex));
            }