コード例 #1
0
 public OnOffGauge(IUndoManager undoManager) : base(undoManager)
 {
     _offPosition = new GaugePosition(undoManager);
     _onPosition  = new GaugePosition(undoManager);
     _dimension   = new GaugeDimension(undoManager);
     _position    = new GaugePosition(undoManager);
 }
コード例 #2
0
ファイル: CodeEditor.cs プロジェクト: xuchuansheng/GenXSource
		internal CodeEditor(
			ICommandManager commandManager
			, IEditorView editorView
			, IEditorViewHost editorViewHost
			, IEditorCommands editorCommands
			, IUndoManager undoManager
			, IFindLogic findLogic
			, CodeOptionsModel codeOptionsModel
			)
		{
			this.commandManager = commandManager;
			this.editorView = editorView;
			this.editorViewHost = editorViewHost;
			this.findLogic = findLogic;
			this.editorCommands = editorCommands;
			this.undoManager = undoManager;
			FrameworkElement element = this.Element;
			element.PreviewLostKeyboardFocus += new KeyboardFocusChangedEventHandler(this.Editor_LostFocus);
			element.LostFocus += new RoutedEventHandler(this.Editor_LostFocus);
			if (this.commandManager != null)
			{
				this.commandManager.CommandExecuting += new CommandExecutionEventHandler(this.Editor_LostFocus);
			}
			this.editorView.Background = Brushes.White;
			TextFormattingRunProperties.DefaultProperties.SetTypeface(new Typeface(FontName));
			TextFormattingRunProperties.DefaultProperties.SetFontRenderingEmSize(FontSize);
			this.editorViewHost.LineNumberGutterForegroundColor = Colors.Black;
			this.editorViewHost.LineNumberGutterTypeface = new Typeface(FontName);
			this.editorViewHost.LineNumberGutterFontSize = FontSize;
			this.editorView.Invalidate();
			this.codeOptionsModel = codeOptionsModel;
			this.codeOptionsModel.PropertyChanged += new PropertyChangedEventHandler(this.CodeOptionsModel_PropertyChanged);
			this.UpdateOptions();
		}
コード例 #3
0
        /// <summary>
        /// Initializes a new instance of the DrawingView class
        /// </summary>
        public DrawingView()
        {
            InitializeComponent();

            _undoManager = App.Container.Resolve <IUndoManager>();

            _modes[Mode.Drawing] = App.Container.Resolve <IDrawingMode>();
            _modes[Mode.Erasing] = App.Container.Resolve <IErasingMode>();
            _modes[Mode.Panning] = App.Container.Resolve <IPanningMode>();
            foreach (var pair in _modes)
            {
                pair.Value.InkCanvasView = InkCanvasView;
            }

            _viewModel.StencilCommand = new Command <string>(OnStencil);

            BindingContext = _viewModel;

            //InkCanvasView.SizeChanged += InkCanvasView_SizeChanged;
            //InkCanvasView.WetInkTouched += InkCanvasView_WetInkTouched;
            //MenuView.NewSketchCommand = new RelayCommand<object>(OnNewSketch);

            Mode = Mode.Panning;

            InkCanvasView.DefaultInkDrawingAttributesChanged += InkCanvasView_DefaultInkDrawingAttributesChanged;
            InkCanvasView.InkPresenter.InputDeviceTypes       = XCoreInputDeviceTypes.Pen;

            LoadGrid();
        }
コード例 #4
0
        public void Mold(IUndoManager undo)
        {
            MeshCollider mc = GetComponent <MeshCollider>();

            if (mc != null && mc.sharedMesh != null)
            {
                Terrain t = TerrainManager.GetTerrain(transform.position);
                if (t != null)
                {
                    if (EnableUndo)
                    {
                        undo.RecordObject(t.terrainData, "Molded " + t.terrainData.name);
                    }
                    Debug.Log(TerrainMeshMold.MoldToMesh(t, mc, Additive, SaftyMargin, OffsetY, StrengthFromColor, DoNotAddHeight, InvertStrength));
                }
                else
                {
                    Debug.Log("Couldn't find terrain");
                }
            }
            else
            {
                Debug.LogError("Needs meshcollider");
            }
        }
