Esempio n. 1
0
        /// <summary>
        /// フィルタ設定
        /// </summary>
        private void InitConditionTab()
        {
            //ビューの選択式
            this.txtSelectionFormula.Text = this._targetView.SelectionFormula;
            //フィールドリストを初期化する
            this.cmbFields.Items.Clear();
            this.cmbFields.DisplayMember = "Title";
            this.cmbFields.ValueMember   = "Name";
            foreach (IFieldRef fld in this.AllFields)
            {
                if (fld.TargetType != Engines.Enums.SPFieldType.Invalid)
                {
                    this.cmbFields.Items.Add(fld);
                }
            }
            //条件式
            LogicItem logitem = this._targetView.ViewCondition;

            if (logitem.Nodes.Count == 0)
            {
                this.rdbAllSelect.Checked = true;
            }
            else
            {
                this.rdbHasCondition.Checked = true;
            }
            //Logicパネル
            this.rdbAnd.Checked = (logitem.Type == LogicType.And);
            this.rdbOr.Checked  = (logitem.Type == LogicType.Or);
            //比較子リストを初期化
            InitOperatorList();
            //ツリー初期化
            InitConditionTree();
        }
Esempio n. 2
0
 internal View(Domino.NotesView view, IDatabase parentDb)
 {
     this._parentDb = parentDb;
     this._view     = view;
     if (this._view.IsCalendar)
     {
         this._sourceType = NotesViewType.Calendar;
     }
     else
     {
         this._sourceType = NotesViewType.Standard;
     }
     this._targetType       = Enums.MappingInfo.GetTargetViewType(this.SourceType);
     this._name             = this._view.Name;
     this.DisplayName       = this._view.Name;
     this._isDefualt        = view.IsDefaultView;
     this.IsDefaultView     = view.IsDefaultView;
     this._selectionFormula = view.SelectionFormula;
     this._notesUrl         = view.NotesURL;
     this._viewCondition    = new LogicItem(LogicType.And);
     this._taskId           = string.Empty;
     this.IsTarget          = false;
     this.RowLimit          = 30;
     this.ShowChecked       = false;
     this.IsPaged           = false;
 }
Esempio n. 3
0
        static public bool JoinLogicItem(List <LogicItem> iList)
        {
            if (iList == null || iList.Count < 1)
            {
                return(true);
            }

            bool value = iList[0].Value;

            if (iList.Count == 1)
            {
                return(value);
            }
            for (int i = 1; i < iList.Count; i++)
            {
                LogicItem item = iList[i];
                if (item.Type == QueryCriteriaType.And)
                {
                    value = item.Value && value;
                }
                else if (item.Type == QueryCriteriaType.Or)
                {
                    value = item.Value || value;
                }
            }
            return(value);
        }
 private void SetLogic(LogicItem value)
 {
     ((LogicReference) this.Logic).Logic = value;
     this.Grid.SetValue (Constants.Logic, value.ToString ());
     MainWindow.SavedLogicWindow.UpdatedLogic (this.Logic);
     MainWindow.ZonesWindow.UpdatedLogic (this.Logic);
 }
