Exemple #1
0
        private void btnSelectGDB_Click(object sender, EventArgs e)
        {
            frmOpenFile file = new frmOpenFile();

            file.AddFilter(new MyGxFilterWorkspaces(), true);
            if (file.ShowDialog() == DialogResult.OK)
            {
                IGxDatabase database = file.Items.get_Element(0) as IGxDatabase;
                if (database != null)
                {
                    this.txtGDB.Text = (database as IGxObject).FullName;
                    if (!database.IsConnected)
                    {
                        database.Connect();
                    }
                    IWorkspaceReplicas workspace = database.Workspace as IWorkspaceReplicas;
                    if (workspace != null)
                    {
                        IEnumReplica replicas = workspace.Replicas;
                        replicas.Reset();
                        IReplica replica2 = replicas.Next();
                        if (replica2 != null)
                        {
                            this.lblCheckOutName.Text = replica2.Name;
                            this.txtGDB.Tag           = database.WorkspaceName;
                        }
                        else
                        {
                            this.txtGDB.Tag = null;
                        }
                    }
                }
            }
        }
Exemple #2
0
 public void Init()
 {
     if (CheckInHelper.m_pHelper.MasterWorkspaceName != null)
     {
         this.panel_by_MasterGDB.Visible = true;
         this.panelbycheckoutdb.Visible  = false;
         this.lblCheckInGDB.Text         = this.method_0(CheckInHelper.m_pHelper.MasterWorkspaceName);
         this.radioGroup1_SelectedIndexChanged(this, new EventArgs());
     }
     else
     {
         this.panel_by_MasterGDB.Visible = false;
         this.panelbycheckoutdb.Visible  = true;
         IWorkspace         workspace = (CheckInHelper.m_pHelper.CheckoutWorkspaceName as IName).Open() as IWorkspace;
         IWorkspaceReplicas replicas  = workspace as IWorkspaceReplicas;
         IEnumReplica       replica   = replicas.Replicas;
         replica.Reset();
         IReplica replica2 = replica.Next();
         if (replica2 != null)
         {
             this.lblCheckOutName1.Text = replica2.Name;
             this.lblMasterGDB2.Text    = this.method_0(replica2.ConnectionInfo);
             this.lblMasterGDB2.Tag     = replica2.ConnectionInfo;
             this.lblCheckInGDB2.Text   = this.method_0(CheckInHelper.m_pHelper.CheckoutWorkspaceName);
         }
     }
 }
Exemple #3
0
        private static IList <IReplica> SetUpGroup(Operator operatorData, int ourId, IReplica localReplica)
        {
            var peers     = new List <IReplica>();
            var nReplicas = operatorData.replicaURLs.Count;

            for (var peerId = 0; peerId < nReplicas; peerId++)
            {
                if (peerId == ourId)
                {
                    peers.Add(localReplica);
                    continue;
                }

                var peerUrl = operatorData.replicaURLs[peerId];

                try
                {
                    var peerProxy = (IOperatorProcess)Activator.GetObject(typeof(IOperatorProcess), peerUrl);

                    peers.Add(new PeerReplica(operatorData.id, peerId, peerProxy));

                    Console.WriteLine("[Replica] Created proxy to peer at {0}.", peerUrl);
                }
                catch (Exception e)
                {
                    Console.WriteLine("[Replica] Unable to create a proxy to peer at {0}. Cause: {1}", peerUrl, e.Message);
                }
            }

            return(peers);
        }
        public virtual bool Remove(IReplica replica)
        {
            var publicationRef = replica.PublicationRef;
            var random         = publicationRef.PublicationId.HashCode;

            OnOperation(random);
            if (!_handles.TryGetValue(publicationRef, out var handle))
            {
                return(false);
            }
            var target = handle.Target;

            if (target != null && !ReferenceEquals(target, replica))
            {
                // GCHandle target is pointing to another replica
                return(false);
            }
            if (!_handles.TryRemove(publicationRef, handle))
            {
                // Some other thread already removed this entry
                return(false);
            }
            // The thread that succeeds in removal releases gcHandle as well
            _gcHandlePool.Release(handle, random);
            return(true);
        }