コード例 #5
0
ファイル: CodeEditor.cs プロジェクト: radtek/GenXSource
        internal CodeEditor(
            ICommandManager commandManager
            , IEditorView editorView
            , IEditorViewHost editorViewHost
            , IEditorCommands editorCommands
            , IUndoManager undoManager
            , IFindLogic findLogic
            , CodeOptionsModel codeOptionsModel
            )
        {
            this.commandManager = commandManager;
            this.editorView     = editorView;
            this.editorViewHost = editorViewHost;
            this.findLogic      = findLogic;
            this.editorCommands = editorCommands;
            this.undoManager    = undoManager;
            FrameworkElement element = this.Element;

            element.PreviewLostKeyboardFocus += new KeyboardFocusChangedEventHandler(this.Editor_LostFocus);
            element.LostFocus += new RoutedEventHandler(this.Editor_LostFocus);
            if (this.commandManager != null)
            {
                this.commandManager.CommandExecuting += new CommandExecutionEventHandler(this.Editor_LostFocus);
            }
            this.editorView.Background = Brushes.White;
            TextFormattingRunProperties.DefaultProperties.SetTypeface(new Typeface(FontName));
            TextFormattingRunProperties.DefaultProperties.SetFontRenderingEmSize(FontSize);
            this.editorViewHost.LineNumberGutterForegroundColor = Colors.Black;
            this.editorViewHost.LineNumberGutterTypeface        = new Typeface(FontName);
            this.editorViewHost.LineNumberGutterFontSize        = FontSize;
            this.editorView.Invalidate();
            this.codeOptionsModel = codeOptionsModel;
            this.codeOptionsModel.PropertyChanged += new PropertyChangedEventHandler(this.CodeOptionsModel_PropertyChanged);
            this.UpdateOptions();
        }
コード例 #6
0
ファイル: WeatherFile.cs プロジェクト: MMory/loksim3d-source
 public AmbientIllumination(IUndoManager undoManager) : base(undoManager)
 {
     _dawnBegin       = new TimeSpan(3, 0, 0);
     _dawnEnd         = new TimeSpan(9, 0, 0);
     _duskBegin       = new TimeSpan(17, 0, 0);
     _duskEnd         = new TimeSpan(23, 0, 0);
     _brightnessDay   = 1;
     _brightnessNight = 0;
 }
コード例 #7
0
ファイル: Document.cs プロジェクト: akumetsuv/flood
        protected Document(IUndoManager undoManager, string path)
        {
            if (undoManager == null)
                throw new ArgumentNullException();

            Path = path;
            UndoManager = undoManager;

            UndoManager.OperationDone += OnUndoRedoEvent;
            UndoManager.OperationUndone += OnUndoRedoEvent;
        }
コード例 #8
0
ファイル: SkyFile.cs プロジェクト: MMory/loksim3d-source
 public static Weather ReadFromXml(string xmlEl, IUndoManager undoManager, L3dFilePath ownerPath = null)
 {
     try
     {
         return(ReadFromXml(XElement.Parse(xmlEl), undoManager, ownerPath));
     }
     catch (XmlException)
     {
     }
     return(null);
 }
コード例 #9
0
        public override void Load()
        {
            m_UndoManager = Session.GetManager <IUndoManager>();

            m_Undo            = ScriptableObject.CreateInstance <UndoObject>();
            m_Undo.hideFlags |= HideFlags.HideAndDontSave;
            m_Undo.Undo      += HandleUndo;
            m_Undo.Redo      += HandleRedo;

            m_UndoManager.ChangeRecorded += HandleChangeRecorded;
        }
コード例 #10
0
ファイル: WeatherFile.cs プロジェクト: MMory/loksim3d-source
 public WeatherTimeRange(IUndoManager undoManager, L3dFilePath parentFile = null) : base(undoManager)
 {
     _sightDistance    = 10000;
     _brightnessFactor = 1.0f;
     _variables        = new UndoAwareObservableCollection <L3dVariable>(undoManager);
     _textures         = new List <TextureEntry>(5);
     for (int i = 0; i < 5; i++)
     {
         TextureEntry en = new TextureEntry();
         en._texture = L3dFilePath.CreateRelativeToFile(string.Empty, parentFile);
         en._tileU   = 1;
         en._tileV   = 1;
         _textures.Add(en);
     }
 }