Esempio n. 5
0
 /// <summary>
 /// ロジックタイプ変更
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void btnSetLogicType_Click(object sender, EventArgs e)
 {
     try
     {
         if (this.treeCondition.Nodes.Count == 0)
         {
             return;
         }
         TreeNode  root    = this.treeCondition.Nodes[0];
         LogicItem logitem = (LogicItem)root.Tag;
         if (this.rdbAnd.Checked)
         {
             logitem.Type = LogicType.And;
         }
         else
         {
             logitem.Type = LogicType.Or;
         }
         root.Text = logitem.TagName;
     }
     catch (Exception ex)
     {
         Log.Write(ex);
         RSM.ShowMessage(this, ex);
     }
 }
        private void GenerateTable(int variables, bool reverse, IEnumerable <LogicItem> values = null)
        {
            _items.Clear();
            if (reverse)
            {
                char[] arr = ABC.Substring(0, variables).ToCharArray();
                Array.Reverse(arr);
                Variables.Header = new string(arr);
            }
            else
            {
                Variables.Header = ABC.Substring(0, variables);
            }
            int limit = 1 << variables;

            if (values != null)
            {
                foreach (var item in values)
                {
                    _items.Add(item);
                }
            }
            else
            {
                for (int i = 0; i < limit; i++)
                {
                    _items.Add(new LogicItem()
                    {
                        Index = i, BinaryValue = LogicItem.GetBinaryValue(i, variables), Checked = false
                    });
                }
            }
        }
 private void InputByNumbers()
 {
     _variables = (int)MintermNumbers.Value;
     try
     {
         if (string.IsNullOrEmpty(MintermInput.Text))
         {
             throw new Exception("No minterm numbers entered");
         }
         string[] items    = MintermInput.Text.Split(',');
         string[] dontcare = null;
         if (!string.IsNullOrEmpty(DontcarInput.Text))
         {
             dontcare = DontcarInput.Text.Split(',');
             if (dontcare.Length < 1)
             {
                 items = DontcarInput.Text.Split(' ');
             }
         }
         if (items.Length < 1)
         {
             items = MintermInput.Text.Split(' ');
         }
         if (items.Length < 1)
         {
             throw new Exception("Incorrect input");
         }
         List <LogicItem> litems = new List <LogicItem>();
         foreach (var item in items)
         {
             litems.Add(new LogicItem()
             {
                 Index       = Convert.ToInt32(item),
                 BinaryValue = LogicItem.GetBinaryValue(Convert.ToInt32(item), _variables),
                 Checked     = true
             });
         }
         if (dontcare != null)
         {
             foreach (var item in dontcare)
             {
                 litems.Add(new LogicItem()
                 {
                     Index       = Convert.ToInt32(item),
                     BinaryValue = LogicItem.GetBinaryValue(Convert.ToInt32(item), _variables),
                     Checked     = null
                 });
             }
         }
         SimpleMinterm.Text = QuineMcclusky.GetSimplified(litems, _variables, (bool)HazardSafe.IsChecked, (bool)LsbBit.IsChecked, false);
         SimpleMaxterm.Text = QuineMcclusky.GetSimplified(litems, _variables, (bool)HazardSafe.IsChecked, (bool)LsbBit.IsChecked, true);
     }
     catch (Exception ex)
     {
         WpfHelpers.ExceptionDialog(ex);
     }
 }
        private async void BtnMinimize_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                var items     = new List <LogicItem>();
                int variables = 2;
                switch (TabInputMode.SelectedIndex)
                {
                case 0:
                    items.AddRange(Minterm2x.GetSelected());
                    variables = 2;
                    break;

                case 1:
                    items.AddRange(Minterm3x.GetSelected());
                    variables = 3;
                    break;

                case 2:
                    items.AddRange(Minterm4x.GetSelected());
                    variables = 4;
                    break;

                case 3:
                    items.AddRange(Minterm5x.GetSelected());
                    variables = 5;
                    break;

                case 4:
                    variables = (int)EsListVarCount.Value;
                    foreach (var line in TbListSet.Text.Split('\n'))
                    {
                        if (string.IsNullOrEmpty(line))
                        {
                            continue;
                        }
                        items.Add(LogicItem.CreateFromMintermIndex(Convert.ToInt32(line.Replace("\r", "")), variables, true));
                    }
                    foreach (var line in TbListDontCare.Text.Split('\n'))
                    {
                        if (string.IsNullOrEmpty(line))
                        {
                            continue;
                        }
                        items.Add(LogicItem.CreateFromMintermIndex(Convert.ToInt32(line.Replace("\r", "")), variables, null));
                    }
                    break;
                }
                string result = QuineMcclusky.GetSimplified(items, variables, (bool)CbHazardFree.IsChecked, (bool)RadioLSB.IsChecked);
                TbResults.Text = result;
            }
            catch (Exception ex)
            {
                await _app.ShowMessageBox("Error", ex.Message, DialogButtons.Ok);
            }
        }
Esempio n. 9
0
        public LogicItem[] GetSelected()
        {
            var ret = new List <LogicItem>();

            foreach (var item in MintermTableHelpers.GetMintermTableValues(Minterm2x))
            {
                ret.Add(LogicItem.CreateFromMintermIndex(item.Key, 2, item.Value));
            }
            return(ret.ToArray());
        }
Esempio n. 10
0
        internal List <LogicItem> SelectAllLogicItemsByLogicId(string id)
        {
            SQLiteConnection conn = ConnectionToDB();

            SQLiteDataReader reader     = SelectExecuteSQL(string.Format("select {0} from {1} where logicId = '{2}' order by  CAST(sequence AS INTEGER)  asc", LogicItem.Column, LogicItem.TableName, id), conn);
            List <LogicItem> logicItems = LogicItem.MakeResultSet(reader);

            DisconnectionToDB(conn);

            return(logicItems);
        }
