예제 #1
0
        public CommentCommandEditerViewModel(bool isAnonymousDefault = true)
        {
            _CompositeDisposable = new CompositeDisposable();

            IsAnonymousDefault = isAnonymousDefault;
            CanChangeAnonymity = new ReactiveProperty <bool>(false)
                                 .AddTo(_CompositeDisposable);
            IsAnonymousComment = new ReactiveProperty <bool>(IsAnonymousDefault)
                                 .AddTo(_CompositeDisposable);

            SizeSelectedItem = new ReactiveProperty <CommandType?>(new Nullable <CommandType>())
                               .AddTo(_CompositeDisposable);
            AlingmentSelectedItem = new ReactiveProperty <CommandType?>(new Nullable <CommandType>())
                                    .AddTo(_CompositeDisposable);
            ColorSelectedItem = new ReactiveProperty <CommandType?>(new Nullable <CommandType>())
                                .AddTo(_CompositeDisposable);

            FreePickedColor = new ReactiveProperty <Color>()
                              .AddTo(_CompositeDisposable);
            IsPickedColor = new ReactiveProperty <bool>(false)
                            .AddTo(_CompositeDisposable);

            ResetAllCommand = new DelegateCommand(() =>
            {
                _NowReseting = true;

                try
                {
                    IsAnonymousComment.Value    = IsAnonymousDefault;
                    SizeSelectedItem.Value      = null;
                    AlingmentSelectedItem.Value = null;
                    ColorSelectedItem.Value     = null;
                    FreePickedColor.Value       = default(Color);
                    IsPickedColor.Value         = false;
                }
                finally
                {
                    _NowReseting = false;
                }

                OnCommandChanged?.Invoke();
            });


            Observable.Merge(
                IsAnonymousComment.ToUnit(),
                SizeSelectedItem.ToUnit(),
                AlingmentSelectedItem.ToUnit(),
                ColorSelectedItem.ToUnit(),
                FreePickedColor.ToUnit(),
                IsPickedColor.ToUnit()
                )
            .Where(x => !_NowReseting)
            .Subscribe(_ => OnCommandChanged?.Invoke())
            .AddTo(_CompositeDisposable);
        }
예제 #2
0
        /*
         * private const int EM_CHARFROMPOS = 0x00D7;
         * [StructLayout(LayoutKind.Sequential)]
         * public struct POINT
         * {
         *  public System.Int32 x;
         *  public System.Int32 y;
         * }
         * [DllImport("user32.Dll", CharSet = CharSet.Auto)]
         * private static extern IntPtr SendMessage(IntPtr hWnd, int msg, IntPtr wParam, POINT lParam);
         * [DllImport("user32.Dll", CharSet = CharSet.Auto)]
         * private static extern IntPtr FindWindowEx(IntPtr hWnd1, IntPtr hWnd2, string lpsz1, string lpsz2);
         */
        #endregion

        #region EVENT HANDLERS (Command Line)
        private void comboCommand_TextChanged(object sender, System.EventArgs e)
        {
            if (ignoreLookup == false)
            {
                TcpIpCommand command = commandCenter.Parse(comboCommand.Text);
                if (command != null)
                {
                    if (commandCenter.TcpIpCommand == null || command.Name.Equals(commandCenter.TcpIpCommand.Name) == false)
                    {
                        commandCenter.TcpIpCommand = command;
                    }
                }
                else
                {
                    commandCenter.TcpIpCommand = null;
                }
            }


            if (OnCommandChanged != null && OnCommandChanged.GetInvocationList() != null)
            {
                OnCommandChanged(sender, comboCommand.Text);
            }
        }