/// <summary>
 ///     Refreshes all pending Delete/Update entity objects of current DataContext according to the specified mode.
 ///     Nothing will do on Pending Insert entity objects.
 /// </summary>
 /// <param name="context"></param>
 /// <param name="refreshMode">A value that specifies how optimistic concurrency conflicts are handled.</param>
 public void RefreshPendingChanges(DataContext context, RefreshMode refreshMode)
 {
     ChangeSet changeSet = context.GetChangeSet();
     if (changeSet != null)
     {
         context.Refresh(refreshMode, changeSet.Deletes);
         context.Refresh(refreshMode, changeSet.Updates);
     }
 }
Example #2
0
 /// <summary>
 /// 
 /// </summary>
 /// <param name="aControl"></param>
 /// <param name="status"></param>
 /// <param name="bRecursion"></param>
 /// <param name="mode"></param>
 public static void RefreshControl(Control aControl, EditState status, bool bRecursion = true, RefreshMode mode = RefreshMode.Normal)
 {
     if (aControl == null)
         return;
     Color colorTrue = Color.White;
     Color colorFalse = Color.WhiteSmoke;
     //正常的是编辑状态下可用
     bool bInEdit = status.In(EditState.Edit, EditState.AddNew);
     bool bControlEnabled = mode == RefreshMode.Normal ? bInEdit : !bInEdit;
     if (aControl is GridControl)
     {
         //Grid列按列自身的RefreshMode处理
         GridControl grid = aControl as GridControl;
         GridView view = grid.MainView as GridView;
         switch (mode)
         {
             //反向Grid,一般用于索引数据,如Index
             case RefreshMode.Unnatural: RefreshControl(grid, !bInEdit); break;
             //正向Grid,一般用于主数据
             case RefreshMode.Normal: RefreshControl(view, bControlEnabled); break;
             default: break;
         }
     }
     else if (bRecursion && (aControl is PanelControl || aControl is LayoutControl || aControl is SplitGroupPanel
          || aControl is Form || aControl is XtraTabPage || aControl is XtraTabControl || aControl is BaseUserControl
          || aControl is SplitContainerControl))
     {
         foreach (Control c in aControl.Controls)
         {
             RefreshControl(c, status, bRecursion, mode);
         }
     }
     else
         RefreshControl(aControl, bControlEnabled, colorTrue, colorFalse);
 }
Example #3
0
 public LinkType()
 {
     _refreshMode = RefreshMode.OnChange;
     _refreshInterval = 4.0;
     _viewRefreshMode = ViewRefreshMode.Never;
     _viewRefreshTime = 4.0;
     _viewBoundScale = 1.0;
 }
Example #4
0
        public NativeWindow(GraphicsMode mode, WindowOptions options)
        {
            if (options.ScreenMode == ScreenMode.Native)
            {
                options.Width = DisplayDevice.Default.Width;
                options.Height = DisplayDevice.Default.Height;
            }

            GameWindowFlags windowFlags = GameWindowFlags.Default;
            if (options.ScreenMode == ScreenMode.FixedWindow)
                windowFlags = GameWindowFlags.FixedWindow;
            else if (options.ScreenMode == ScreenMode.Fullscreen || options.ScreenMode == ScreenMode.Native)
                windowFlags = GameWindowFlags.Fullscreen;

            this.refreshMode = options.RefreshMode;
            this.internalWindow = new InternalWindow(
                this,
                options.Width,
                options.Height,
                mode,
                options.Title,
                windowFlags);
            this.internalWindow.MakeCurrent();
            this.internalWindow.CursorVisible = true;
            if (!options.SystemCursorVisible)
                this.internalWindow.Cursor = MouseCursor.Empty;
            this.internalWindow.VSync = (options.RefreshMode != RefreshMode.VSync) ? VSyncMode.Off : VSyncMode.On;

            Log.Core.Write("Window Specification: {0}Mode: {1}{0}VSync: {2}{0}SwapInterval: {3}{0}",
                Environment.NewLine,
                this.internalWindow.Context.GraphicsMode,
                this.internalWindow.VSync,
                this.internalWindow.Context.SwapInterval);

            // Retrieve icon from executable file and set it as window icon
            Assembly entryAssembly = Assembly.GetEntryAssembly();
            if (entryAssembly != null)
            {
                string executablePath = Path.GetFullPath(entryAssembly.Location);
                if (File.Exists(executablePath))
                {
                    this.internalWindow.Icon = Icon.ExtractAssociatedIcon(executablePath);
                }
            }

            if (options.ScreenMode == ScreenMode.FullWindow)
                this.internalWindow.WindowState = WindowState.Fullscreen;

            DualityApp.TargetResolution = new Vector2(this.internalWindow.ClientSize.Width, this.internalWindow.ClientSize.Height);

            DualityApp.Mouse.Source = new GameWindowMouseInputSource(this.internalWindow);
            DualityApp.Keyboard.Source = new GameWindowKeyboardInputSource(this.internalWindow);
            DualityApp.UserDataChanged += this.OnUserDataChanged;

            // Determine OpenGL capabilities and log them
            GraphicsBackend.LogOpenGLSpecs();
        }
Example #5
0
 public Icon(string href, RefreshMode refreshMode, int refreshInterval, int x, int y, int w, int h)
 {
     this._href = href;
     this._refreshMode = refreshMode;
     this._refreshInterval = refreshInterval;
     this._x = x;
     this._y = y;
     this._w = w;
     this._h = h;
 }