Exemple #5
0
        public void SendConstruction(IReplica replica, bool newReplica = true, ICollection <IPEndPoint> endPoints = null)
        {
            var recipients = endPoints ?? _connections.Keys;

            if (newReplica)
            {
                _replicas[replica] = _networkId++;
            }

            using var stream = new MemoryStream();
            using var writer = new BitWriter(stream);

            writer.Write((byte)MessageIdentifier.ReplicaManagerConstruction);
            writer.WriteBit(true);
            writer.Write(_replicas[replica]);

            replica.Construct(writer);

            foreach (var endPoint in recipients)
            {
                if (_connections.TryGetValue(endPoint, out var conn))
                {
                    conn.Send(stream.ToArray());
                }
            }
        }
Exemple #6
0
        private void method_11()
        {
            esriExportDataChangesOption esriExportToAccess = esriExportDataChangesOption.esriExportToAccess;

            if (Path.GetExtension(this.string_0).ToLower() == ".xml")
            {
                esriExportToAccess = esriExportDataChangesOption.esriExportToXML;
            }
            IExportDataChanges changes   = new DataChangesExporterClass();
            IName              name      = this.iworkspaceName_0 as IName;
            IWorkspace         workspace = name.Open() as IWorkspace;
            IWorkspaceReplicas replicas  = workspace as IWorkspaceReplicas;
            IEnumReplica       replica   = replicas.Replicas;

            replica.Reset();
            if (replica != null)
            {
                for (IReplica replica2 = replica.Next(); replica2 != null; replica2 = replica.Next())
                {
                    if (replica2.ReplicaRole == esriReplicaType.esriCheckOutTypeChild)
                    {
                        IReplicaDataChangesInit init = new CheckOutDataChangesClass();
                        init.Init(replica2, this.iworkspaceName_0);
                        IDataChanges dataChanges = init as IDataChanges;
                        changes.ExportDataChanges(this.string_0, esriExportToAccess, dataChanges, true);
                    }
                }
            }
        }
Exemple #7
0
        public void SetPeerAsDead(IReplica deadPeer)
        {
            Debug.Assert(deadPeer != LocalReplica);
            lock (AliveMembers)
            {
                NoOwner.UnionWith(deadPeer.PopOwnedTuples());
                AliveMembers.Remove(deadPeer);
            }

            if (AmILeader() && NoOwner.Count > 0)
            {
                foreach (var freeTuple in NoOwner)
                {
                    Queue <int> interestedPeers;
                    if (Shared.TryGetValue(freeTuple, out interestedPeers))
                    {
                        var interestedAlivePeer = interestedPeers
                                                  .Select(id => AllMembers[id])
                                                  .Intersect(AliveMembers)
                                                  .FirstOrDefault();

                        if (interestedAlivePeer != null)
                        {
                            RMSend(r => r.SetOwner(freeTuple, interestedAlivePeer.ReplicaId));
                        }
                        else
                        {
                            var chosenPeerIdx = LocalRoutingStrategy.Route(freeTuple.Content, AliveMembers.Count);
                            var chosenPeer    = AliveMembers[chosenPeerIdx];
                            RMSend(p => p.SetOwner(freeTuple, chosenPeer.ReplicaId));
                        }
                    }
                }
            }
        }
 protected virtual void OnReplicaDisposed(IReplica replica)
 {
     if (replica.Replicator != this)
     {
         throw new ArgumentOutOfRangeException(nameof(replica));
     }
     GetChannelProcessor(replica.PublicationRef.PublisherId).Unsubscribe(replica);
 }