コード例 #11
0
ファイル: SkyFile.cs プロジェクト: MMory/loksim3d-source
 public static Weather ReadFromXml(XElement xmlEl, IUndoManager undoManager, L3dFilePath ownerPath = null)
 {
     if (xmlEl != null && xmlEl.Name == FileDescriptions.FILE_SKY_EL_WEATHER)
     {
         XElement props = xmlEl.Element(FileDescriptions.FILE_SKY_EL_WEATHER_PROPS);
         if (props != null)
         {
             Weather w = new Weather(undoManager);
             w._propability = props.Attribute(FileDescriptions.FILE_SKY_AT_WEATHER_PROBABILITY).Read <int>(1);
             w._weatherFile = L3dFilePath.CreateRelativeToFile(props.Attribute(FileDescriptions.FILE_SKY_AT_WEATHER_FILE).Read <string>(), ownerPath);
             return(w);
         }
     }
     return(null);
 }
コード例 #12
0
        /// <summary>
        /// Registers an operation with the provided argument, which will be invoked when an undo is performed.
        /// </summary>
        /// <typeparam name="TArgument">The type of the argument.</typeparam>
        /// <param name="undoManager">The <see cref="IUndoManager"/> instance.</param>
        /// <param name="selector">The invocation delegate of the undo operation.</param>
        /// <param name="argument">The argument to pass the teh method call while invoking the registered invokation.</param>
        /// <exception cref="ArgumentNullException">
        ///		<para><paramref name="selector"/> is a <see langword="null"/> reference</para>
        ///		<para>- or -</para>
        ///		<para><paramref name="argument"/> is a <see langword="null"/> reference.</para>
        /// </exception>
        public static void RegisterInvokation <TArgument>(this IUndoManager undoManager, Action <TArgument> selector, TArgument argument)
        {
            if (selector == null)
            {
                throw new ArgumentNullException("selector");
            }

            if (argument == null)
            {
                throw new ArgumentNullException("argument");
            }

            var invokation = new ActionInvokation <TArgument>(selector, argument);

            undoManager.RegisterInvokation(invokation);
        }
コード例 #13
0
ファイル: WeatherFile.cs プロジェクト: MMory/loksim3d-source
 public static AmbientIllumination ReadFromXml(XElement xmlEl, IUndoManager undoManager, L3dFilePath ownerPath = null)
 {
     if (xmlEl != null && xmlEl.Name == FileDescriptions.FILE_WEATHER_EL_ILLUMINATION)
     {
         XElement illuminationProps = xmlEl.Element(FileDescriptions.FILE_WEATHER_EL_ILLUMINATION_PROPS);
         if (illuminationProps != null)
         {
             AmbientIllumination ill = new AmbientIllumination(undoManager);
             ill._brightnessDay   = illuminationProps.Attribute(FileDescriptions.FILE_WEATHER_AT_ILLUMINATION_BRIGHTNESS_DAY).Read <float>(1.0f);
             ill._brightnessNight = illuminationProps.Attribute(FileDescriptions.FILE_WEATHER_AT_ILLUMINATION_BRIGHTNESS_NIGHT).Read <float>(0.0f);
             ill._dawnBegin       = illuminationProps.Attribute(FileDescriptions.FILE_WEATHER_AT_ILLUMINATION_DAWN_BEGIN).ReadTime(new TimeSpan(3, 0, 0));
             ill._dawnEnd         = illuminationProps.Attribute(FileDescriptions.FILE_WEATHER_AT_ILLUMINATION_DAWN_END).ReadTime(new TimeSpan(6, 0, 0));
             ill._duskBegin       = illuminationProps.Attribute(FileDescriptions.FILE_WEATHER_AT_ILLUMINATION_DUSK_BEGIN).ReadTime(new TimeSpan(17, 0, 0));
             ill._duskEnd         = illuminationProps.Attribute(FileDescriptions.FILE_WEATHER_AT_ILLUMINATION_DUSK_END).ReadTime(new TimeSpan(23, 0, 0));
             return(ill);
         }
     }
     return(null);
 }