Example #6
0
 public ScreenOverlay(string name, string snippet, bool visibility, string imgHref, 
     ScreenXY sxy, OverlayXY oxy, Size size, RefreshMode mode, int refreshInterval)
 {
     this._name = name;
     this._snippet = snippet;
     this._visibility = visibility;
     this._imgHref = imgHref;
     this._sxy = sxy;
     this._oxy = oxy;
     this._size = size;
     this._refreshMode = mode;
     this._refreshInterval = refreshInterval;
 }
        /// <summary>
        /// Refresh non-detached entities
        /// </summary>
        /// <param name="dbContext">context of the entities</param>
        /// <param name="refreshMode">store or client wins</param>
        /// <param name="entityType">when specified only entities of that type are refreshed. when null all non-detached entities are modified</param>
        /// <returns></returns>
        public static DbContext RefreshEntites(this DbContext dbContext, RefreshMode refreshMode, Type entityType)
        {
            //https://christianarg.wordpress.com/2013/06/13/entityframework-refreshall-loaded-entities-from-database/
            var objectContext      = ((IObjectContextAdapter)dbContext).ObjectContext;
            var refreshableObjects = objectContext.ObjectStateManager
                                     .GetObjectStateEntries(EntityState.Added | EntityState.Deleted | EntityState.Modified | EntityState.Unchanged)
                                     .Where(x => entityType == null || x.Entity.GetType() == entityType)
                                     .Where(entry => entry.EntityKey != null)
                                     .Select(e => e.Entity)
                                     .ToArray();

            objectContext.Refresh(refreshMode, refreshableObjects);

            return(dbContext);
        }
Example #8
0
 /// <summary>
 /// Persists to the content database changes made by the current user to one or more lists using the specified failure mode;
 /// or, if a concurrency conflict is found, populates the <see cref="P:Microsoft.SharePoint.Linq.DataContext.ChangeConflicts"/> property.
 /// </summary>
 /// <param name="mode">Specifies how the list item changing system of the LINQ to SharePoint provider will respond when it
 /// finds that a list item has been changed by another process since it was retrieved.
 /// </param>
 public void SubmitChangesSilently(RefreshMode mode)
 {
     try
     {
         SubmitChanges();
     }
     catch (ChangeConflictException)
     {
         foreach (ObjectChangeConflict changedListItem in this.ChangeConflicts)
         {
             changedListItem.Resolve(mode);
         }
         this.SubmitChanges();
     }
 }
        private void handle(PopulationAnalysisEvent eventToHandle, RefreshMode refreshMode)
        {
            if (!canHandle(eventToHandle))
            {
                return;
            }

            if (refreshMode == RefreshMode.RefreshDataAndPlot)
            {
                ShouldRefreshData = true;
            }
            else
            {
                ShouldRefreshChart = true;
            }
        }
Example #10
0
 public void Resolve(RefreshMode refreshMode, bool autoResolveDeletes)
 {
     if (autoResolveDeletes && IsDeleted)
     {
         ResolveDelete();
     }
     else
     {
         if (Database == null)
         {
             throw System.Data.Linq.Error.RefreshOfDeletedObject();
         }
         TrackedObject.Refresh(refreshMode, Database);
         IsResolved = true;
     }
 }
        private async Task InitScreenAsync(RefreshMode refreshMode)
        {
            Console.WriteLine("InitScreen begin");

            await Reset();

            send_command(0x01); // DRIVER_OUTPUT_CONTROL
            send_data(EPD_HEIGHT - 1 & 0xFF);
            send_data(EPD_HEIGHT - 1 >> 8 & 0xFF);
            send_data(0x00);    // GD = 0 SM = 0 TB = 0

            send_command(0x0C); // BOOSTER_SOFT_START_CONTROL
            send_data(0xD7);
            send_data(0xD6);
            send_data(0x9D);

            send_command(0x2C); // WRITE_VCOM_REGISTER
            send_data(0xA8);    // VCOM 7C

            send_command(0x3A); // SET_DUMMY_LINE_PERIOD
            send_data(0x1A);    // 4 dummy lines per gate

            send_command(0x3B); // SET_GATE_TIME
            send_data(0x08);    // 2us per line

            send_command(0X3C); // BORDER_WAVEFORM_CONTROL
            send_data(0x03);

            send_command(0X11); // DATA_ENTRY_MODE_SETTING
            send_data(0x03);    // X increment; Y increment

            // WRITE_LUT_REGISTER
            send_command(0x32);
            switch (refreshMode)
            {
            case RefreshMode.Full: send_data(lut_full_update); break;

            case RefreshMode.Partial: send_data(lut_partial_update); break;

            default: throw new ArgumentException(nameof(refreshMode));
            }

            IsInitialized = true;

            Console.WriteLine("InitScreen end");
        }