Exemple #9
0
        public void SendSerialization(IReplica replica, ICollection <IPEndPoint> endpoints = null)
        {
            var recipients = endpoints ?? _connected.ToArray();
            var stream     = new BitStream();

            stream.WriteByte((byte)MessageIdentifiers.ReplicaManagerSerialize);
            stream.WriteUShort(_replicas[replica]);
            stream.WriteSerializable(replica);

            _server.Send(stream, recipients);
        }
 public void Unfreeze(string opID, int index)
 {
     if (!String.IsNullOrEmpty(opID))
     {
         OperatorNode op = nodes[opID];
         if (index >= 0 && index < op.Replicas.Count)
         {
             IReplica rep = op.Replicas[index];
             rep.Unfreeze(index);
         }
     }
 }
Exemple #11
0
 public GroupManager(IList <IReplica> allMembers, IReplica localReplica, MonitoringProcess monitoringProcess, ITupleRoutingStrategy localRoutingStrategy)
 {
     AllMembers           = new List <IReplica>(allMembers);
     AliveMembers         = new List <IReplica>(allMembers);
     Shared               = new Dictionary <DadTuple, Queue <int> >();
     LocalReplica         = localReplica;
     Processed            = new Dictionary <DadTupleId, IList <DadTuple> >();
     Delivered            = new HashSet <DadTupleId>();
     Deleted              = new HashSet <DadTupleId>();
     MonitoringProcess    = monitoringProcess;
     NoOwner              = new HashSet <DadTuple>();
     LocalRoutingStrategy = localRoutingStrategy;
 }
        public void BeginSync(IReplica toReplica)
        {
            _context.ToReplica = toReplica;
            _context.Logger.Info(string.Format("Begin sync from replica name: {0} ID: {1} | to replica name: {2} ID: {3}",
                                               _context.LocalReplica.Name, _context.LocalReplica.Id, toReplica.Name, toReplica.Id));

            var syncRequest         = new SyncRequest <TItem, TId>(_context);
            var syncResult          = SendSyncRequestToRemoteReplica(syncRequest);
            var conflictResolutions = ResolveItemConflicts(syncResult);

            SendChangedItemsToRemoteReplica(syncResult.ChangesRequest, conflictResolutions);

            _context.Logger.Info(string.Format("Finished sync from replica name: {0} ID: {1} | to replica name: {2} ID: {3}",
                                               _context.LocalReplica.Name, _context.LocalReplica.Id, toReplica.Name, toReplica.Id));
        }
        private void ExportChangeSetupCtrl_Load(object sender, EventArgs e)
        {
            this.lblCheckOutGDB.Text = this.method_0(ExportChangesHelper.m_pHelper.CheckoutWorkspaceName);
            IWorkspace         workspace = (ExportChangesHelper.m_pHelper.CheckoutWorkspaceName as IName).Open() as IWorkspace;
            IWorkspaceReplicas replicas  = workspace as IWorkspaceReplicas;
            IEnumReplica       replica   = replicas.Replicas;

            replica.Reset();
            IReplica replica2 = replica.Next();

            if (replica2 != null)
            {
                this.lblCheckOutName.Text = replica2.Name;
            }
        }
Exemple #14
0
        public static void SimpleCheckIn(IWorkspaceName iworkspaceName_0, IWorkspaceName iworkspaceName_1,
                                         IEnumName ienumName_0, bool bool_0, bool bool_1, string string_0)
        {
            IName              name              = iworkspaceName_1 as IName;
            IWorkspace         workspace         = name.Open() as IWorkspace;
            IWorkspaceReplicas workspaceReplicas = workspace as IWorkspaceReplicas;
            IReplica           replica           = workspaceReplicas.Replicas.Next();
            IWorkspace         arg_36_0          = (iworkspaceName_0 as IName).Open() as IWorkspace;
            ICheckIn           checkIn           = new CheckIn();

            if (bool_1)
            {
                checkIn.CheckInFromGDB(iworkspaceName_0, replica.Name, iworkspaceName_1, false, false);
            }
        }