Esempio n. 11
0
        internal List <LogicItem> SelectAllLogicItemsBySlotId(string slotId)
        {
            SQLiteConnection conn = ConnectionToDB();

            SQLiteDataReader reader     = SelectExecuteSQL(string.Format("select {0} from {1} l, {2} s where  l.logicid = s.logicid and s.oid = '{3}' order by  CAST(sequence AS INTEGER)  asc", LogicItem.GetPrepixColumn("l"), LogicItem.TableName, Slot.TableName, slotId), conn);
            List <LogicItem> logicItems = LogicItem.MakeResultSet(reader);

            DisconnectionToDB(conn);

            return(logicItems);
        }
Esempio n. 12
0
        public void SetAll(bool?value)
        {
            var items = new List <LogicItem>();

            for (int i = 0; i < 3; i++)
            {
                LogicItem lo = LogicItem.CreateFromMintermIndex(i, 2, value);
                items.Add(lo);
            }
            SetSelected(items.ToArray());
        }
 private LogicItem[] GenerateMinterms()
 {
     LogicItem[] ret = new LogicItem[1 << _variables];
     for (int i = 0; i < ret.Length; i++)
     {
         ret[i]             = new LogicItem();
         ret[i].Checked     = null;
         ret[i].Index       = i;
         ret[i].BinaryValue = LogicItem.GetBinaryValue(i, _variables);
     }
     return(ret);
 }
        private void Generate()
        {
            _counter.Clear();
            _items.Clear();
            int limit = 1 << _variables;

            for (int i = 0; i < limit; i++)
            {
                _items.Add(LogicItem.GetBinaryValue(i, _variables));
            }
            StageCurrent.ItemsSource = _items;
            StageNext.ItemsSource    = _items;
        }
Esempio n. 15
0
 private void InitConditionTree(TreeNode parentNode, LogicItem rootItem)
 {
     foreach (IConditionItem item in this._targetView.ViewCondition.Nodes)
     {
         if (item is ConditionItem)
         {
             ConditionItem condiItem = (ConditionItem)item;
             TreeNode      condiNode = parentNode.Nodes.Add(item.ToString());
             condiNode.Tag = item;
         }
         else
         {
             //未使用
             LogicItem logicItem = (LogicItem)item;
             TreeNode  logicNode = parentNode.Nodes.Add(logicItem.TagName);
             logicNode.Tag = logicItem;
             InitConditionTree(logicNode, logicItem);
         }
     }
 }
Esempio n. 16
0
        private void ExecuteSave(string logicId)
        {
            // 로직입력값 저장
            Dictionary <string, string> dictionary = new Dictionary <string, string>();

            dictionary.Add(LogicInput.CONST_KEYWORD, CommonUtils.MakeDelimeterItem(textBox2.Text, comboBox4.Text));
            dictionary.Add(LogicInput.CONST_STAY, CommonUtils.MakeDelimeterItem(textBox3.Text, textBox4.Text));
            dictionary.Add(LogicInput.CONST_SCROLL, CommonUtils.MakeDelimeterItem(textBox8.Text, textBox7.Text, textBox10.Text, textBox9.Text, textBox12.Text, textBox11.Text));
            dictionary.Add(LogicInput.CONST_POST_VIEW, textBox5.Text);
            dictionary.Add(LogicInput.CONST_CATEGORY_MOVE, comboBox5.Text);
            dictionary.Add(LogicInput.CONST_AGNET, comboBox2.Text);
            dictionary.Add(LogicInput.CONST_BROWSER, comboBox3.Text);
            dictionary.Add(LogicInput.CONST_DUPLICATE_ADDRESS, textBox1.Text);
            dictionary.Add(LogicInput.CONST_SLOT_WAIT_TIME, CommonUtils.MakeDelimeterItem(textBox6.Text, textBox13.Text));

            List <LogicInput> logicInputs = LogicInput.ConvertMapToObject(dictionary, logicId);

            sqlite.DeleteLogicInputByLogicId(logicId);
            sqlite.InsertAllLogicInpts(logicInputs);


            // 로직 아이템 저장
            DataGridViewRowCollection rows       = dataGridView1.Rows;
            List <LogicItem>          LogicItems = new List <LogicItem>();

            for (int i = 0; i < rows.Count; i++)
            {
                DataGridViewRow row  = rows[i];
                LogicItem       item = new LogicItem();
                item.logicId  = logicId;
                item.sequence = row.Cells[LogicItem.HEADER_SEQUENCE].Value.ToString();
                item.action   = (string)row.Cells[LogicItem.HEADER_ACTION].Value;
                item.value    = (string)row.Cells[LogicItem.HEADER_VALUE].Value;
                LogicItems.Add(item);
            }

            sqlite.DeleteLogicItemByLogicId(logicId);
            sqlite.InsertAllLogicItems(LogicItems);

            Close();
        }