Example #12
0
 get => new MixtureSettings()
 {
     widthScale      = 1.0f,
     heightScale     = 1.0f,
     depthScale      = 1.0f,
     width           = 1024,
     height          = 1024,
     depth           = 1,
     sizeMode        = OutputSizeMode.InheritFromParent,
     dimension       = OutputDimension.InheritFromParent,
     outputChannels  = OutputChannel.InheritFromParent,
     outputPrecision = OutputPrecision.InheritFromParent,
     editFlags       = ~EditFlags.POTSize,
     doubleBuffered  = false,
     wrapMode        = OutputWrapMode.InheritFromParent,
     filterMode      = OutputFilterMode.InheritFromParent,
     refreshMode     = RefreshMode.OnLoad,
 };
        public async Task InitializeAsync(RefreshMode refreshMode)
        {
            Console.WriteLine("Initialize begin");

            // Configure raspberry pi
            Pi.Init <BootstrapWiringPi>();
            gpio = Pi.Gpio;
            gpio[BUSY_PIN].PinMode   = GpioPinDriveMode.Input;
            gpio[DC_PIN].PinMode     = GpioPinDriveMode.Output;
            gpio[RST_PIN].PinMode    = GpioPinDriveMode.Output;
            gpio[CS_PIN].PinMode     = GpioPinDriveMode.Output;
            Pi.Spi.Channel0Frequency = 2000000;
            spi = Pi.Spi.Channel0;

            await InitScreenAsync(refreshMode);

            Console.WriteLine("Initialize end");
        }
Example #14
0
        public override XElement ToXElement()
        {
            XElement xml = base.NewXElement("Link");

            if (Href.HasValue())
            {
                xml.Add(NewXElement("href", Href));
            }
            if (RefreshMode != KmlLinkRefreshMode.OnChange)
            {
                xml.Add(NewXElement("refreshMode", RefreshMode.ToCamelCase()));
            }
            if (RefreshMode == KmlLinkRefreshMode.OnInterval)
            {
                xml.Add(NewXElement("refreshInterval", RefreshInterval.TotalSeconds));
            }
            return(xml);
        }
Example #15
0
 /// <summary>
 /// Resolve member conflicts using the mode specified and resetting the baseline 'Original' values
 /// to match the more recent 'Database' values.
 /// </summary>
 /// <param name="refreshMode">The mode that determines how the current values are
 /// changed in order to resolve the conflict</param>
 /// <param name="autoResolveDeletes">If true conflicts resulting from the modified
 /// object no longer existing in the database will be automatically resolved.</param>
 public void Resolve(RefreshMode refreshMode, bool autoResolveDeletes)
 {
     if (autoResolveDeletes && this.IsDeleted)
     {
         this.ResolveDelete();
     }
     else
     {
         // We make these calls explicity rather than simply calling
         // DataContext.Refresh (which does virtually the same thing)
         // since we want to cache the database value read.
         if (this.Database == null)
         {
             throw Error.RefreshOfDeletedObject();
         }
         trackedObject.Refresh(refreshMode, this.Database);
         this.isResolved = true;
     }
 }
        public void RefreshReflectionAt(RefreshMode refresh, Vector3 position)
        {
            CreateData();
            CreateCubemap();

            int resolution = GetComponent <ReflectionProbe>().resolution;

            RenderPair pair;

            if (!targets.TryGetValue(resolution, out pair))
            {
                refreshing = null;
                return;
            }

            Camera camera = Camera;

            camera.transform.position = position;
            camera.targetTexture      = pair.Render;

            SetCameraSettings(camera);

            switch (refresh)
            {
            case RefreshMode.Default:
                break;

            case RefreshMode.Instant:
                RefreshInstant(pair, camera);
                break;

            case RefreshMode.Face:
                refreshing = StartCoroutine(RefreshFace(pair, camera));
                break;

            case RefreshMode.Overtime:
                refreshing = StartCoroutine(RefreshOvertime(pair, camera));
                break;
            }

            camera.gameObject.SetActive(false);
        }
Example #17
0
        public virtual int ApplyChanges(RefreshMode refreshMode)
        {
            int i = 0;

            try
            {
                i = this.ObjectContext.SaveChanges();
            }
            catch (OptimisticConcurrencyException ex)
            {
                foreach (var state in ex.StateEntries)
                {
                    this.ObjectContext.Refresh(refreshMode, state.Entity);
                }

                i = this.ObjectContext.SaveChanges(false);
            }

            return(i);
        }
 public override int GetHashCode()
 {
     unchecked
     {
         int hashCode = Enabled.GetHashCode();
         hashCode = (hashCode * 397) ^ ResponseKindsToCache.GetHashCode();
         hashCode = (hashCode * 397) ^ ResponseKindsToIgnore.GetHashCode();
         hashCode = (hashCode * 397) ^ RefreshMode.GetHashCode();
         hashCode = (hashCode * 397) ^ RefreshTime.GetHashCode();
         hashCode = (hashCode * 397) ^ ExpirationTime.GetHashCode();
         hashCode = (hashCode * 397) ^ FailedRefreshDelay.GetHashCode();
         hashCode = (hashCode * 397) ^ RequestGroupingBehavior.GetHashCode();
         hashCode = (hashCode * 397) ^ RefreshBehavior.GetHashCode();
         hashCode = (hashCode * 397) ^ RevokedResponseBehavior.GetHashCode();
         hashCode = (hashCode * 397) ^ ExpirationBehavior.GetHashCode();
         hashCode = (hashCode * 397) ^ CacheResponsesWhenSupressedBehavior.GetHashCode();
         hashCode = (hashCode * 397) ^ NotIgnoredResponseBehavior.GetHashCode();
         return(hashCode);
     }
 }