Exemple #15
0
        private void connectToReplica(string repl_url)
        {
            Boolean connected = false;

            while (!connected)
            {
                try{
                    IReplica repl = (IReplica)Activator.GetObject(typeof(IReplica), repl_url);
                    replicas_by_url.Add(repl_url, repl);
                    connected = true;
                }catch (Exception) {
                    log("Retring connect to " + repl_url);
                }
                Thread.Sleep(1000);
            }
        }
Exemple #16
0
        private void frmCheckOutManager_Load(object sender, EventArgs e)
        {
            if (this.iarray_0.Count == 1)
            {
                CheckInOutWorkspaceInfo info = this.iarray_0.get_Element(0) as CheckInOutWorkspaceInfo;
                this.iworkspace_0 = info.Workspace;
            }
            else
            {
                if (this.iarray_0.Count <= 0)
                {
                    return;
                }
                frmSelectWorkspace workspace = new frmSelectWorkspace
                {
                    WorkspaceArray = this.iarray_0
                };
                if (workspace.ShowDialog() != DialogResult.OK)
                {
                    base.Close();
                    return;
                }
                this.iworkspace_0 = workspace.Workspace;
            }
            IWorkspaceReplicas replicas = this.iworkspace_0 as IWorkspaceReplicas;
            IEnumReplica       replica  = replicas.Replicas;

            replica.Reset();
            IReplica replica2 = replica.Next();

            string[] items = new string[4];
            while (replica2 != null)
            {
                items[0] = replica2.Name;
                items[1] = replica2.Owner;
                items[2] = replica2.Version;
                items[3] = new DateTime((long)replica2.ReplicaDate).ToString();
                ListViewItem item = new ListViewItem(items)
                {
                    Tag = replica2
                };
                this.listView1.Items.Add(item);
                replica2 = replica.Next();
            }
        }
 public void Subscribe(IReplica replica, Action <IReplica> callback)
 {
     Console.WriteLine("[MONITOR] Subscribing to death of {0}.", replica);
     lock (this)
     {
         ICollection <Action <IReplica> > replicaCallbacks;
         if (CallbacksPerReplica.TryGetValue(replica, out replicaCallbacks))
         {
             replicaCallbacks.Add(callback);
         }
         else
         {
             CallbacksPerReplica.Add(replica, new List <Action <IReplica> > {
                 callback
             });
         }
     }
 }
Exemple #18
0
        private void btnSelectDelta_Click(object sender, EventArgs e)
        {
            OpenFileDialog dialog = new OpenFileDialog
            {
                Filter      = "*.mdb|*.mdb|*.xml|*.xml",
                Multiselect = false
            };

            if (dialog.ShowDialog() == DialogResult.OK)
            {
                this.bool_0 = false;
                this.lblCheckOutName.Text = "";
                this.txtDelta.Text        = "";
                string fileName = dialog.FileName;
                esriExportDataChangesOption esriExportToAccess = esriExportDataChangesOption.esriExportToAccess;
                if (dialog.FilterIndex == 2)
                {
                    esriExportToAccess = esriExportDataChangesOption.esriExportToXML;
                }
                IDeltaDataChangesInit init = new DeltaDataChangesClass();
                try
                {
                    init.Init(fileName, esriExportToAccess);
                    IDeltaDataChanges changes = init as IDeltaDataChanges;
                    this.txtDelta.Text = fileName;
                    this.txtDelta.Tag  = changes.Container;
                    IDataChanges changes2 = init as IDataChanges;
                    if (changes2.ParentWorkspaceName != null)
                    {
                        IWorkspace workspace = (changes2.ParentWorkspaceName as IName).Open() as IWorkspace;
                        IReplica   replica   = (workspace as IWorkspaceReplicas).get_ReplicaByID(changes2.ParentReplicaID);
                        if (replica != null)
                        {
                            this.lblCheckOutName.Text = replica.Name;
                            this.bool_0 = true;
                        }
                    }
                }
                catch (Exception)
                {
                    MessageBox.Show("检入空间中没有检出数据或检出数据无效!");
                }
            }
        }
