Beispiel #1
0
        public void Modifier()
        {
            if (dataGridElements.SelectedItems.Count == 1)
            {
                //Faire la modif
                //Civilite civiliteAModifier = dataGridElements.SelectedItem as Civilite;
                OPERATION OPERATIONAModifier = (OPERATION)dataGridElements.SelectedItem;

                Operation window = new Operation(OPERATIONAModifier);
                window.ShowDialog();

                if (window.DialogResult.HasValue && window.DialogResult == true)
                {
                    //Sauvegarde
                    ((App)App.Current).entity.SaveChanges();
                }
                else
                {
                    //On rafraichit l'entity pour éviter les erreurs de données "fantomes" mal déliées
                    ((App)App.Current).entity = new LISA_DIGITALEntities();
                }
            }
            else
            {
                MessageBox.Show("Merci de sélectionner un et un élément maximum");
            }
            RefreshDatas();
        }
Beispiel #2
0
        private void Convert()
        {
            bool   isNegatif         = false;
            string theAbsoluteString = mInitialLine;

            if (mInitialLine[0] == '-')
            {
                isNegatif         = true;
                theAbsoluteString = mInitialLine.Substring(1);
            }


            string[] expression = theAbsoluteString.Split('(');

            if (expression.Length != 2)
            {
                return;
            }

            mOperation = Tools.ConvertOperation(expression[0]);
            string[] expression2 = expression[1].Split(')');
            mOperande = Tools.StringToDouble(expression2[0]);
            if (isNegatif)
            {
                mOperande = -mOperande;
            }
        }
        static void Calculate(int a, int b, OPERATION type)
        {
            localhost.CalculatorService calculatorService = new localhost.CalculatorService();
            int result;

            switch (type)
            {
            case OPERATION.ADD:
                result = calculatorService.Add(a, b);
                printSuccess(string.Format("{0} + {1} = {2}", a, b, result));
                break;

            case OPERATION.SUBTRACT:
                result = calculatorService.Subtract(a, b);
                printSuccess(string.Format("{0} - {1} = {2}", a, b, result));
                break;

            case OPERATION.MULTIPLY:
                result = calculatorService.Multiply(a, b);
                printSuccess(string.Format("{0} * {1} = {2}", a, b, result));
                break;

            case OPERATION.DIVIDE:
                result = calculatorService.Divide(a, b);
                printSuccess(string.Format("{0} / {1} = {2}", a, b, result));

                break;

            default:
                printError("Unknown operation: " + type);
                break;
            }
        }
Beispiel #4
0
        public string operation_clicked(string textBoxValue, string op)
        {
            prevNumber = int.Parse(textBoxValue);

            string returnValue = textBoxValue;

            if (operation == OPERATION.NUMBER)
            {
                returnValue = equal(textBoxValue);
            }
            if (op == "+")
            {
                operation = OPERATION.PLUS;
            }
            if (op == "-")
            {
                operation = OPERATION.MINUS;
            }
            if (op == "*")
            {
                operation = OPERATION.MULT;
            }
            if (op == "/")
            {
                operation = OPERATION.DIV;
            }
            prevOper = op;
            return(returnValue);
        }
Beispiel #5
0
 public Operation(int assetID, OPERATION operation) : this()
 {
     _operation = operation;
     _assetID   = assetID;
     _startDate = DateTime.Now;
     _status    = STATUS.pending;
 }