Example #19
0
                internal override void Refresh(RefreshMode mode, object freshInstance)
                {
                    SynchDependentData();
                    UpdateDirtyMemberCache();
                    var type = freshInstance.GetType();

                    foreach (var persistentDataMember in this.type.PersistentDataMembers)
                    {
                        var refreshMode = persistentDataMember.IsDbGenerated ? RefreshMode.OverwriteCurrentValues : mode;
                        if (refreshMode != 0 && !persistentDataMember.IsAssociation && (Type.Type == type || persistentDataMember.DeclaringType.Type.IsAssignableFrom(type)))
                        {
                            var boxedValue = persistentDataMember.StorageAccessor.GetBoxedValue(freshInstance);
                            RefreshMember(persistentDataMember, refreshMode, boxedValue);
                        }
                    }
                    original = CreateDataCopy(freshInstance);
                    if (mode == RefreshMode.OverwriteCurrentValues)
                    {
                        ResetDirtyMemberTracking();
                    }
                }
Example #20
0
 internal override void RefreshMember(MetaDataMember mm, RefreshMode mode, object freshValue)
 {
     if (mode != 0 && (!HasChangedValue(mm) || mode == RefreshMode.OverwriteCurrentValues))
     {
         var boxedValue = mm.StorageAccessor.GetBoxedValue(current);
         if (!object.Equals(freshValue, boxedValue))
         {
             mm.StorageAccessor.SetBoxedValue(ref current, freshValue);
             foreach (var item in GetAssociationsForKey(mm))
             {
                 if (!item.Association.IsMany)
                 {
                     var source = tracker.services.GetDeferredSourceFactory(item).CreateDeferredSource(current);
                     if (item.StorageAccessor.HasValue(current))
                     {
                         AssignMember(current, item, source.Cast <object>().SingleOrDefault());
                     }
                 }
             }
         }
     }
 }
Example #21
0
                internal override void Refresh(RefreshMode mode, object freshInstance)
                {
                    SynchDependentData();
                    UpdateDirtyMemberCache();
                    Type c = freshInstance.GetType();

                    foreach (MetaDataMember member in type.PersistentDataMembers)
                    {
                        RefreshMode mode2 = member.IsDbGenerated ? RefreshMode.OverwriteCurrentValues : mode;
                        if (((mode2 != RefreshMode.KeepCurrentValues) && !member.IsAssociation) &&
                            ((Type.Type == c) || member.DeclaringType.Type.IsAssignableFrom(c)))
                        {
                            object boxedValue = member.StorageAccessor.GetBoxedValue(freshInstance);
                            RefreshMember(member, mode2, boxedValue);
                        }
                    }
                    original = CreateDataCopy(freshInstance);
                    if (mode == RefreshMode.OverwriteCurrentValues)
                    {
                        ResetDirtyMemberTracking();
                    }
                }
        public RefreshButton([NotNull] string param)
        {
            Assert.ArgumentNotNull(param, "param");

              switch (param.ToLower())
              {
            case "all":
              this.mode = RefreshMode.Everything;
              return;
            case "sites":
              this.mode = RefreshMode.Instances;
              return;
            case "installer":
              this.mode = RefreshMode.Installer;
              return;
            case "caches":
              this.mode = RefreshMode.Caches;
              return;
            default:
              throw new NotSupportedException("The {0} type is not supported".FormatWith(param));
              }
        }
 public int SaveChanges(bool refreshOnConcurrencyException, RefreshMode refreshMode = RefreshMode.KeepChanges)
 {
     try
     {
         return(SaveChanges());
     }
     catch (DbUpdateConcurrencyException ex)
     {
         foreach (DbEntityEntry entry in ex.Entries)
         {
             if (refreshMode == RefreshMode.KeepChanges)
             {
                 entry.OriginalValues.SetValues(entry.GetDatabaseValues());
             }
             else
             {
                 entry.Reload();
             }
         }
         return(SaveChanges());
     }
 }
Example #24
0
                internal override void RefreshMember(MetaDataMember mm, RefreshMode mode, object freshValue)
                {
                    System.Diagnostics.Debug.Assert(!mm.IsAssociation);

                    if (mode == RefreshMode.KeepCurrentValues)
                    {
                        return;
                    }

                    bool hasUserChange = this.HasChangedValue(mm);

                    // we don't want to overwrite any modified values, unless
                    // the mode is original wins
                    if (hasUserChange && mode != RefreshMode.OverwriteCurrentValues)
                    {
                        return;
                    }

                    object currentValue = mm.StorageAccessor.GetBoxedValue(this.current);

                    if (!object.Equals(freshValue, currentValue))
                    {
                        mm.StorageAccessor.SetBoxedValue(ref this.current, freshValue);

                        // update all singleton associations that are affected by a change to this member
                        foreach (MetaDataMember am in this.GetAssociationsForKey(mm))
                        {
                            if (!am.Association.IsMany)
                            {
                                IEnumerable ds = this.tracker.services.GetDeferredSourceFactory(am).CreateDeferredSource(this.current);
                                if (am.StorageAccessor.HasValue(this.current))
                                {
                                    this.AssignMember(this.current, am, ds.Cast <Object>().SingleOrDefault());
                                }
                            }
                        }
                    }
                }