Exemple #19
0
        public void SendConstruction(IReplica replica, bool newReplica = true, ICollection <IPEndPoint> endpoints = null)
        {
            var recipients = endpoints ?? _connected.ToArray();

            if (newReplica)
            {
                _replicas[replica] = _networkId++;
            }

            var stream = new BitStream();

            stream.WriteByte((byte)MessageIdentifiers.ReplicaManagerConstruction);
            stream.WriteBit(true);
            stream.WriteUShort(_replicas[replica]);

            replica.Construct(stream);

            _server.Send(stream, recipients);
        }
Exemple #20
0
        private bool method_0(string string_0, IWorkspaceReplicas iworkspaceReplicas_0)
        {
            ISQLSyntax   syntax   = iworkspaceReplicas_0 as ISQLSyntax;
            IEnumReplica replicas = iworkspaceReplicas_0.Replicas;

            replicas.Reset();
            for (IReplica replica2 = replicas.Next(); replica2 != null; replica2 = replicas.Next())
            {
                if (replica2.ReplicaRole == esriReplicaType.esriCheckOutTypeParent)
                {
                    string str = syntax.QualifyTableName("", replica2.Owner, replica2.Version);
                    if (string_0.ToLower() == str.ToLower())
                    {
                        return(true);
                    }
                }
            }
            return(false);
        }
Exemple #21
0
        public void SendSerialization(IReplica replica, ICollection <IPEndPoint> endPoints = null)
        {
            var recipients = endPoints ?? _connections.Keys;

            using var stream = new MemoryStream();
            using var writer = new BitWriter(stream);

            writer.Write((byte)MessageIdentifier.ReplicaManagerSerialize);
            writer.Write(_replicas[replica]);
            writer.WriteSerializable(replica);

            foreach (var endPoint in recipients)
            {
                if (_connections.TryGetValue(endPoint, out var conn))
                {
                    conn.Send(stream.ToArray());
                }
            }
        }
Exemple #22
0
        private void method_11()
        {
            ICheckIn @in = new CheckInClass();

            ESRI.ArcGIS.GeoDatabaseDistributed.IFeatureProgress_Event event2 =
                @in as ESRI.ArcGIS.GeoDatabaseDistributed.IFeatureProgress_Event;
            base.InitEvent(event2);
            if (this.bool_0)
            {
                IName              name      = this.iworkspaceName_0 as IName;
                IWorkspace         workspace = name.Open() as IWorkspace;
                IWorkspaceReplicas replicas  = workspace as IWorkspaceReplicas;
                IReplica           replica   = replicas.Replicas.Next();
                try
                {
                    @in.CheckInFromGDB(base.m_MasterWorkspaceName, replica.Name, this.iworkspaceName_0, this.bool_1,
                                       false);
                }
                catch
                {
                }
            }
            else
            {
                esriExportDataChangesOption esriExportToAccess = esriExportDataChangesOption.esriExportToAccess;
                if (Path.GetExtension(this.string_0).ToLower() == ".xml")
                {
                    esriExportToAccess = esriExportDataChangesOption.esriExportToXML;
                }
                try
                {
                    @in.CheckInFromDeltaFile(base.m_MasterWorkspaceName, this.string_1, this.string_0,
                                             esriExportToAccess, this.bool_1, false);
                }
                catch
                {
                }
            }
            base.ReleaseEvent(event2);
        }