Esempio n. 17
0
        /// <summary>
        /// 検索条件ツリーを選択する処理
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void treeCondition_AfterSelect(object sender, TreeViewEventArgs e)
        {
            if (this.treeCondition.SelectedNode == null ||
                this.treeCondition.SelectedNode.Tag == null)
            {
                return;
            }
            object selectedItem = this.treeCondition.SelectedNode.Tag;

            if (selectedItem is LogicItem)
            {
                LogicItem logItem = (LogicItem)selectedItem;
                this.rdbAnd.Checked = (logItem.Type == LogicType.And);
                this.rdbOr.Checked  = (logItem.Type == LogicType.Or);
            }
            else if (selectedItem is ConditionItem)
            {
                ConditionItem condiItem = (ConditionItem)selectedItem;
                this.cmbFields.SelectedValue   = condiItem.ItemName;
                this.cmbOperator.SelectedValue = condiItem.Operator;
                this.txtValue.Text             = condiItem.Value.ToString();
            }
        }
Esempio n. 18
0
        internal void InsertAllLogicItems(List <LogicItem> logicItems)
        {
            SQLiteConnection conn = ConnectionToDB();

            using (var command = new SQLiteCommand(conn))
            {
                using (var transaction = conn.BeginTransaction())
                {
                    // 100,000 inserts
                    for (var i = 0; i < logicItems.Count; i++)
                    {
                        LogicItem logicItem = logicItems.ElementAt(i);
                        command.CommandText =
                            string.Format("insert into " + LogicItem.TableName + " (" + LogicItem.Column + ") values (" + LogicItem.Values + ")", CommonUtils.MakeArray(logicItem));
                        command.ExecuteNonQuery();
                    }

                    transaction.Commit();
                }
            }

            DisconnectionToDB(conn);
        }
Esempio n. 19
0
 // 로우 추가
 private void AddDataGridRow(LogicItem item)
 {
     dataGridView1.Rows.Add(CommonUtils.MakeArray(item));
 }
Esempio n. 20
0
        // 액션 추가
        private void AddAction(object sender, EventArgs e)
        {
            PictureBox o      = (PictureBox)sender;
            LogicItem  item   = new LogicItem();
            string     action = null;
            string     value  = null;

            switch (o.Name)
            {
            case "ActionKeyword":
            {
                action = "키워드";
                value  = textBox2.Text + "/" + comboBox4.Text;
                if (!IsVaildate(action, value))
                {
                    MessageBox.Show("값이 비어 있는 액션은 추가 할 수 없습니다.");
                    return;
                }
                ;
            }
            break;

            case "ActionStay":
            {
                action = "체류";
                value  = textBox3.Text + "/" + textBox4.Text;
            }
            break;

            case "ActionScroll":
            {
                action = "스크롤";
                value  = textBox8.Text + "/" + textBox7.Text + "/" + textBox10.Text + "/" + textBox9.Text + "/" + textBox12.Text + "/" + textBox11.Text;
            }
            break;

            case "ActionView":
            {
                action = "게시글조회";
                value  = textBox5.Text;
            }
            break;

            case "ActionHistoryPrev":
            {
                action = "히스토리";
                value  = "Prev";
            }
            break;

            case "ActionHistoryNext":
            {
                action = "히스토리";
                value  = "Next";
            }
            break;

            case "ActionMoveCategory":
            {
                action = "카테고리";
                value  = comboBox5.Text;
            }
            break;

            case "ActionMoveHome":
            {
                action = "홈";
                value  = "Move";
            }
            break;
            }

            item.action = action;
            item.value  = value;

            AddDataGridRow(item);
            AutoSequence();
        }
 private void Grid_DataContextChanged(object sender, DependencyPropertyChangedEventArgs e)
 {
     //this.stckLogic.Children.Clear();
     LogicItem logic = e.NewValue as LogicItem;
 }