Example #25
0
        public void Resolve(RefreshMode mode, object originalListItem, object databaseListItem)
        {
            SPListItem originalItem = originalListItem as SPListItem;
            SPListItem databaseItem = databaseListItem as SPListItem;

            if (databaseItem == null || originalItem == null)
            {
                return;
            }

            //SPAttachmentCollection originalValue = originalItem["Attachments"] as SPAttachmentCollection;
            //SPAttachmentCollection databaseValue = databaseItem["Attachments"] as SPAttachmentCollection;

            //switch (mode)
            //{
            //    case RefreshMode.KeepChanges:
            //        if (_contentAttachments != originalValue)
            //        {
            //            databaseItem["Attachments"] = _contentAttachments;
            //        }
            //        else if (_contentAttachments == originalValue &&
            //            _contentAttachments != databaseValue)
            //        {
            //            _contentAttachments = databaseValue;
            //        }
            //        break;
            //    case RefreshMode.KeepCurrentValues:
            //        databaseItem["Attachments"] = _contentAttachments;
            //        break;
            //    case RefreshMode.OverwriteCurrentValues:
            //        _contentAttachments = databaseValue;
            //        break;
            //    default:
            //        break;
            //}
        }
		static public void AutoRefresh(this ObjectContext ctx,
					  RefreshMode refreshMode, IEnumerable collection)
		{
			var csInEF = ctx.Connection.ConnectionString;
            string csForEF;
            if (csInEF.StartsWith("name="))
            {   // old EF
                var csName = csInEF.Replace("name=", "").Trim();
                csForEF =
                  System.Configuration.ConfigurationManager.ConnectionStrings[csName].ConnectionString;
            }
            else
                csForEF = csInEF;
			var newConnectionString = new
			  System.Data.EntityClient.EntityConnectionStringBuilder(csForEF).ProviderConnectionString;
			if (!connectionStrings.Contains(newConnectionString))
			{
				connectionStrings.Add(newConnectionString);
				SqlDependency.Start(newConnectionString);
			}
			ServiceBrokerUtility.ctx = ctx;
			ServiceBrokerUtility.refreshMode = refreshMode;
			AutoRefresh(collection);
		}
 /// <summary>
 /// Refresh the item by making the value passed in the current 
 /// Database value, and refreshing the current values using the
 /// mode specified.
 /// </summary>       
 internal abstract void Refresh(RefreshMode mode, object freshInstance);
Example #28
0
 /// <summary>
 /// Refresh the item by making the value passed in the current
 /// Database value, and refreshing the current values using the
 /// mode specified.
 /// </summary>
 internal abstract void Refresh(RefreshMode mode, object freshInstance);
Example #29
0
 /// <summary>
 /// Does the refresh operation for a single member.  This method does not
 /// update the baseline 'original' value.  You must call
 /// Refresh(RefreshMode.KeepCurrentValues, freshInstance) to finish the refresh
 /// after refreshing individual members.
 /// </summary>
 /// <param name="member"></param>
 /// <param name="mode"></param>
 /// <param name="freshValue"></param>
 internal abstract void RefreshMember(MetaDataMember member, RefreshMode mode, object freshValue);
 public RefreshButton()
 {
     this.mode = RefreshMode.Undefined;
 }
Example #31
0
 public void Refresh(RefreshMode clientWins, object articles)
 {
     this.Refresh(clientWins, articles);
 }
Example #32
0
 public void Refresh(RefreshMode refreshMode, IEnumerable colection)
 {
 }
		/// <summary>
		/// Resolve member conflicts using the mode specified and resetting the baseline 'Original' values
		/// to match the more recent 'Database' values.
		/// </summary>  
		/// <param name="refreshMode">The mode that determines how the current values are 
		/// changed in order to resolve the conflict</param>
		public void Resolve(RefreshMode refreshMode)
		{
			this.Resolve(refreshMode, false);
		}
        public void Refresh(RefreshMode mode, IDataObject dataObject)
        {
            if (dataObject == null) throw new ArgumentNullException("dataObject");
            if (_managedProxies[dataObject.Identity] != dataObject)
            {
                throw new ArgumentException("Data object is not tracked by this store.", "dataObject");
            }

            if (mode == RefreshMode.ClientWins)
            {
                // We just lookup the new version number
                UpdateVersionFromSparqlResult(
                    ExecuteSparql(new SparqlQueryContext(String.Format(GetVersionSparql, dataObject.Identity))),
                    dataObject);
            }
            else
            {
                var managed = _managedProxies[dataObject.Identity];
                BindDataObject(managed);
                // Reset all updates for the bound object
                _addTriples.RemoveAll(t => t.Subject == managed.Identity);
                _deletePatterns.RemoveAll(t => t.Subject == managed.Identity);
            }
        }
 public void RefreshReflection(RefreshMode refresh = RefreshMode.Default)
 {
     RefreshReflectionAt(refresh, transform.position);
 }
 /// <summary>
 /// Updates the current value using the specified strategy.
 /// </summary>        
 public void Resolve(RefreshMode refreshMode) {
     this.conflict.TrackedObject.RefreshMember(this.metaMember, refreshMode, this.databaseValue);
     this.isResolved = true;
     this.conflict.OnMemberResolved();
 }