Exemple #23
0
        protected override void OnClick()
        {
            string            workspaceName    = "C:\\Temp\\[email protected]";
            Type              factoryType      = Type.GetTypeFromProgID("esriDataSourcesGDB.SdeWorkspaceFactory");
            IWorkspaceFactory workspaceFactory = ((IWorkspaceFactory)(Activator.CreateInstance(factoryType)));
            IWorkspace        workspace        = workspaceFactory.OpenFromFile(workspaceName, 0);

            IWorkspaceReplicas workspaceReplicas = (IWorkspaceReplicas)workspace;
            IReplica           replica           = null;
            int counter = 0;

            workspaceReplicas.Replicas.Reset();
            replica = workspaceReplicas.Replicas.Next();
            List <string> listOfReplicas = new List <string>();

            while (replica != null)
            {
                listOfReplicas.Add(replica.Name);
                System.Diagnostics.Debug.WriteLine("Replica no. " + counter + " : " + listOfReplicas[counter]);
                replica = workspaceReplicas.Replicas.Next();
                counter++;
            }
            System.Diagnostics.Debug.WriteLine("There are no more replicas associated with this workspace");
        }
 void IReplicatorImpl.OnReplicaDisposed(IReplica replica)
 => OnReplicaDisposed(replica);
 void IReplicatorImpl.Subscribe(IReplica replica)
 => Subscribe(replica);
		/// <summary>
		/// Occurs in the master geodatabase before data changes in either a replica geodatabase or delta
		/// database are transferred to the master geodatabase.
		/// Not used in this implementation.
		/// </summary>
		public void BeforeSynchronizingDataChanges(IReplica targetReplica, object dataChangesSource)
		{
			// Not used in this implementation.
		}
		/// <summary>
		/// Occurs in the master geodatabase after data changes in either a replica
		/// geodatabase or delta database are transferred to the master geodatabase.
		/// </summary>
		/// <param name="targetReplica">The target replica.</param>
		/// <param name="dataChangesSource">A collection of changes made to the master geodatabase.</param>
		/// <param name="oidMappingTable">Not used in this implementation.</param>
		/// <param name="changesTable">Not used in this implemented.</param>
		public void AfterSynchronizingDataChanges(IReplica targetReplica, object dataChangesSource, ITable oidMappingTable, ITable changesTable)
		{
			// Make sure that the correct replica is being synchronized.
			String replicaName = targetReplica.Name;
			String unqualifiedReplicaName = replicaName.Substring(replicaName.LastIndexOf('.') + 1);
			if (!unqualifiedReplicaName.Equals(rasterReplicaName))
			{
				return;
			}

			// Get the rasters to pull if connected synchronization is occurring.
			IDataChanges3 dataChanges3 = dataChangesSource as IDataChanges3;
			if (dataChanges3 != null)
			{
				// Get the source's replicas.
				IName sourceWorkspaceName = (IName)dataChanges3.ParentWorkspaceName;
				IWorkspace sourceWorkspace = (IWorkspace)sourceWorkspaceName.Open();
				IWorkspaceReplicas sourceWorkspaceReplicas = (IWorkspaceReplicas)sourceWorkspace;

				// Get the replica generation numbers.
				int genBegin = 0;
				int genEnd = 0;
				int targetGen = 0;
				dataChanges3.GenerationNumbers(out genBegin, out genEnd, out targetGen);
				IQueryFilter queryFilter = new QueryFilterClass();
				queryFilter.WhereClause = String.Format("{0} > {1} or {0} is NULL", genFieldName, genBegin);

				// Open a cursor to get the rasters to copy form the source.
				IRasterWorkspaceEx sourceRasterWorkspaceEx = (IRasterWorkspaceEx)sourceWorkspace;
				IRasterCatalog sourceRasterCatalog = sourceRasterWorkspaceEx.OpenRasterCatalog(rasterCatalogName);
				IFeatureClass sourceFeatureClass = (IFeatureClass)sourceRasterCatalog;
				int sourceGenFieldIndex = sourceFeatureClass.FindField(genFieldName);
				IFeatureCursor sourceCursor = sourceFeatureClass.Search(queryFilter, true);

				// Open the target raster catalog.
				IRasterWorkspaceEx targetRasterWorkspaceEx = (IRasterWorkspaceEx)workspaceHelper.Workspace;
				IRasterCatalog targetRasterCatalog = targetRasterWorkspaceEx.OpenRasterCatalog(rasterCatalogName);
				IFeatureClass targetFeatureClass = (IFeatureClass)targetRasterCatalog;
				int targetGenFieldIndex = targetFeatureClass.FindField(genFieldName);
				IFeatureCursor targetCursor = targetFeatureClass.Insert(true);

				// Copy the rasters from the source to the target.
				IFeature sourceFeature = null;
				while ((sourceFeature = sourceCursor.NextFeature()) != null)
				{
					// Copy the raster and set the target gen to -1 (received).
					IFeatureBuffer featureBuffer = targetFeatureClass.CreateFeatureBuffer();
					featureBuffer.set_Value(targetRasterCatalog.RasterFieldIndex, sourceFeature.get_Value(sourceRasterCatalog.RasterFieldIndex));
					featureBuffer.set_Value(targetGenFieldIndex, -1);
					targetCursor.InsertFeature(featureBuffer);

					// Set the source row value to the current generation.
					if (sourceFeature.get_Value(sourceGenFieldIndex) == DBNull.Value)
					{
						sourceFeature.set_Value(sourceGenFieldIndex, genEnd);
					}
					sourceFeature.Store();
				}
				Marshal.FinalReleaseComObject(sourceCursor);
				Marshal.FinalReleaseComObject(targetCursor);
			}
		}