Beispiel #6
0
        public static bool Manipulate(ref float view, ref float projection, OPERATION operation, MODE mode, ref float matrix, ref float deltaMatrix, ref float snap, ref float localBounds, ref float boundsSnap)
        {
            fixed(float *native_view = &view)
            {
                fixed(float *native_projection = &projection)
                {
                    fixed(float *native_matrix = &matrix)
                    {
                        fixed(float *native_deltaMatrix = &deltaMatrix)
                        {
                            fixed(float *native_snap = &snap)
                            {
                                fixed(float *native_localBounds = &localBounds)
                                {
                                    fixed(float *native_boundsSnap = &boundsSnap)
                                    {
                                        byte ret = ImGuizmoNative.ImGuizmo_Manipulate(native_view, native_projection, operation, mode, native_matrix, native_deltaMatrix, native_snap, native_localBounds, native_boundsSnap);

                                        return(ret != 0);
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
Beispiel #7
0
        public void Supprimer()
        {
            if (dataGridElements.SelectedItems.Count == 1)
            {
                //Faire la modif
                OPERATION OPERATIONASupprimer = (OPERATION)dataGridElements.SelectedItem;

                if (MessageBox.Show("Êtes-vous sûr de vouloir supprimer cet élément ?",
                                    "Suppression",
                                    MessageBoxButton.YesNo) == MessageBoxResult.Yes)
                {
                    ((App)App.Current).entity.OPERATION.Remove(OPERATIONASupprimer);

                    //Sauvegarde
                    ((App)App.Current).entity.SaveChanges();
                }
                else
                {
                    //On rafraichit l'entity pour éviter les erreurs de données "fantomes" mal déliées
                    ((App)App.Current).entity = new LISA_DIGITALEntities();
                }
            }
            else
            {
                MessageBox.Show("Merci de sélectionner un et un élément maximum");
            }
            RefreshDatas();
        }
Beispiel #8
0
        private static WAHBitArray DoBitOperation(WAHBitArray bits, WAHBitArray c, OPERATION op, int maxsize)
        {
            if (bits != null)
            {
                switch (op)
                {
                case OPERATION.AND:
                    bits = bits.And(c);
                    break;

                case OPERATION.OR:
                    bits = bits.Or(c);
                    break;

                case OPERATION.ANDNOT:
                    bits = bits.And(c.Not(maxsize));
                    break;
                }
            }
            else
            {
                bits = c;
            }
            return(bits);
        }
        private static double[,] Operation(double[,] xMatrixA, double xDouble, OPERATION xOperation)
        {
            //MATRIX OPERATIONS WITH ONE DOUBLE AND ONE MATRIX
            double[,] matrix = new double[xMatrixA.GetLength(0), xMatrixA.GetLength(1)];
            for (int j = 0; j < matrix.GetLength(0); j++)
            {
                for (int i = 0; i < matrix.GetLength(1); i++)
                {
                    switch (xOperation)
                    {
                    case OPERATION.ADDITION:
                        matrix[j, i] = xMatrixA[j, i] + xDouble;
                        break;

                    case OPERATION.SUBTRACTION:
                        matrix[j, i] = xMatrixA[j, i] - xDouble;
                        break;

                    case OPERATION.MULTIPLICATION:
                        matrix[j, i] = xMatrixA[j, i] * xDouble;
                        break;

                    case OPERATION.DIVISION:
                        matrix[j, i] = xMatrixA[j, i] / xDouble;
                        break;
                    }
                }
            }
            return(matrix);
        }
Beispiel #10
0
        public string equal(string textBoxValue)
        {
            if (operation == OPERATION.NUMBER)
            {
                prevNumber = int.Parse(textBoxValue);
            }
            if (prevOper == "")
            {
                result = int.Parse(textBoxValue);
                return(textBoxValue);
            }
            if (prevOper == "-")
            {
                result = result - prevNumber;
            }
            if (prevOper == "+")
            {
                result = result + prevNumber;
            }
            if (prevOper == "*")
            {
                result = result * prevNumber;
            }
            if (prevOper == "/")
            {
                result = result / prevNumber;
            }
            operation = OPERATION.EQUAL;

            return(result.ToString());
        }
Beispiel #11
0
        private string DoTheMath(OPERATION operation)
        {
            _operation = OPERATION.NONE;
            int operatingFirst = int.Parse(_operatingFirst), operatingSecond = int.Parse(_operatingSecond);

            _operatingFirst = _operatingSecond = "0";
            switch (operation)
            {
            case OPERATION.DIV:
                if (operatingSecond == 0)
                {
                    return("ERROR");
                }
                else
                {
                    return((operatingFirst / operatingSecond).ToString());
                }

            case OPERATION.MULTI:
                return((operatingFirst * operatingSecond).ToString());

            case OPERATION.SUB:
                return((operatingFirst - operatingSecond).ToString());

            case OPERATION.SUM:
                return((operatingFirst + operatingSecond).ToString());

            default:
                return("0");
            }
        }
Beispiel #12
0
 public Calc()
 {
     operation  = OPERATION.NONE;
     result     = 0;
     prevOper   = "";
     prevNumber = 0;
 }
Beispiel #13
0
        /// <summary>
        ///
        /// </summary>
        /// <typeparam name="T"></typeparam>
        /// <param name="dal"></param>
        /// <returns></returns>
        public IEnumerable <T> ExcuteTransationResult <T>(CommonDal <T> dal, OPERATION OPER) where T : IModel
        {
            if (_ct == null)
            {
                TransactionOptions ops = new TransactionOptions();
                ops.IsolationLevel = _level;
                _ct         = new CommittableTransaction(ops);
                _sqlDicList = new Dictionary <string, SqlConnection>();
            }

            string        ConnStr = dal.getConnString();
            SqlConnection sqlCon  = null;

            foreach (var item in _sqlDicList)
            {
                if (ConnStr == item.Key)
                {
                    sqlCon = item.Value;
                    break;
                }
            }

            if (sqlCon == null)
            {
                sqlCon = new SqlConnection(ConnStr);
                sqlCon.Open();
                _sqlDicList.Add(ConnStr, sqlCon);
                sqlCon.EnlistTransaction(_ct);
            }

            _sqlExe = new SqlExecutor(sqlCon);

            try
            {
                switch (OPER)
                {
                case OPERATION.SELECT:
                    return(dal.ExcuteSelect(_sqlExe));

                case OPERATION.DELETE:
                    return(dal.ExcuteDelete(_sqlExe));

                case OPERATION.INSERT:
                    return(dal.ExcuteInsert(_sqlExe));

                case OPERATION.UPDATE:
                    return(dal.ExcuteUpdate(_sqlExe));

                default:
                    return(dal.ExcuteSelect(_sqlExe));
                }
            }
            catch (Exception ex)
            {
                logger.Error(GetExceptionDetails(ex));
                _ct.Rollback();
                _done = true;
                return(null);
            }
        }
Beispiel #14
0
        public void Ajouter()
        {
            Operation window = new Operation();

            window.ShowDialog();


            if (window.DialogResult.HasValue && window.DialogResult == true)
            {
                //Sauvegarde
                OPERATION OPERATIONToAdd = (OPERATION)window.DataContext;


                ((App)App.Current).entity.OPERATION.Add(OPERATIONToAdd);

                ((App)App.Current).entity.SaveChanges();
            }
            else
            {
                //On rafraichit l'entity pour éviter les erreurs de données "fantomes" mal déliées
                ((App)App.Current).entity = new LISA_DIGITALEntities();
            }

            RefreshDatas();
        }
Beispiel #15
0
        public Object Any(Services.Create request)
        {
            var command = request.ConvertTo <Create>();

            command.Operation = OPERATION.FromValue(request.Operation);

            return(_bus.Send(command).IsCommand <Command>());
        }
 public void CEPressed()
 {
     total      = 0;
     number     = 0;
     newNumber  = true;
     memory     = 0;
     lastEquals = false;
     operation  = OPERATION.NONE;
     ShowOutput();
 }
Beispiel #17
0
 public Rule(Fact Base, OPERATION Oper, Fact[] Proof)
 {
     baseFact = new Fact(Base);
     op       = Oper;
     proof    = new Fact[Proof.Length];
     for (int i = 0; i < Proof.Length; ++i)
     {
         proof[i] = new Fact(Proof[i]);
     }
 }
Beispiel #18
0
 public void clear()
 {
     state         = STATE.INSERT_CHARACTER;
     active_op     = OPERATION.NULL;
     decimal_added = false;
     currentBuffer = "0";
     total         = 0;
     history.Clear();
     calcWindow.onCurrentValueChange(currentBuffer);
 }
Beispiel #19
0
 public Rule(Fact[] Facts, OPERATION Oper)
 {
     baseFact = new Fact(Facts[0]);
     op       = Oper;
     proof    = new Fact[Facts.Length - 1];
     for (int i = 1; i < Facts.Length; ++i)
     {
         proof[i - 1] = new Fact(Facts[i]);
     }
 }
Beispiel #20
0
 public Rule(Rule R)
 {
     baseFact = new Fact(R.BaseFact);
     op       = R.Op;
     proof    = new Fact[R.GetCountProof()];
     for (int i = 0; i < R.GetCountProof(); ++i)
     {
         proof[i] = new Fact(R.GetFact(i));
     }
 }
Beispiel #21
0
 private void ButtonOperationClicked(OPERATION operation)
 {
     if (_operation == OPERATION.NONE)
     {
         _operation = operation;
     }
     else
     {
         textBoxResult.Text = DoTheMath(_operation);
     }
 }
Beispiel #22
0
 public Operation()
 {
     _OperationID = 0;
     _operation   = OPERATION.deployagent;
     _assetID     = 0;
     _assetName   = "";
     _startDate   = new DateTime(0);
     _endDate     = new DateTime(0);
     _status      = STATUS.none;
     _errorText   = "";
 }
Beispiel #23
0
        public override int Size()
        {
            int       logicprogramSize = 0;
            OPERATION op = new OPERATION();

            logicprogramSize += Marshal.SizeOf(op);
            logicprogramSize += QSize();
            logicprogramSize += ThenSize();
            logicprogramSize += ElseSize();
            return(logicprogramSize);
        }
Beispiel #24
0
 public Operation(OPERATION OP = null)
 {
     InitializeComponent();
     if (OP == null)
     {
         this.DataContext = new OPERATION();
     }
     else
     {
         this.DataContext = OP;
     }
 }
Beispiel #25
0
        public Rule GetRule()
        {
            OPERATION Operation = CheckCorrectness();

            if (Operation == OPERATION.NON_DEF)
            {
                return(null);
            }
            string Pattern = @"^(.+\))\s*:\s*(.+)*\.$";
            Match  M       = Regex.Match(Input, Pattern);

            GroupCollection gc     = M.Groups;
            List <string>   Result = new List <string>();

            Result.Add(gc[1].Value + ".");

            string Pattern2 = @"^([a-z][a-z|0-9]*\(\s*[a-z|A-Z|0-9|_]+(?:,\s*[a-zA-Z0-9_]+)*\))(?:\s*[&\|]\s*([a-z][a-z|0-9]*\(\s*[a-z|A-Z|0-9|_]+(?:,\s*[a-zA-Z0-9_]+)*\)))*$";
            string Params   = gc[2].Value;

            M  = Regex.Match(Params, Pattern2);
            gc = M.Groups;
            if (gc[0].Value == "")
            {
                return(null);
            }
            foreach (Group Gr in gc)
            {
                if (Gr.Value == Params)
                {
                    continue;
                }
                Result.Add(Gr.Value + ".");
            }

            Fact[] facts;
            facts = new Fact[Result.Count];
            for (int i = 0; i < Result.Count; ++i)
            {
                ParseFact parseFact = new ParseFact(Result[i]);
                if ((facts[i] = parseFact.GetFact()) == null)
                {
                    return(null);
                }
            }

            Rule R = new Rule(facts, Operation);

            return(R);
        }
Beispiel #26
0
        /// <summary>
        ///
        /// </summary>
        /// <typeparam name="T"></typeparam>
        /// <param name="dal"></param>
        /// <returns></returns>
        public static IEnumerable <T> ExcuteResult <T>(CommonDal <T> dal, OPERATION OPER, List <string> field = null) where T : IModel
        {
            var sqlCon = new SqlConnection(dal.getConnString());
            var sqlExe = new SqlExecutor(sqlCon);

            try
            {
                switch (OPER)
                {
                case OPERATION.SELECT:
                    return(dal.ExcuteSelect(sqlExe, field));

                case OPERATION.DELETE:
                    return(dal.ExcuteDelete(sqlExe));

                case OPERATION.INSERT:
                    return(dal.ExcuteInsert(sqlExe));

                case OPERATION.UPDATE:
                    return(dal.ExcuteUpdate(sqlExe));

                default:
                    return(dal.ExcuteSelect(sqlExe));
                }
            }
            catch (Exception ex)
            {
                StringBuilder message = new StringBuilder();
                var           detail  = dal.getParaLogDetail();
                if (detail != null)
                {
                    var dbExisted = dal.getConnString().Split(';').Length > 0;

                    if (dbExisted)
                    {
                        message.AppendLine("連線: " + dal.getConnString().Split(';')[0]);
                    }
                    message.AppendLine("語法: " + dal.getCommandString());
                    message.AppendLine("參數: ");
                    foreach (var item in detail)
                    {
                        message.AppendLine(item.Key + "=>" + item.Value);
                    }
                }
                message.AppendLine(GetExceptionDetails(ex));
                logger.Error(message);
                return(null);
            }
        }
Beispiel #27
0
        public string number_clicked(string textBoxValue, string digit)
        {
            if (operation == OPERATION.NUMBER)
            {
                if (textBoxValue == "0")
                {
                    textBoxValue = "";
                }
                return(textBoxValue + digit);
            }

            result    = int.Parse(textBoxValue);
            operation = OPERATION.NUMBER;
            return(digit);
        }
Beispiel #28
0
        /// <summary>
        /// Sets the initial input and target data files which are then loaded into the data sets.
        /// </summary>
        /// <param name="op">Specifies the operation to perform.</param>
        /// <param name="strInputFile">Specifies the input filename.</param>
        /// <param name="strTargetFile">Specifies the target filename.</param>
        /// <param name="strIter">Specifies the iterations to run.</param>
        /// <param name="strInput">Specifies the input text used when running the model.</param>
        /// <param name="strBatch">Specifies the batch size, current = "1"</param>
        /// <param name="strHidden">Specifies the hidden size.</param>
        /// <param name="strWordSize">Specifies the word size.</param>
        /// <param name="strLr">Specifies the learning rate.</param>
        /// <param name="bUseSoftmax">Use softmax cross entropy instead of memory loss layer.</param>
        /// <param name="bUseExtIp">Use external inner-product layer.</param>
        /// <param name="bUseBeamSearch">Use beam search instead of greedy search.</param>
        public void SetData(OPERATION op, string strInputFile, string strTargetFile, string strIter, string strInput, string strBatch, string strHidden, string strWordSize, string strLr, bool bUseSoftmax, bool bUseExtIp, bool bUseBeamSearch)
        {
            m_operation = op;
            m_strInput  = strInput;

            m_bUseSoftmax    = bUseSoftmax;
            m_bUseExtIp      = bUseExtIp;
            m_bUseBeamSearch = bUseBeamSearch;

            if (!File.Exists(strInputFile))
            {
                throw new Exception("Could not find the input filename '" + strInputFile + "'!");
            }

            m_strInputFile = strInputFile;

            if (!File.Exists(strTargetFile))
            {
                throw new Exception("Could not find the target filename '" + strTargetFile + "'!");
            }

            m_strTargetFile = strTargetFile;

            if (!int.TryParse(strIter, out m_nEpochs) || m_nEpochs < 1)
            {
                throw new Exception("Invalid iterations, please enter a valid integer in the range [1,+].");
            }

            if (!int.TryParse(strBatch, out m_nBatch) || m_nBatch < 1)
            {
                throw new Exception("Invalid batch, please enter a valid integer in the range [1,+].");
            }

            if (!int.TryParse(strHidden, out m_nHidden) || m_nHidden < 1)
            {
                throw new Exception("Invalid hidden size, please enter a valid integer in the range [1,+].");
            }

            if (!int.TryParse(strWordSize, out m_nWordSize) || m_nWordSize < 1)
            {
                throw new Exception("Invalid word size, please enter a valid integer in the range [1,+].");
            }

            if (!double.TryParse(strLr, out m_dfLearningRate) || m_dfLearningRate < 0)
            {
                throw new Exception("Invalid learning rate, please enter a valid integer in the range [0,+].");
            }
        }
Beispiel #29
0
        /// <summary>
        /// The constructor.
        /// </summary>
        /// <param name="nCapacity">Specifies the total size of the array - must be a power of two.</param>
        /// <param name="oper">Specifies the operation for combining elements (e.g. sum, min)</param>
        /// <param name="fNeutralElement">Specifies the nautral element for the operation above (e.g. float.MaxValue for min and 0 for sum).</param>
        public SegmentTree(int nCapacity, OPERATION oper, float fNeutralElement)
        {
            if (nCapacity <= 0 || (nCapacity % 2) != 0)
            {
                throw new Exception("The capacity must be positive and a power of 2.");
            }

            m_nCapacity = nCapacity;
            m_op        = oper;
            m_rgfValues = new double[2 * nCapacity];

            for (int i = 0; i < m_rgfValues.Length; i++)
            {
                m_rgfValues[i] = fNeutralElement;
            }
        }
Beispiel #30
0
 public WAHBitArray Op(WAHBitArray bits, OPERATION op)
 {
     if (bits == null)
     {
         throw new InvalidOperationException("Bits is null");
     }
     if (op == OPERATION.AND)
     {
         return(_bits.And(bits));
     }
     if (op == OPERATION.OR)
     {
         return(_bits.Or(bits));
     }
     return(bits.And(_bits.Not()));
 }
		public WAHBitArray Op(WAHBitArray bits, OPERATION op)
		{
			if (bits == null)
			{
				throw new InvalidOperationException("Bits is null");
			}
			if (op == OPERATION.AND)
				return _bits.And(bits);
			if (op == OPERATION.OR)
				return _bits.Or(bits);
			return bits.And(_bits.Not());
		}
Beispiel #32
0
        private void btnCopyRect_Click(object sender, EventArgs e)
        {
            operation = OPERATION.COPY_IMG_SEL_ST;
            toolStripLabel1.Text = "マウスをドラッグして選択します。";
            drawmethod = copyrect;
            dropdown.Items.Clear();
            toolStripSplitBtnDevice.ToolTipText = drawmethod.GetDrawDeviceName();
            DrawMethod.UpdateDevice();
            toolStripSplitBtnDevice.Invalidate();

            ToolStripButton btn = (ToolStripButton)sender;
            if (btnSelected != null) btnSelected.Checked = false;
            btnSelected = btn;
            btnSelected.Checked = true;
        }
Beispiel #33
0
        private void btnRectDraw_Click(object sender, EventArgs e)
        {
            operation = OPERATION.DRAWING;
            toolStripLabel1.Text = "マウスをドラッグして描画します。";
            drawmethod = rectdraw;
            dropdown.Items.Clear();
            dropdown.Items.Add(btnSolidBrush);
            dropdown.Items.Add(btnHatchBrush);
            dropdown.Items.Add(btnTextureBrush);
            dropdown.Items.Add(btnLinearGradientBrush);
            toolStripSplitBtnDevice.ToolTipText = drawmethod.GetDrawDeviceName();
            DrawMethod.UpdateDevice();
            toolStripSplitBtnDevice.Invalidate();

            ToolStripButton btn = (ToolStripButton)sender;
            if (btnSelected != null) btnSelected.Checked = false;
            btnSelected = btn;
            btnSelected.Checked = true;
        }
Beispiel #34
0
        private void btnStringDraw_Click(object sender, EventArgs e)
        {
            operation = OPERATION.SET_TEXT_POS;
            toolStripLabel1.Text = "文字を書く位置をクリックしてください。";
            drawmethod = stringdraw;
            dropdown.Items.Clear();
            dropdown.Items.Add(btnSolidBrush);
            dropdown.Items.Add(btnHatchBrush);
            dropdown.Items.Add(btnTextureBrush);
            dropdown.Items.Add(btnLinearGradientBrush);
            toolStripSplitBtnDevice.ToolTipText = drawmethod.GetDrawDeviceName();
            DrawMethod.UpdateDevice();
            toolStripSplitBtnDevice.Invalidate();

            ToolStripButton btn = (ToolStripButton)sender;
            if (btnSelected != null) btnSelected.Checked = false;
            btnSelected = btn;
            btnSelected.Checked = true;
        }
Beispiel #35
0
 private void Canvas_OnMouseDown(object sender, MouseEventArgs e)
 {
     if (drawmethod != null)
     {
         if (operation == OPERATION.PASTE_IMG_SELECTED)
         {
             DragPastedImage dragimage = (DragPastedImage)drawmethod;
             // もしイメージの上だったら
             if (dragimage.isMouseOnTheImage(new Point(e.X, e.Y)))
             {
                 toolStripLabel1.Text = "イメージをドラッグして移動します。";
                 operation = OPERATION.PASTE_IMG_DRAG;
                 dragimage.OnMouseDown(sender, e, bmp);
             }
             else
             // そうでなければ、ドラッグの選択をやめる
             {
                 // イメージを本体に描画する
                 dragimage.UpdateImage(sender, bmp);
                 // 選択をやめる
                 operation = OPERATION.NONE;
                 drawmethod = null;
                 return;
             }
         }
         else
         {
             drawmethod.OnMouseDown(sender, e, bmp);
         }
     }
 }
Beispiel #36
0
 private void Canvas_OnMouseMove(object sender, MouseEventArgs e)
 {
     if (drawmethod != null)
     {
         if (operation == OPERATION.COPY_IMG_SEL_ST)
         {
             operation = OPERATION.PASTE_IMG_DRAG;
             drawmethod.OnMouseMove(sender, e, bmp);
         }
         else if (operation == OPERATION.PASTE_IMG_SELECTED)
         {
             // Do Nothing
         }
         else
         {
             drawmethod.OnMouseMove(sender, e, bmp);
         }
     }
 }
Beispiel #37
0
 private void Canvas_OnMouseUp(object sender, MouseEventArgs e)
 {
     if (drawmethod != null)
     {
         if (operation == OPERATION.DRAWING)
         {
             if(drawmethod.GetDrawDeviceType() == DrawMethod.DEVICE_TYPE.BRUSH)
             {
                 if(DrawMethod.BrushType == DrawMethod.BRUSH_TYPE.LINEAR_GRADIENT)
                 {
                     Color cs = Color.Empty;
                     Color ce = Color.Empty;
                     toolStripLabel1.Text = "グラデーションの開始色を選択してください。";
                     if(colorDialog1.ShowDialog() != DialogResult.OK) return;
                     cs = colorDialog1.Color;
                     toolStripLabel1.Text = "グラデーションの終了色を選択してください。";
                     if(colorDialog1.ShowDialog() != DialogResult.OK) return;
                     ce = colorDialog1.Color;
                     DrawMethod.SetGradientColors(cs, ce);
                     DrawMethod.UpdateDevice();
                     toolStripLabel1.Text = "グラデーションの開始点を選択してください。";
                     operation = OPERATION.SEL_GRAD_PT_ST;
                 }
             }
             drawmethod.OnMouseUp(sender, e, bmp);
         }
         else if(operation == OPERATION.SEL_GRAD_PT_ST)
         {
             this.ptGradStart = new Point(e.X, e.Y);
             toolStripLabel1.Text = "グラデーションの終了点を選択してください。";
             operation = OPERATION.SEL_GRAD_PT_EN;
         }
         else if(operation == OPERATION.SEL_GRAD_PT_EN)
         {
             this.ptGradEnd = new Point(e.X, e.Y);
             DrawMethod.SetGradientLine(this.ptGradStart, this.ptGradEnd);
             DrawMethod.UpdateDevice();
             drawmethod.UpdateImage(sender, bmp);
             toolStripLabel1.Text = "マウスをドラッグして描画します。";
             operation = OPERATION.DRAWING;
         }
         else if(operation == OPERATION.PASTE_IMG_SELECTED)
         {
             // ドラッグしない
             drawmethod.OnMouseUp(sender, e, bmp);
             operation = OPERATION.NONE;
             toolStripLabel1.Text = "描画するツールを選択してください。";
             drawmethod = null;
         }
         else if(operation == OPERATION.PASTE_IMG_DRAG)
         {
             // ドラッグ完了
             drawmethod.OnMouseUp(sender, e, bmp);
             operation = OPERATION.NONE;
             toolStripLabel1.Text = "描画するツールを選択してください。";
             drawmethod = null;
         }
         else if(operation == OPERATION.COPY_IMG_DRAG)
         {
             // 選択完了
             drawmethod.OnMouseUp(sender, e, bmp);
             operation = OPERATION.COPY_IMG_SELECTED;
             toolStripLabel1.Text = "メニューからコピーを選択してください。";
         }
     }
 }
Beispiel #38
0
 private static WAHBitArray DoBitOperation(WAHBitArray bits, WAHBitArray c, OPERATION op, int maxsize)
 {
     if (bits != null)
     {
         switch (op)
         {
             case OPERATION.AND:
                 bits = bits.And(c);
                 break;
             case OPERATION.OR:
                 bits = bits.Or(c);
                 break;
             case OPERATION.ANDNOT:
                 bits = bits.And(c.Not(maxsize));
                 break;
         }
     }
     else
         bits = c;
     return bits;
 }