Example #37
0
        public NativeWindow(GraphicsMode mode, WindowOptions options)
        {
            if (options.ScreenMode == ScreenMode.Native)
            {
                options.Width = DisplayDevice.Default.Width;
                options.Height = DisplayDevice.Default.Height;
            }

            GameWindowFlags windowFlags = GameWindowFlags.Default;
            if (options.ScreenMode == ScreenMode.FixedWindow)
                windowFlags = GameWindowFlags.FixedWindow;
            else if (options.ScreenMode == ScreenMode.Fullscreen || options.ScreenMode == ScreenMode.Native)
                windowFlags = GameWindowFlags.Fullscreen;

            this.refreshMode = options.RefreshMode;
            this.internalWindow = new InternalWindow(
                this,
                options.Width,
                options.Height,
                mode,
                options.Title,
                windowFlags);
            this.internalWindow.MakeCurrent();
            this.internalWindow.CursorVisible = true;
            if (!options.SystemCursorVisible)
                this.internalWindow.Cursor = MouseCursor.Empty;
            this.internalWindow.VSync = (options.RefreshMode != RefreshMode.VSync) ? VSyncMode.Off : VSyncMode.On;

            Log.Core.Write(
                "Window Specification: " + Environment.NewLine +
                "Buffers: {0}"           + Environment.NewLine +
                "Samples: {1}"           + Environment.NewLine +
                "ColorFormat: {2}"       + Environment.NewLine +
                "AccumulatorFormat: {3}" + Environment.NewLine +
                "Depth: {4}"             + Environment.NewLine +
                "Stencil: {5}"           + Environment.NewLine +
                "VSync: {6}"             + Environment.NewLine +
                "SwapInterval: {7}",
                this.internalWindow.Context.GraphicsMode.Buffers,
                this.internalWindow.Context.GraphicsMode.Samples,
                this.internalWindow.Context.GraphicsMode.ColorFormat,
                this.internalWindow.Context.GraphicsMode.AccumulatorFormat,
                this.internalWindow.Context.GraphicsMode.Depth,
                this.internalWindow.Context.GraphicsMode.Stencil,
                this.internalWindow.VSync,
                this.internalWindow.Context.SwapInterval);

            // Retrieve icon from executable file and set it as window icon
            Assembly entryAssembly = Assembly.GetEntryAssembly();
            if (entryAssembly != null)
            {
                string executablePath = Path.GetFullPath(entryAssembly.Location);
                if (File.Exists(executablePath))
                {
                    this.internalWindow.Icon = Icon.ExtractAssociatedIcon(executablePath);
                }
            }

            if (options.ScreenMode == ScreenMode.FullWindow)
                this.internalWindow.WindowState = WindowState.Fullscreen;

            DualityApp.TargetResolution = new Vector2(this.internalWindow.ClientSize.Width, this.internalWindow.ClientSize.Height);

            // Register events and input
            this.HookIntoDuality();

            // Determine OpenGL capabilities and log them
            GraphicsBackend.LogOpenGLSpecs();
        }
Example #38
0
        public NativeWindow(GraphicsMode mode, WindowOptions options)
        {
            if (options.ScreenMode == ScreenMode.Native && DisplayDevice.Default != null)
            {
                options.Width = DisplayDevice.Default.Width;
                options.Height = DisplayDevice.Default.Height;
            }

            GameWindowFlags windowFlags = GameWindowFlags.Default;
            if (options.ScreenMode == ScreenMode.FixedWindow)
                windowFlags = GameWindowFlags.FixedWindow;
            else if (options.ScreenMode == ScreenMode.Fullscreen || options.ScreenMode == ScreenMode.Native)
                windowFlags = GameWindowFlags.Fullscreen;

            this.refreshMode = options.RefreshMode;
            this.internalWindow = new InternalWindow(
                this,
                options.Width,
                options.Height,
                mode,
                options.Title,
                windowFlags);
            this.internalWindow.MakeCurrent();
            this.internalWindow.CursorVisible = true;
            if (!options.SystemCursorVisible)
                this.internalWindow.Cursor = MouseCursor.Empty;
            this.internalWindow.VSync = (options.RefreshMode != RefreshMode.VSync) ? VSyncMode.Off : VSyncMode.On;

            Log.Core.Write(
                "Window Specification: " + Environment.NewLine +
                "  Buffers: {0}"         + Environment.NewLine +
                "  Samples: {1}"         + Environment.NewLine +
                "  ColorFormat: {2}"     + Environment.NewLine +
                "  AccumFormat: {3}"     + Environment.NewLine +
                "  Depth: {4}"           + Environment.NewLine +
                "  Stencil: {5}"         + Environment.NewLine +
                "  VSync: {6}"           + Environment.NewLine +
                "  SwapInterval: {7}",
                this.internalWindow.Context.GraphicsMode.Buffers,
                this.internalWindow.Context.GraphicsMode.Samples,
                this.internalWindow.Context.GraphicsMode.ColorFormat,
                this.internalWindow.Context.GraphicsMode.AccumulatorFormat,
                this.internalWindow.Context.GraphicsMode.Depth,
                this.internalWindow.Context.GraphicsMode.Stencil,
                this.internalWindow.VSync,
                this.internalWindow.Context.SwapInterval);

            // Retrieve icon from executable file and set it as window icon
            string executablePath = null;
            try
            {
                Assembly entryAssembly = Assembly.GetEntryAssembly();
                if (entryAssembly != null)
                {
                    executablePath = Path.GetFullPath(entryAssembly.Location);
                    if (File.Exists(executablePath))
                    {
                        this.internalWindow.Icon = Icon.ExtractAssociatedIcon(executablePath);
                    }
                }
            }
            // As described in issue 301 (https://github.com/AdamsLair/duality/issues/301), the
            // icon extraction can fail with an exception under certain circumstances. Don't fail
            // just because of an icon. Log the error and continue.
            catch (Exception e)
            {
                Log.Core.WriteError(
                    "There was an exception while trying to extract the " +
                    "window icon from the game's main executable '{0}'. This is " +
                    "uncritical, but still an error: {1}",
                    executablePath,
                    Log.Exception(e));
            }

            if (options.ScreenMode == ScreenMode.FullWindow)
                this.internalWindow.WindowState = WindowState.Fullscreen;

            DualityApp.TargetResolution = new Vector2(this.internalWindow.ClientSize.Width, this.internalWindow.ClientSize.Height);

            // Register events and input
            this.HookIntoDuality();

            // Determine OpenGL capabilities and log them
            GraphicsBackend.LogOpenGLSpecs();
        }