Exemple #28
0
 /// <summary>
 /// Occurs in the replica geodatabase before data changes are exported from that replica geodatabase to a delta database.
 /// Not used in this implementation.
 /// </summary>
 public void BeforeExportingDataChanges(IReplica sourceReplica, object dataChangesSource, object deltaFile)
 {
     // Not used in this implementation.
 }
		/// <summary>
		/// Occurs in the replica geodatabase before data changes are exported from that replica geodatabase to a delta database.
		/// Not used in this implementation.
		/// </summary>
		public void BeforeExportingDataChanges(IReplica sourceReplica, object dataChangesSource, object deltaFile)
		{
			// Not used in this implementation.
		}
Exemple #30
0
    void Update()
    {
        if (this.dialog == null)
        {
            return;
        }
        if (this.finalState == 2)
        {
            return;
        }
        if (this.finalState == 1)
        {
            GameObject replicaButtonObject = Instantiate(this.replicaButtonPrefab) as GameObject;
            replicaButtonObject.transform.SetParent(this.replicasContent, false);
            replicaButtonObject.transform.localScale = new Vector3(1, 1, 1);

            replicaButtonObject.GetComponent <Text> ().text = this.translator.Translate("Dialogue ended. Click to close", DialogueWindow.resource);

            Button button = replicaButtonObject.GetComponent <Button> ();
            button.onClick.AddListener(() => EndDialogue());
            this.finalState = 2;
            return;
        }

        if (this.waitForPlayer)
        {
            return;
        }

        IReplica replica = this.dialog.GetCurrentReplica();

        if (replica is SimpleReplica)
        {
            SimpleReplica simpleReplica = replica as SimpleReplica;
            if (simpleReplica.IsPlayerReplica())
            {
                this.waitForPlayer = true;

                GameObject replicaButtonObject = Instantiate(this.replicaButtonPrefab) as GameObject;
                replicaButtonObject.transform.SetParent(this.replicasContent, false);
                replicaButtonObject.transform.localScale = new Vector3(1, 1, 1);

                replicaButtonObject.GetComponent <Text> ().text = this.translator.Translate(simpleReplica.text, DialogueWindow.resource);

                Button        button     = replicaButtonObject.GetComponent <Button> ();
                SimpleReplica tmpReplica = simpleReplica;
                button.onClick.AddListener(() => ChooseReplica(tmpReplica));

                this.replicaButtons.Add(replicaButtonObject);
            }
            else
            {
                this.ChooseReplica(simpleReplica);
            }
            return;
        }
        CompositeReplica compositeReplica = replica as CompositeReplica;

        this.waitForPlayer = true;
        foreach (string key in compositeReplica.replicas)
        {
            SimpleReplica simpleReplica = this.dialog.GetReplica(key) as SimpleReplica;

            GameObject replicaButtonObject = Instantiate(this.replicaButtonPrefab) as GameObject;
            replicaButtonObject.transform.SetParent(this.replicasContent, false);
            replicaButtonObject.transform.localScale = new Vector3(1, 1, 1);

            replicaButtonObject.GetComponent <Text> ().text = this.translator.Translate(simpleReplica.text, DialogueWindow.resource);

            Button button = replicaButtonObject.GetComponent <Button> ();
            button.onClick.AddListener(() => ChooseReplica(simpleReplica));

            this.replicaButtons.Add(replicaButtonObject);
        }
    }