コード例 #14
0
        public static void AlignToGroundNormal(GroundAlign ga, IUndoManager undo = null)
        {
            if (undo != null)
            {
                undo.RecordTransform("Align", ga.transform);
            }

            bool resetLayer = false;

            if (LayerMask.LayerToName(ga.gameObject.layer) == "Environment")
            {
                ga.gameObject.layer = LayerMask.NameToLayer("Default");
                resetLayer          = true;
            }

            RaycastHit?hit;

            if (ga.OnlyAlignToTerrain)
            {
                hit = TerrainManager.GetTerrainHitOnly(ga.transform.position + Vector3.up * 100, Vector3.down);
            }
            else
            {
                hit = TerrainManager.GetGroundHit(ga.transform.position);
            }


            if (hit.HasValue)
            {
                Vector3 fromv = GetTransfomAxis(ga.transform, ga.FromAxis, ga.InvertAxis);

                ga.transform.rotation = Quaternion.FromToRotation(fromv, hit.Value.normal) * ga.transform.rotation;
            }
            else
            {
            }

            if (resetLayer)
            {
                ga.gameObject.layer = LayerMask.NameToLayer("Environment");
            }
        }
コード例 #15
0
        public async Task Initialize(FrameworkElement wnd)
        {
            var domain = await InitializeStore();
            PopulateLibraryDomain(domain);

            UndoCommand = new RelayCommand(p => { undoManager.Undo(); }, p => undoManager.CanUndo);
            RedoCommand = new RelayCommand(p => { undoManager.Redo(); }, p => undoManager.CanRedo);

            CreateLoanCommand = new RelayCommand(p => CreateLoan(), p => SelectedBook != null && SelectedMember != null && SelectedBook.Copies > 0);

            undoManager = new UndoManager(store);
            // Now, all changes in the domain will be memorized
            undoManager.RegisterDomain(domain);

            // Collaborative mode, show how the model is synchronized between muliples instances.
            // To try it, uncomment the following line and run several instances (outside Visual Studio) of the application (locally). Every change will be repercuted on other instances. 
            // await InitializeCollaborativeMode(domain);
            
            wnd.DataContext = this;
        }
コード例 #16
0
        public async Task Initialize(FrameworkElement wnd)
        {
            var domain = await InitializeStore();

            PopulateLibraryDomain(domain);

            UndoCommand = new RelayCommand(p => { undoManager.Undo(); }, p => undoManager.CanUndo);
            RedoCommand = new RelayCommand(p => { undoManager.Redo(); }, p => undoManager.CanRedo);

            CreateLoanCommand = new RelayCommand(p => CreateLoan(), p => SelectedBook != null && SelectedMember != null && SelectedBook.Copies > 0);

            undoManager = new UndoManager(store);
            // Now, all changes in the domain will be memorized
            undoManager.RegisterDomain(domain);

            // Collaborative mode, show how the model is synchronized between muliples instances.
            // To try it, uncomment the following line and run several instances (outside Visual Studio) of the application (locally). Every change will be repercuted on other instances.
            // await InitializeCollaborativeMode(domain);

            wnd.DataContext = this;
        }
コード例 #17
0
        /// <summary>
        /// Registers an operation as lambda expression, which will be invoked when an undo is performed.
        /// </summary>
        /// <typeparam name="TSource">The type of the source.</typeparam>
        /// <param name="undoManager">The <see cref="IUndoManager"/> instance.</param>
        /// <param name="target">The target instance.</param>
        /// <param name="selector">The invocation delegate of the undo operation.</param>
        /// <exception cref="ArgumentNullException">
        ///		<para><paramref name="target"/> is a <see langword="null"/> reference</para>
        ///		<para>- or -</para>
        ///		<para><paramref name="selector"/> is a <see langword="null"/> reference.</para>
        /// </exception>
        public static void RegisterInvokation <TSource>(this IUndoManager undoManager, TSource target, Expression <Action <TSource> > selector)
        {
            if (undoManager == null)
            {
                throw new ArgumentNullException("undoManager");
            }

            if (target == null)
            {
                throw new ArgumentNullException("target");
            }

            if (selector == null)
            {
                throw new ArgumentNullException("selector");
            }

            var invokation = new LambdaExpressionInvokation <TSource>(target, selector);

            undoManager.RegisterInvokation(invokation);
        }