Example #39
0
 /// <summary>
 /// ストレージ オブジェクトをデータ ソース内のデータで更新します。
 /// </summary>
 /// <param name="refreshMode">更新モードを表す値。</param>
 /// <param name="obj">更新するストレージ オブジェクト。</param>
 public override void RefreshObject(RefreshMode refreshMode, StorageObject obj)
 {
     this.Target.RefreshObject(refreshMode, obj);
 }
Example #40
0
 public void Refresh(RefreshMode refreshMode, Entity entity)
 {
     base.Refresh(refreshMode.Map(), entity);
 }
Example #41
0
 public void Refresh(RefreshMode mode)
 {
     _objectContext.DetectChanges();
     _objectContext.Refresh(mode, _objectContext.EventGolfs);
 }
                /// <summary>
                /// Refresh internal tracking state using the original value and mode
                /// specified.
                /// </summary>        
                internal override void Refresh(RefreshMode mode, object freshInstance) {
                    this.SynchDependentData();

                    // This must be done prior to updating original values
                    this.UpdateDirtyMemberCache();

                    // Apply the refresh strategy to each data member
                    Type instanceType = freshInstance.GetType();
                    foreach (MetaDataMember mm in type.PersistentDataMembers) {
                        var memberMode = mm.IsDbGenerated ? RefreshMode.OverwriteCurrentValues : mode;
                        if (memberMode != RefreshMode.KeepCurrentValues) {
                            if (!mm.IsAssociation && (this.Type.Type == instanceType || mm.DeclaringType.Type.IsAssignableFrom(instanceType))) {
                                object freshValue = mm.StorageAccessor.GetBoxedValue(freshInstance);
                                this.RefreshMember(mm, memberMode, freshValue);
                            }
                        }
                    }

                    // Make the new data the current original value
                    this.original = this.CreateDataCopy(freshInstance);

                    if (mode == RefreshMode.OverwriteCurrentValues) {
                        this.ResetDirtyMemberTracking();
                    }
                }
                internal override void RefreshMember(MetaDataMember mm, RefreshMode mode, object freshValue) {
                    System.Diagnostics.Debug.Assert(!mm.IsAssociation);

                    if (mode == RefreshMode.KeepCurrentValues) {
                        return;
                    }

                    bool hasUserChange = this.HasChangedValue(mm);

                    // we don't want to overwrite any modified values, unless
                    // the mode is original wins                
                    if (hasUserChange && mode != RefreshMode.OverwriteCurrentValues)
                        return;

                    object currentValue = mm.StorageAccessor.GetBoxedValue(this.current);
                    if (!object.Equals(freshValue, currentValue)) {
                        mm.StorageAccessor.SetBoxedValue(ref this.current, freshValue);

                        // update all singleton associations that are affected by a change to this member
                        foreach (MetaDataMember am in this.GetAssociationsForKey(mm)) {
                            if (!am.Association.IsMany) {
                                IEnumerable ds = this.tracker.services.GetDeferredSourceFactory(am).CreateDeferredSource(this.current);
                                if (am.StorageAccessor.HasValue(this.current)) {
                                    this.AssignMember(this.current, am, ds.Cast<Object>().SingleOrDefault());
                                }
                            }
                        }
                    }
                }
		/// <summary>
		/// Resolve member conflicts using the mode specified and resetting the baseline 'Original' values
		/// to match the more recent 'Database' values.
		/// </summary>
		/// <param name="refreshMode">The mode that determines how the current values are 
		/// changed in order to resolve the conflict</param>
		/// <param name="autoResolveDeletes">If true conflicts resulting from the modified
		/// object no longer existing in the database will be automatically resolved.</param>
		public void Resolve(RefreshMode refreshMode, bool autoResolveDeletes)
		{
			if(autoResolveDeletes && this.IsDeleted)
			{
				this.ResolveDelete();
			}
			else
			{
				// We make these calls explicity rather than simply calling
				// DataContext.Refresh (which does virtually the same thing)
				// since we want to cache the database value read.
				if(this.Database == null)
				{
					throw Error.RefreshOfDeletedObject();
				}
				trackedObject.Refresh(refreshMode, this.Database);
				this.isResolved = true;
			}
		}
Example #45
0
 public void Refresh(RefreshMode refreshMode, object entity)
 {
 }
 public void Resolve(RefreshMode refreshMode)
 {
     throw new NotImplementedException();
 }
Example #47
0
		public void Resolve (RefreshMode refreshMode)
		{
			throw new NotImplementedException ();
		}
		public void Resolve (RefreshMode refreshMode, bool autoResolveDeletes)
		{
			throw new NotImplementedException ();
		}
 /// <summary>
 /// Does the refresh operation for a single member.  This method does not 
 /// update the baseline 'original' value.  You must call 
 /// Refresh(RefreshMode.KeepCurrentValues, freshInstance) to finish the refresh 
 /// after refreshing individual members.
 /// </summary>
 /// <param name="member"></param>
 /// <param name="mode"></param>
 /// <param name="freshValue"></param>
 internal abstract void RefreshMember(MetaDataMember member, RefreshMode mode, object freshValue);
        public void Resolve(RefreshMode mode, object originalListItem, object databaseListItem)
        {
            SPListItem originalItem = originalListItem as SPListItem;
            SPListItem databaseItem = databaseListItem as SPListItem;

            if (databaseItem == null || originalItem == null) return;

            //SPAttachmentCollection originalValue = originalItem["Attachments"] as SPAttachmentCollection;
            //SPAttachmentCollection databaseValue = databaseItem["Attachments"] as SPAttachmentCollection;

            //switch (mode)
            //{
            //    case RefreshMode.KeepChanges:
            //        if (_contentAttachments != originalValue)
            //        {
            //            databaseItem["Attachments"] = _contentAttachments;
            //        }
            //        else if (_contentAttachments == originalValue &&
            //            _contentAttachments != databaseValue)
            //        {
            //            _contentAttachments = databaseValue;
            //        }
            //        break;
            //    case RefreshMode.KeepCurrentValues:
            //        databaseItem["Attachments"] = _contentAttachments;
            //        break;
            //    case RefreshMode.OverwriteCurrentValues:
            //        _contentAttachments = databaseValue;
            //        break;
            //    default:
            //        break;
            //}
        }