Exemple #31
0
        private void method_0()
        {
            this.textEditName.Text = this.iworkspace_0.PathName;
            switch (this.iworkspace_0.Type)
            {
            case esriWorkspaceType.esriLocalDatabaseWorkspace:
                if (!(Path.GetExtension(this.iworkspace_0.PathName).ToLower() == ".mdb"))
                {
                    this.lblType.Text         = "文件型空间数据库";
                    this.lblConfigKey.Text    = "点击按钮列出数据库定义的所有关键字";
                    this.btnConfigKey.Enabled = true;
                    break;
                }
                this.lblType.Text         = "个人空间数据库";
                this.lblConfigKey.Text    = "个人空间数据库不支持配置关键字";
                this.btnConfigKey.Enabled = false;
                break;

            case esriWorkspaceType.esriRemoteDatabaseWorkspace:
                this.lblType.Text         = "ArcSDE Geodatebase连接";
                this.lblConfigKey.Text    = "点击按钮列出数据库定义的所有关键字";
                this.btnConfigKey.Enabled = true;
                break;
            }
            if (this.iworkspace_0 is IWorkspaceReplicas)
            {
                IEnumReplica replicas = (this.iworkspace_0 as IWorkspaceReplicas).Replicas;
                replicas.Reset();
                IReplica replica2 = replicas.Next();
                string   name     = "";
                if (replica2 != null)
                {
                    this.lblCheckOutInfo.Text         = "这是个检出数据库。该数据库包含从另外的数据库导出的数据。";
                    this.textEditCheckOutName.Enabled = true;
                    name = replica2.Name;
                    this.textEditCheckOutName.Text = name;
                    this.btnProperty.Enabled       = true;
                    this.btnUnRegister.Enabled     = true;
                }
                else
                {
                    this.lblCheckOutInfo.Text         = "该数据库不包含从另外的数据库导出的数据。";
                    this.textEditCheckOutName.Enabled = false;
                    this.btnProperty.Enabled          = false;
                    this.btnUnRegister.Enabled        = false;
                }
            }
            else
            {
                this.lblCheckOutInfo.Text         = "该数据库不包含从另外的数据库导出的数据。";
                this.textEditCheckOutName.Enabled = false;
                this.btnProperty.Enabled          = false;
                this.btnUnRegister.Enabled        = false;
            }
            try
            {
                IGeodatabaseRelease release = this.iworkspace_0 as IGeodatabaseRelease;
                if (release.CurrentRelease)
                {
                    this.lblGDBRelease.Text         = "此数据库与你所使用的ArcGIS版本匹配";
                    this.btnUpdatePersonGDB.Enabled = false;
                }
                else if (release.CanUpgrade)
                {
                    this.lblGDBRelease.Text         = "此数据库与你所使用的ArcGIS版本不匹配";
                    this.btnUpdatePersonGDB.Enabled = true;
                }
                else
                {
                    this.btnUpdatePersonGDB.Enabled = false;
                }
            }
            catch
            {
                this.btnUpdatePersonGDB.Enabled = false;
            }
        }
Exemple #32
0
 public void AddReplica(string key, IReplica replica)
 {
     this.replicas.Add(key, replica);
 }
Exemple #33
0
 /// <summary>
 /// Occurs in the master geodatabase before data changes in either a replica geodatabase or delta
 /// database are transferred to the master geodatabase.
 /// Not used in this implementation.
 /// </summary>
 public void BeforeSynchronizingDataChanges(IReplica targetReplica, object dataChangesSource)
 {
     // Not used in this implementation.
 }