コード例 #18
0
        public static void AlignToGround(GroundAlign ga, IUndoManager undo = null)
        {
            if (undo != null)
            {
                undo.RecordTransform("Align", ga.transform);
            }

            bool resetLayer = false;

            if (LayerMask.LayerToName(ga.gameObject.layer) == "Environment")
            {
                ga.gameObject.layer = LayerMask.NameToLayer("Default");
                resetLayer          = true;
            }

            RaycastHit?hit;

            if (ga.OnlyAlignToTerrain)
            {
                hit = TerrainManager.GetTerrainHitOnly(ga.transform.position + Vector3.up * 100, Vector3.down);
            }
            else
            {
                hit = TerrainManager.GetGroundHit(ga.transform.position);
            }

            if (hit != null)
            {
                ga.transform.position = hit.Value.point + ga.Offset;
            }

            if (resetLayer)
            {
                ga.gameObject.layer = LayerMask.NameToLayer("Environment");
            }
        }
コード例 #19
0
 public GaugeDimension(IUndoManager undoManager)
     : base(undoManager)
 {
 }
コード例 #20
0
 public GaugePosition(IUndoManager undoManager) : base(undoManager)
 {
 }
コード例 #21
0
ファイル: WeatherFile.cs プロジェクト: MMory/loksim3d-source
 public L3dVariable(IUndoManager undoManager) : this(undoManager, string.Empty, string.Empty)
 {
 }
コード例 #22
0
 public UndoAwareFilePart(IUndoManager undoManager)
 {
     _undoManager = undoManager;
 }
コード例 #23
0
 public UndoAwareObservableCollection(IUndoManager undoManager, List <T> list)
     : base(list)
 {
     _undoManager = undoManager;
 }
コード例 #24
0
ファイル: DocumentTests.cs プロジェクト: akumetsuv/flood
 public TestDocument(IUndoManager undoManager, string path)
     : base(undoManager, path)
 {
 }
コード例 #25
0
 public BaseInputDispatch(IUndoManager undoManger, IRenderUC renderUC)
 {
     this.undoManager = undoManger;
     this.Init(renderUC.InputDispatch);
 }
コード例 #26
0
ファイル: SkyFile.cs プロジェクト: MMory/loksim3d-source
 public Weather(IUndoManager undoManager, L3dFilePath weatherFile)
     : base(undoManager)
 {
     _weatherFile = weatherFile;
     _propability = 1;
 }
コード例 #27
0
ファイル: SceneDocument.cs プロジェクト: akumetsuv/flood
 public SceneDocument(IUndoManager undoManager, string path)
     : base(undoManager, path)
 {
 }
コード例 #28
0
 public UIInputDispatch(IUndoManager undoManager, IRenderUC renderUC)
     : base(undoManager, renderUC)
 {
 }
コード例 #29
0
 public UndoAwareObservableCollection(IUndoManager undoManager)
 {
     _undoManager = undoManager;
 }
コード例 #30
0
 public UndoAwareObservableCollection(IUndoManager undoManager, IEnumerable <T> collection) : base(collection)
 {
     _undoManager = undoManager;
 }
コード例 #31
0
 /// <summary>
 /// Initializes a new instance of the <see cref="DrawingPageViewModel"/> class
 /// </summary>
 /// <param name="undoManager"></param>
 public DrawingPageViewModel(IUndoManager undoManager)
 {
     UndoManager = undoManager;
 }
コード例 #32
0
ファイル: WeatherFile.cs プロジェクト: MMory/loksim3d-source
 public L3dVariable(IUndoManager undoManager, string name, string value)
     : base(undoManager)
 {
     _name  = name;
     _value = value;
 }
コード例 #33
0
ファイル: UndoTests.cs プロジェクト: akumetsuv/flood
 public void Init()
 {
     undo = new UndoManager();
     operation = Substitute.For<IUndoOperation>();
     eventFired = false;
 }
コード例 #34
0
ファイル: SkyFile.cs プロジェクト: MMory/loksim3d-source
 public Weather(IUndoManager undoManager) : this(undoManager, null)
 {
 }
コード例 #35
0
ファイル: DocumentTests.cs プロジェクト: akumetsuv/flood
 public void Init()
 {
     undoManager = Substitute.For<IUndoManager>();
     document = new TestDocument(undoManager, Path);
     eventFired = false;
 }
コード例 #36
0
 public SplitPageViewModel(IUndoManager undoManager)
 {
     mode        = DisplayMode.Split;
     UndoManager = undoManager ?? throw new ArgumentNullException(nameof(undoManager));
 }
コード例 #37
0
 private CompositeTaskManager()
 {
     this.taskList    = new List <UndoableTaskBase <object> >();
     this.taskService = TaskServiceSingleton.Instance;
 }