Example #51
0
 public void Refresh(RefreshMode refreshMode, IEnumerable <Entity> collection)
 {
     base.Refresh(refreshMode.Map(), collection);
 }
 public void Refresh(DataContext dataContext, RefreshMode mode, object entity) {
     dataContext.Refresh(mode, entity);
 }
Example #53
0
        public NativeWindow(GraphicsMode mode, WindowOptions options)
        {
            if ((options.ScreenMode & (ScreenMode.ChangeResolution | ScreenMode.FullWindow)) != 0)
            {
                if (DisplayDevice.Default != null)
                {
                    options.Size = new Point2(
                        DisplayDevice.Default.Width,
                        DisplayDevice.Default.Height);
                }
            }

            screenMode = options.ScreenMode & (ScreenMode.FullWindow | ScreenMode.FixedSize | ScreenMode.ChangeResolution);

            GameWindowFlags windowFlags = GameWindowFlags.Default;

            if ((screenMode & ScreenMode.FixedSize) != 0)
            {
                windowFlags = GameWindowFlags.FixedWindow;
            }
            else if ((screenMode & ScreenMode.ChangeResolution) != 0)
            {
                windowFlags = GameWindowFlags.Fullscreen;
            }

            VSyncMode vsyncMode;

            switch (options.RefreshMode)
            {
            default:
            case RefreshMode.NoSync:
            case RefreshMode.ManualSync:
                vsyncMode = VSyncMode.Off;
                break;

            case RefreshMode.VSync:
                vsyncMode = VSyncMode.On;
                break;

            case RefreshMode.AdaptiveVSync:
                vsyncMode = VSyncMode.Adaptive;
                break;
            }

            this.refreshMode    = options.RefreshMode;
            this.internalWindow = new InternalWindow(
                this,
                options.Size.X,
                options.Size.Y,
                mode,
                options.Title,
                windowFlags);
            this.internalWindow.MakeCurrent();
            this.internalWindow.CursorVisible = true;
            if (!options.SystemCursorVisible)
            {
                this.internalWindow.Cursor = MouseCursor.Empty;
            }
            this.internalWindow.VSync = vsyncMode;

            App.Log(
                "Window Specification: " + Environment.NewLine +
                "  Buffers: {0}" + Environment.NewLine +
                "  Samples: {1}" + Environment.NewLine +
                "  ColorFormat: {2}" + Environment.NewLine +
                "  AccumFormat: {3}" + Environment.NewLine +
                "  Depth: {4}" + Environment.NewLine +
                "  Stencil: {5}" + Environment.NewLine +
                "  VSync: {6}" + Environment.NewLine +
                "  SwapInterval: {7}",
                this.internalWindow.Context.GraphicsMode.Buffers,
                this.internalWindow.Context.GraphicsMode.Samples,
                this.internalWindow.Context.GraphicsMode.ColorFormat,
                this.internalWindow.Context.GraphicsMode.AccumulatorFormat,
                this.internalWindow.Context.GraphicsMode.Depth,
                this.internalWindow.Context.GraphicsMode.Stencil,
                this.internalWindow.VSync,
                this.internalWindow.Context.SwapInterval);

            // Retrieve icon from executable file and set it as window icon
            string executablePath = null;

            try {
                Assembly entryAssembly = Assembly.GetEntryAssembly();
                if (entryAssembly != null)
                {
                    executablePath = Path.GetFullPath(entryAssembly.Location);
                    if (File.Exists(executablePath))
                    {
                        this.internalWindow.Icon = Icon.ExtractAssociatedIcon(executablePath);
                    }
                }
            }
            // As described in issue 301 (https://github.com/AdamsLair/duality/issues/301), the
            // icon extraction can fail with an exception under certain circumstances. Don't fail
            // just because of an icon. Log the error and continue.
            catch (Exception e) {
                App.Log(
                    "There was an exception while trying to extract the " +
                    "window icon from the game's main executable '{0}'. This is " +
                    "uncritical, but still an error: {1}",
                    executablePath,
                    e);
            }

            if ((screenMode & ScreenMode.FullWindow) != 0)
            {
                this.internalWindow.WindowState = WindowState.Fullscreen;
            }

            DualityApp.WindowSize = new Point2(this.internalWindow.ClientSize.Width,
                                               this.internalWindow.ClientSize.Height);

            // Register events and input
            this.HookIntoDuality();

            // Determine OpenGL capabilities and log them
            GraphicsBackend.LogOpenGLSpecs();
        }
 public RefreshButton()
 {
     this.mode = RefreshMode.Undefined;
 }