Beispiel #1
0
        public async System.Threading.Tasks.Task ReStoreViewSettingDetailControlAsync()
        {
            using (var dt = UnitTestStatic.GetDataTable())
            {
                using (var dc = new DetailControl())
                {
                    dc.HTMLStyle = UnitTestInitializeWin.HTMLStyle;
                    dc.DataTable = dt;
                    await dc.RefreshDisplayAsync(FilterType.All, UnitTestInitializeCsv.Token);

                    var columnFilters = new List <ToolStripDataGridViewColumnFilter>
                    {
                        new ToolStripDataGridViewColumnFilter(dc.FilteredDataGridView.Columns[0])
                    };

                    columnFilters[0].ColumnFilterLogic.Operator  = "=";
                    columnFilters[0].ColumnFilterLogic.ValueText = "Halloween";
                    columnFilters[0].ColumnFilterLogic.Active    = true;

                    var text = ViewSetting.StoreViewSetting(dc.FilteredDataGridView, columnFilters);

                    var fn = System.IO.Path.Combine(FileSystemUtils.ExecutableDirectoryName(), "test.delete");
                    FileSystemUtils.FileDelete(fn);
                    FileSystemUtils.WriteAllText(fn, text);
                    dc.ReStoreViewSetting(fn);
                    FileSystemUtils.FileDelete(fn);
                }
            }
        }
Beispiel #2
0
        /// <summary>
        /// Saves the currently selected display mode to the database.
        /// </summary>
        private void SaveCurrentSetting()
        {
            int currentModuleCodeId = GetModuleCodeId(Module);

            ViewSetting setting = (from vs in DataContext.ViewSettings
                                   where vs.UserId == UserID && vs.ViewSettingModuleCodeId == currentModuleCodeId
                                   select vs).FirstOrDefault();

            //If there is no existing setting, create a new one
            if (setting == null)
            {
                setting        = new ViewSetting();
                setting.UserId = UserID;
                setting.ViewSettingModuleCodeId = currentModuleCodeId;
                setting.CreatedByUserId         = UserID;
                setting.CreatedDate             = Now;

                DataContext.ViewSettings.AddObject(setting);
            }

            setting.ViewSettingValueCodeId = GetViewModeCodeId(DisplayMode);
            setting.LastUpdatedByUserId    = UserID;
            setting.LastUpdatedDate        = Now;

            DataContext.SaveChanges();
        }
Beispiel #3
0
        /// <summary>
        /// 保存类库中的视图
        /// </summary>
        /// <param name="type"></param>
        private void SaveViewSetting(Type type)
        {
            PlatformSource?platform = ViewUtils.GetPlatform(type);

            if (platform == null)
            {
                return;
            }
            ViewSetting setting = new ViewSetting()
            {
                Name     = type.Name,
                Platform = platform.Value,
                Code     = type.FullName,
                Status   = ViewSetting.ViewStatus.Normal
            };

            using (DbExecutor db = NewExecutor(IsolationLevel.ReadUncommitted))
            {
                if (setting.Exists(db, t => t.Code))
                {
                    setting = setting.Info(db, t => t.Code);
                }
                else
                {
                    setting.AddIdentity(db);
                }
                db.AddCallback(() =>
                {
                    ViewCaching.Instance().SaveViewID(setting.Code, setting.ID);
                });
                db.Commit();
            }
        }
Beispiel #4
0
        /// <summary>
        /// Loads the control.
        /// </summary>
        public void LoadControl()
        {
            int currentModuleCodeId = GetModuleCodeId(Module);

            ViewSetting setting = (from vs in DataContext.ViewSettings
                                   where vs.UserId == UserID && vs.ViewSettingModuleCodeId == currentModuleCodeId
                                   select vs).FirstOrDefault();

            if (setting == null)
            {
                UpdateUIForMode(default(ViewSettingValue));
            }
            else
            {
                Code settingMode = Support.GetCodeByCodeId(setting.ViewSettingValueCodeId);

                if (settingMode.Value == "THUMBNAILVIEW")
                {
                    UpdateUIForMode(ViewSettingValue.ThumbnailView);
                }
                else if (settingMode.Value == "LISTVIEW")
                {
                    UpdateUIForMode(ViewSettingValue.ListView);
                }
            }

            if (DisplayModeChanged != null)
            {
                DisplayModeChanged(this, EventArgs.Empty);
            }
        }
Beispiel #5
0
        public void StoreViewSettingTest2()
        {
            using (var dgv = new DataGridView())
            {
                var dgvc = new DataGridViewColumn(new DataGridViewTextBoxCell())
                {
                    DataPropertyName = "test",
                    ValueType        = typeof(string)
                };
                dgv.Columns.Add(dgvc);
                var dgvc2 = new DataGridViewColumn(new DataGridViewTextBoxCell())
                {
                    DataPropertyName = "test2",
                    ValueType        = typeof(string)
                };
                dgv.Columns.Add(dgvc2);
                var columnFilters = new List <ToolStripDataGridViewColumnFilter>
                {
                    new ToolStripDataGridViewColumnFilter(dgvc), new ToolStripDataGridViewColumnFilter(dgvc2)
                };

                columnFilters[0].ColumnFilterLogic.ValueClusterCollection.ValueClusters
                .Add(new ValueCluster("display", "cond", string.Empty, 0));
                columnFilters[0].ColumnFilterLogic.Active = true;

                columnFilters[1].ColumnFilterLogic.Operator  = "=";
                columnFilters[1].ColumnFilterLogic.ValueText = "Halloween";
                columnFilters[1].ColumnFilterLogic.Active    = true;

                var text = ViewSetting.StoreViewSetting(dgv, columnFilters);
                ViewSetting.ReStoreViewSetting(text, dgv.Columns, new List <ToolStripDataGridViewColumnFilter>(),
                                               i => columnFilters[i], null);
            }
        }
Beispiel #6
0
        public Task GetViewSetting([FromForm] int viewId)
        {
            //#1 获取视图对象
            ViewSetting setting = ViewAgent.Instance().GetViewSetting(viewId);
            IViewBase   view    = ViewUtils.CreateInstance(setting.Code, string.Empty);

            return(this.GetResult(view.ToJsonString()));
        }
Beispiel #7
0
        public Task GetSiteConfig([FromForm] int id)
        {
            ViewSiteConfig config  = ViewAgent.Instance().GetSiteViewConfig(id);
            ViewSetting    setting = ViewAgent.Instance().GetViewSetting(config.ViewID);
            IViewBase      view    = ViewUtils.CreateInstance(setting.Code, config.Setting);

            return(this.GetResult(view.ToSettingObject()));
        }
Beispiel #8
0
    public void saveSettings()
    {
        if (settings == null)
        {
            Console.WriteLine("NO SETTINGS??");
            return;
        }

        /***************************
         * SAVE DEVICE
         */
        settings.deviceSettings.Clear();
        foreach (IDevice device in devices)
        {
            DeviceSetting devsettings = new DeviceSetting();

            //device
            devsettings.DeviceName = device.getDeviceName();
            if (device.driver == null)
            {
                device.driver = new EmptyDriver();
            }
            devsettings.DriverName = device.driver.getDriverName();

            //driver
            devsettings.DeviceLogin    = device.driver.Login;
            devsettings.DevicePassword = device.driver.Password;
            devsettings.DeviceURI      = device.driver.URI;

            settings.deviceSettings.Add(devsettings);
        }

        /***************************
         * SAVE VIEW
         */
        settings.viewSettings.Clear();
        foreach (CameraView view in views)
        {
            ViewSetting viewsettings = new ViewSetting();

            //device
            if (view.getCurrentDevice() != null)
            {
                viewsettings.DeviceName = view.getCurrentDevice().getDeviceName();
            }
            else
            {
                viewsettings.DeviceName = "";
            }
            settings.viewSettings.Add(viewsettings);
        }



        settings.SaveToFile(settingsPath + "/settings.xml");
    }
Beispiel #9
0
    public static void Init()
    {
        ViewSetting view = null;

        view = new ViewSetting("Assets/Src/Prefab/LoginPanel.prefab", (mainGo) => { return(mainGo.AddComponent <LoginView>()); }, false, ViewLayer.Logic, ViewType.Full);
        ViewDict[ViewNames.Login] = view;

        view = new ViewSetting("Assets/Src/Prefab/MainPanel.prefab", (mainGo) => { return(mainGo.AddComponent <MainView>()); }, false, ViewLayer.Logic, ViewType.Window);
        ViewDict[ViewNames.Main] = view;
    }
Beispiel #10
0
        protected override void Initialize(RequestContext requestContext)
        {
            base.Initialize(requestContext);

            stopWatch.Start();
            AssemblyVersion = Assembly.LoadFrom(HostingEnvironment.MapPath("~/bin/DataManager.dll")).GetName().Version.ToString();
            if (Request.IsAuthenticated)
            {
                AspNetUser = UserManager.FindById(User.Identity.GetUserId());
                Uri uri = Request.Url;

                if (!Request.IsAjaxRequest() &&
                    !uri.PathAndQuery.StartsWith("/Account") &&
                    !uri.PathAndQuery.StartsWith("/Error") &&
                    !uri.PathAndQuery.StartsWith("/Home") &&
                    !uri.PathAndQuery.StartsWith("/Search") &&
                    !uri.PathAndQuery.StartsWith("/Suggest") &&
                    !uri.PathAndQuery.Contains("export=") &&
                    !uri.PathAndQuery.Contains("save=false") &&
                    !uri.PathAndQuery.Contains("Masquerade") && uri.PathAndQuery != "/")
                {
                    string path = uri.AbsolutePath;
                    ViewSetting = AspNetUser.ViewSettings.FirstOrDefault(x => x.Path.ToLower() == path.ToLower());

                    // Redirect if this is a queryless path and we have a prior setting
                    if (string.IsNullOrEmpty(uri.Query) && ViewSetting != null && !string.IsNullOrEmpty(ViewSetting.PathAndQuery) && ViewSetting.Path.ToLower() != ViewSetting.PathAndQuery.ToLower())
                    {
                        // Only redirect if we have a matching setting
                        requestContext.HttpContext.Response.Clear();
                        requestContext.HttpContext.Response.Redirect(ViewSetting.PathAndQuery);
                        requestContext.HttpContext.Response.End();
                    }
                    else
                    {
                        // Store the current page setting
                        if (ViewSetting == null)
                        {
                            ViewSetting = new ViewSetting
                            {
                                AspNetUserId = AspNetUser.Id,
                                Path         = path,
                                PathAndQuery = uri.PathAndQuery,
                            };
                            DataContext.ViewSettings.Add(ViewSetting);
                        }
                        else
                        {
                            ViewSetting.PathAndQuery             = uri.PathAndQuery;
                            DataContext.Entry(ViewSetting).State = EntityState.Modified;
                        }
                        DataContext.SaveChanges();
                    }
                }
            }
        }
Beispiel #11
0
        private void ReadViewSettings()
        {
            XmlSerializer mySerializer = new XmlSerializer(typeof(List <ViewSetting>));
            FileStream    myFileStream = new FileStream("viewsettings.xml", FileMode.Open);

            viewSettings = (List <ViewSetting>)mySerializer.Deserialize(myFileStream);

            currentViewSetting   = viewSettings[viewSettings.Count - 1];
            trackBarZoom.Maximum = viewSettings.Count - 1;
            myFileStream.Close();
        }
Beispiel #12
0
    public void Init()
    {
        ViewSetting.Init();

        Transform uiRootTrans = GameObject.Find("UIRoot").transform;

        mUIRootDict[ViewLayer.Logic] = uiRootTrans.Find("Logic");
        mUIRootDict[ViewLayer.Guide] = uiRootTrans.Find("Guide");
        mUIRootDict[ViewLayer.Top]   = uiRootTrans.Find("Top");

        mHintRootItem = uiRootTrans.Find("HintRootItem").gameObject;
    }
Beispiel #13
0
        /// <summary>
        /// 加载xml
        /// </summary>
        /// <param name="p_reader"></param>
        public void ReadXml(XmlReader p_reader)
        {
            if (p_reader == null || p_reader.IsEmptyElement || p_reader.Name != "Rpt")
            {
                throw new Exception("加载报表模板根节点时出错!");
            }

            // 报表列宽
            Cols = RptPart.SplitSize(p_reader.GetAttribute("cols"));

            // 模板内容
            p_reader.Read();
            while (p_reader.NodeType != XmlNodeType.None)
            {
                if (p_reader.NodeType == XmlNodeType.EndElement && p_reader.Name == "Rpt")
                {
                    break;
                }

                switch (p_reader.Name)
                {
                case "Params":
                    Params.ReadXml(p_reader);
                    break;

                case "Data":
                    Data.ReadXml(p_reader);
                    break;

                case "Page":
                    PageSetting.ReadXml(p_reader);
                    break;

                case "Header":
                    Header.ReadXml(p_reader);
                    break;

                case "Body":
                    Body.ReadXml(p_reader);
                    break;

                case "Footer":
                    Footer.ReadXml(p_reader);
                    break;

                case "View":
                    ViewSetting.ReadXml(p_reader);
                    break;
                }
            }
        }
Beispiel #14
0
        private void SaveViewSetting()
        {
            var setting = new ViewSetting
            {
                EnableDebug       = Debug.Checked,
                InformationWindow = InfomationWindow.Checked,
                ProxyWindow       = ProxyWindow.Checked,
                StatusBar         = StatusBar.Checked,
                ToolBar           = ToolBar.Checked,
                MenuBar           = MenuBar.Checked
            };

            XmlHelper.XmlSerialize(Config.ViewSettingFileName, setting, typeof(ViewSetting));
        }
Beispiel #15
0
        /// <summary>
        /// 序列化xml
        /// </summary>
        /// <param name="p_writer"></param>
        public void WriteXml(XmlWriter p_writer)
        {
            p_writer.WriteStartElement("Rpt");
            p_writer.WriteAttributeString("cols", RptPart.MergeSize(Cols));

            Params.WriteXml(p_writer);
            Data.WriteXml(p_writer);
            PageSetting.WriteXml(p_writer);
            Header.WriteXml(p_writer);
            Body.WriteXml(p_writer);
            Footer.WriteXml(p_writer);
            ViewSetting.WriteXml(p_writer);

            p_writer.WriteEndElement();
        }
Beispiel #16
0
        protected void createTabXML()
        {
            Views     allViews  = new Views();
            DataTable viewtable = ViewDataTable;

            foreach (DataRow drViewRow in viewtable.Rows)
            {
                string      ViewID       = drViewRow[Constants.ViewField.ViewID].ToString();
                string      View         = drViewRow[Constants.ViewField.View].ToString();
                string      UserGroup    = drViewRow[Constants.ViewField.UserGroup].ToString();
                string      Permission   = drViewRow[Constants.ViewField.Permission].ToString();
                bool        IsActionMenu = Convert.ToBoolean(drViewRow[Constants.ViewField.IsActionMenu].ToString());
                bool        IsDataSheet  = Convert.ToBoolean(drViewRow[Constants.ViewField.IsDataSheet].ToString());
                bool        IsRssFeed    = Convert.ToBoolean(drViewRow[Constants.ViewField.IsRssFeed].ToString());
                bool        IsAlertMe    = Convert.ToBoolean(drViewRow[Constants.ViewField.IsAlertMe].ToString());
                int         ViewRowID    = Convert.ToInt32(drViewRow[Constants.RowID]);
                ViewSetting v            = new ViewSetting(ViewID, ViewRowID, View, UserGroup, Permission, IsActionMenu, IsDataSheet, IsRssFeed, IsAlertMe);
                allViews.Add(v);
            }


            SPSecurity.RunWithElevatedPrivileges(delegate
            {
                using (SPSite objSite = new SPSite(SPContext.Current.Web.Url.ToString()))
                {
                    using (SPWeb objWeb = objSite.OpenWeb())
                    {
                        objWeb.AllowUnsafeUpdates = true;

                        SPList list = objWeb.Lists[new Guid(Request.QueryString["List"])];

                        string xml = allViews.ToString();
                        if (allViews.Count > 0 && Helper.IsValidXml(xml))
                        {
                            Helper.CreateConfigFile(list, Constants.ConfigFile.ViewPermissionsFile, xml);
                        }
                        else
                        {
                            Helper.DeleteConfigFile(list, Constants.ConfigFile.ViewPermissionsFile, xml);
                        }

                        objWeb.AllowUnsafeUpdates = false;
                    }
                }
            });
        }
Beispiel #17
0
 public void StoreViewSettingTest1()
 {
     using (var dgv = new DataGridView())
     {
         var dgvc = new DataGridViewColumn(new DataGridViewTextBoxCell())
         {
             DataPropertyName = "test",
             ValueType        = typeof(string)
         };
         dgv.Columns.Add(dgvc);
         var columnFilters = new List <ToolStripDataGridViewColumnFilter> {
             new ToolStripDataGridViewColumnFilter(dgvc)
         };
         var text = ViewSetting.StoreViewSetting(dgv, columnFilters);
         Assert.IsTrue(!string.IsNullOrEmpty(text));
     }
 }
Beispiel #18
0
        public TreeListView()
        {
            this.DoubleBuffered = true;
            this.BackColor      = SystemColors.Window;
            this.TabStop        = true;

            m_rowPainter  = new RowPainter();
            m_cellPainter = new CellPainter(this);

            m_nodes       = new TreeListViewNodes(this);
            m_columns     = new TreeListColumnCollection(this);
            m_rowSetting  = new RowSetting(this);
            m_viewSetting = new ViewSetting(this);


            AddScroolBars();
        }
Beispiel #19
0
    private void OpenImmediately(string viewName)
    {
        ViewComp viewComp = null;

        if (mCacheViewDict.ContainsKey(viewName))
        {
            viewComp = mCacheViewDict[viewName];
            mCacheViewDict.Remove(viewName);

            viewComp.HintRootGo.transform.SetAsLastSibling();
            viewComp.Enter();
        }
        else
        {
            ViewSetting viewSetting = ViewSetting.ViewDict[viewName];

            viewComp = new ViewComp();
            GameObject hintGo = new GameObject();
            hintGo.name = viewName;
            hintGo.transform.SetParent(mUIRootDict[viewSetting.Layer]);
            hintGo.transform.localScale    = new Vector3(1, 1, 1);
            hintGo.transform.localPosition = new Vector3(0, 0, 0);

            viewComp.HintRootGo = hintGo;
            viewComp.ViewName   = viewName;
            viewComp.HintRootGo.transform.SetAsLastSibling();

            viewComp.CurViewState = ViewState.Loading;
            AssetManager.LoadGameObject <GameObject>(viewSetting.Key, (UnityEngine.Object obj) => {
                GameObject insGo = GameObject.Instantiate((GameObject)obj);

                insGo.transform.SetParent(viewComp.HintRootGo.transform);
                insGo.transform.localPosition = new Vector3(0, 0, 0);
                insGo.transform.localScale    = new Vector3(1, 1, 1);

                viewComp.MainGo = insGo;
                viewComp.Enter();
            });
        }
        this.mCurView = viewComp;
    }
Beispiel #20
0
        public ActionResult SaveViewSetting(ViewSetting model)
        {
            ViewSetting entity  = AspNetUser.ViewSettings.FirstOrDefault(x => x.Path == model.Path);
            string      columns = Request.Form["Columns"].ToString();

            if (entity != null)
            {
                entity.Columns = columns;
                DataContext.Entry(entity).State = EntityState.Modified;
            }
            else
            {
                DataContext.ViewSettings.Add(new ViewSetting
                {
                    AspNetUserId = AspNetUser.Id,
                    Columns      = columns,
                    Path         = model.Path
                });
            }
            DataContext.SaveChanges();
            return(Content("OK"));
        }
Beispiel #21
0
        /// <summary>
        /// 保存商户对于视图的配置
        /// </summary>
        /// <param name="configId"></param>
        /// <param name="setting"></param>
        /// <returns></returns>
        public bool SaveSiteViewConfig(int configId, string setting)
        {
            ViewSiteConfig config = this.GetSiteViewConfig(configId);

            if (config == null)
            {
                return(this.FaildMessage("配置项目错误"));
            }
            // 验证setting内容是否正确
            ViewSetting view = this.GetViewSetting(config.ViewID);

            try
            {
                ViewUtils.CreateInstance(view.Code, setting);
            }
            catch (Exception ex)
            {
                return(this.FaildMessage(ex.Message));
            }
            config.Setting = setting;
            this.WriteDB.Update <ViewSiteConfig, string>(t => t.Setting, setting, t => t.ID == configId);
            ViewCaching.Instance().SaveSiteConfig(config);
            return(this.AccountInfo.Log(LogType.Site, $"修改商户{config.SiteID}视图配置参数,ID={configId},View={view.Code}"));
        }
Beispiel #22
0
        /// <summary>
        /// グリッドにリストを生成する
        /// </summary>
        private void ListCreate()
        {
            // グリッドクリア
            this.GridClear();

            // BGWC壁紙フォルダが存在するときのみリスト作成
            if (Directory.Exists(this.txtWallpaperFolder.Text))
            {
                // BGWC壁紙フォルダ以下にあるファイルを取得し配列に格納
                string[] strAllFiles = Directory.GetFiles(this.txtWallpaperFolder.Text, "*", SearchOption.AllDirectories);

                // 壁紙に関するファイルだけ抽出
                List <string> lstGraphicFile = new List <string>();   // 壁紙用ファイルリスト初期化
                lstGraphicFile.Capacity = strAllFiles.Length;
                foreach (string strFile in strAllFiles)
                {
                    if (this.CheckFileExt(Path.GetExtension(strFile)))
                    {
                        lstGraphicFile.Add(strFile);
                    }
                }

                // リストを作成

                // SourceGrid用イベント初期化
                CellDoubleClickEvent   doubleclickController   = new CellDoubleClickEvent();
                FileNameCellClickEvent filenameClickController = new FileNameCellClickEvent();
                //FileNameEditStartEvent filenameeditstartController = new FileNameEditStartEvent();
                WallpaperColorCellClickEvent wallpaperColorClickController = new WallpaperColorCellClickEvent();
                KeyDownEvent keydownController = new KeyDownEvent();

                // 壁紙位置リスト生成
                SourceGrid.Cells.Editors.ComboBox cbEditor = new SourceGrid.Cells.Editors.ComboBox(typeof(string));
                cbEditor.StandardValues        = new string[] { "", MainProgram.conWallpaperPos_Ori, MainProgram.conWallpaperPos_Arr, MainProgram.conWallpaperPos_Fit };
                cbEditor.EditableMode          = SourceGrid.EditableMode.Focus | SourceGrid.EditableMode.SingleClick | SourceGrid.EditableMode.AnyKey;
                cbEditor.Control.DropDownStyle = ComboBoxStyle.DropDownList;

                // 検索用IndexList初期化
                _lstKeyIndexList          = new List <string>();
                _lstKeyIndexList.Capacity = 1000;
                // ヘッダの分を追加しておく
                _lstKeyIndexList.Add("");

                // 壁紙用ファイルリストから1つずつとりだす
                foreach (string strFile in lstGraphicFile)
                {
                    // 新規行番号を取得
                    int i = griList.RowsCount;
                    // 新規行を追加
                    griList.Rows.Insert(i);

                    // ファイル名用セル生成
                    griList[i, (int)MainProgram.enuGrid.FILENAME] = new SourceGrid.Cells.Cell(strFile.Replace(this.txtWallpaperFolder.Text + "\\", ""), typeof(string));
                    griList[i, (int)MainProgram.enuGrid.FILENAME].Editor.EditableMode = SourceGrid.EditableMode.None;
                    griList[i, (int)MainProgram.enuGrid.FILENAME].AddController(doubleclickController);
                    griList[i, (int)MainProgram.enuGrid.FILENAME].AddController(filenameClickController);
                    //griList[i, (int)MainProgram.enuGrid.FILENAME].AddController(filenameeditstartController);
                    griList[i, (int)MainProgram.enuGrid.FILENAME].AddController(keydownController);
                    // 検索用Indexリストに追加
                    _lstKeyIndexList.Add(strFile.Replace(WallpaperFolder + "\\", ""));
                    // 追加するファイルパス格納
                    string strAddFilePath = txtWallpaperFolder.Text + "\\" + griList[i, (int)MainProgram.enuGrid.FILENAME].Value;

                    // 壁紙サイズ用セル生成
                    //if (this.CheckFileExt((Path.GetExtension(strFile)))){
                    griList[i, (int)MainProgram.enuGrid.WALLPAPERSIZE] = new SourceGrid.Cells.Cell(MainFunc.GetWallpaperSize(strAddFilePath));
                    //}

                    // 壁紙位置用セル生成
                    griList[i, (int)MainProgram.enuGrid.VIEWPOS]      = new SourceGrid.Cells.Cell("", cbEditor);
                    griList[i, (int)MainProgram.enuGrid.VIEWPOS].View = SourceGrid.Cells.Views.ComboBox.Default;

                    // 壁紙色用セル生成
                    griList[i, (int)MainProgram.enuGrid.COLOR] = new SourceGrid.Cells.Cell("None", typeof(string));
                    griList[i, (int)MainProgram.enuGrid.COLOR].AddController(wallpaperColorClickController);
                    griList[i, (int)MainProgram.enuGrid.COLOR].Editor.EditableMode = SourceGrid.EditableMode.None;

                    // 壁紙色(RGB)用セル生成
                    griList[i, (int)MainProgram.enuGrid.RGBCOLOR] = new SourceGrid.Cells.Cell("", typeof(string));
                }
                // 検索用Indexリストのキャパシティを調整
                _lstKeyIndexList.TrimExcess();


                // 個別壁紙表示設定が存在する場合(ViewSettingファイルが存在)
                if (File.Exists(MainProgram.ApplicationPath + "\\" + MainProgram.conViewSetFileName))
                {
                    // 個別壁紙表示設定を取得 (DLL)
                    ViewSetting vset = new ViewSetting();

                    // ViewSettingファイルからロード
                    vset.ReadViewSetting(MainProgram.ApplicationPath + "\\" + MainProgram.conViewSetFileName);

                    // ViewSettingListから1つずつ取り出す
                    foreach (GVWI gvwi in vset.List)
                    {
                        // BGWCKeyをもつIndexを検索
                        int idx = GetKeyIndex(gvwi.Key);

                        // 見つかったとき
                        if (idx > 0)
                        {
                            // ヘッダの分プラス
                            //idx++;

                            // 壁紙位置を更新
                            griList[idx, (int)MainProgram.enuGrid.VIEWPOS]      = new SourceGrid.Cells.Cell(gvwi.ViewPos, cbEditor);
                            griList[idx, (int)MainProgram.enuGrid.VIEWPOS].View = SourceGrid.Cells.Views.ComboBox.Default;

                            if (gvwi.Color != "")
                            {
                                // 壁紙色を更新
                                griList[idx, (int)MainProgram.enuGrid.RGBCOLOR] = new SourceGrid.Cells.Cell(gvwi.Color, typeof(string));
                                string[] strRGB = gvwi.Color.Split(' ');
                                SourceGrid.Cells.Views.Cell cview = new SourceGrid.Cells.Views.Cell();
                                cview.BackColor = Color.FromArgb(int.Parse(strRGB[0]), int.Parse(strRGB[1]), int.Parse(strRGB[2]));
                                griList[idx, (int)MainProgram.enuGrid.COLOR].View  = cview;
                                griList[idx, (int)MainProgram.enuGrid.COLOR].Value = "";
                            }
                        }
                    }
                }

                // 現在の壁紙を選択状態にする
                ListWallpaperSelected(GetWallpaperKey(NowWallpaper));
            }
        }
Beispiel #23
0
    public void saveSettings()
    {
        if (settings == null) {
            Console.WriteLine ("NO SETTINGS??");
            return;
        }

        /***************************
         * SAVE DEVICE
         */
        settings.deviceSettings.Clear ();
        foreach (IDevice device in devices) {
            DeviceSetting devsettings = new DeviceSetting ();

            //device
            devsettings.DeviceName = device.getDeviceName ();
            if (device.driver == null) {
                device.driver = new EmptyDriver ();
            }
            devsettings.DriverName = device.driver.getDriverName ();

            //driver
            devsettings.DeviceLogin = device.driver.Login;
            devsettings.DevicePassword = device.driver.Password;
            devsettings.DeviceURI = device.driver.URI;

            settings.deviceSettings.Add (devsettings);
        }

        /***************************
         * SAVE VIEW
         */
        settings.viewSettings.Clear ();
        foreach (CameraView view in views) {
            ViewSetting viewsettings = new ViewSetting ();

            //device
            if (view.getCurrentDevice () != null) {
                viewsettings.DeviceName = view.getCurrentDevice ().getDeviceName ();
            } else {
                viewsettings.DeviceName = "";
            }
            settings.viewSettings.Add (viewsettings);
        }

        settings.SaveToFile (settingsPath+"/settings.xml");
    }
Beispiel #24
0
        /// <summary>
        /// 保存视图对象
        /// </summary>
        /// <param name="setting"></param>
        public void SaveViewSettingInfo(ViewSetting setting)
        {
            string key = $"{VIEWSETTING}{setting.ID}";

            this.NewExecutor().HashSet(key, setting);
        }
Beispiel #25
0
        /// <summary>
        /// 保存商户模板
        /// </summary>
        /// <param name="template"></param>
        /// <param name="models"></param>
        /// <returns></returns>
        public bool SaveSiteTemplateInfo(ViewSiteTemplate template, int[] models)
        {
            if (string.IsNullOrEmpty(template.Name))
            {
                return(this.FaildMessage("请输入模板名称"));
            }
            if (!string.IsNullOrEmpty(template.Domain) && !isDomain(template.Domain))
            {
                return(this.FaildMessage("域名错误,请重新输入域名"));
            }

            bool isNew = template.ID == 0;

            using (DbExecutor db = NewExecutor(IsolationLevel.ReadUncommitted))
            {
                if (template.ID == 0)
                {
                    template.AddIdentity(db);
                }
                else
                {
                    template.Update(db, t => t.Name, t => t.Platform, t => t.Domain);
                }

                //# 得到当前平台下所有的视图
                List <ViewSetting> views     = db.ReadList <ViewSetting>(t => t.Platform == template.Platform);
                List <ViewModel>   modelList = new List <ViewModel>();
                foreach (int modelId in models)
                {
                    ViewModel model = db.ReadInfo <ViewModel>(t => t.ID == modelId);
                    if (model == null)
                    {
                        db.Rollback();
                        return(this.FaildMessage($"模型ID{modelId}不存在"));
                    }
                    ViewSiteConfig config = isNew ? null :
                                            config = db.ReadInfo <ViewSiteConfig>(t => t.TemplateID == template.ID && t.ViewID == model.ViewID && t.SiteID == template.SiteID);
                    if (config != null && config.ModelID != modelId)
                    {
                        config.ModelID = modelId;
                        config.Update(db, t => t.ModelID);
                    }
                    else if (config == null)
                    {
                        config = new ViewSiteConfig()
                        {
                            TemplateID = template.ID,
                            ViewID     = model.ViewID,
                            ModelID    = model.ID,
                            SiteID     = template.SiteID
                        };
                        config.Add(db);
                    }
                    modelList.Add(model);
                }

                ViewSetting view = views.FirstOrDefault(t => !modelList.Any(p => p.ViewID == t.ID));
                if (view != null)
                {
                    db.Rollback();
                    return(this.FaildMessage($"视图{view.Name}未选则模型"));
                }

                db.AddCallback(() =>
                {
                    SiteCaching.Instance().RemoveSiteInfo(template.SiteID);
                });

                db.Commit();
            }

            return(this.AccountInfo.Log(LogType.View, $"保存系统模板 {template.Platform}/{template.Name}"));
        }
Beispiel #26
0
        private void MakeDefaultViewSettings()
        {
            ViewSetting vs;

            // 0
            vs                           = new ViewSetting();
            vs.ZoomFactor                = 0;
            vs.CellMarginHeight          = 0;
            vs.DrawOutline               = false;
            vs.DrawInsnName              = false;
            vs.DrawStageName             = false;
            vs.DrawDependencyLeftCurve   = false;
            vs.DrawDependencyInsideCurve = false;
            vs.DrawDependencyInsideLine  = false;
            vs.CellSize                  = new SizeF(1.0f, 1.0f);
            vs.DependencyArrowheadLength = 1.0f;
            vs.DependencyArrowWidth      = 1.0f;
            viewSettings.Add(vs);

            // 1
            vs                           = new ViewSetting();
            vs.ZoomFactor                = 1;
            vs.CellMarginHeight          = 0;
            vs.DrawOutline               = false;
            vs.DrawInsnName              = false;
            vs.DrawStageName             = false;
            vs.DrawDependencyLeftCurve   = true;
            vs.DrawDependencyInsideCurve = true;
            vs.DrawDependencyInsideLine  = true;
            vs.CellSize                  = new SizeF(8.0f, 6.0f);
            vs.DependencyArrowheadLength = vs.CellSize.Width / 5.0f;
            vs.DependencyArrowWidth      = 1.0f;
            viewSettings.Add(vs);

            // 2
            vs                           = new ViewSetting();
            vs.ZoomFactor                = 2;
            vs.CellMarginHeight          = 1;
            vs.DrawOutline               = true;
            vs.DrawInsnName              = false;
            vs.DrawStageName             = false;
            vs.DrawDependencyLeftCurve   = true;
            vs.DrawDependencyInsideCurve = true;
            vs.DrawDependencyInsideLine  = true;
            vs.CellSize                  = new SizeF(16.0f, 12.0f);
            vs.DependencyArrowheadLength = vs.CellSize.Width / 5.0f;
            vs.DependencyArrowWidth      = 1.0f;
            viewSettings.Add(vs);

            // 3
            vs                           = new ViewSetting();
            vs.ZoomFactor                = 3;
            vs.CellMarginHeight          = 2;
            vs.DrawOutline               = true;
            vs.DrawInsnName              = true;
            vs.DrawStageName             = true;
            vs.DrawDependencyLeftCurve   = true;
            vs.DrawDependencyInsideCurve = true;
            vs.DrawDependencyInsideLine  = true;
            vs.CellSize                  = new SizeF(32.0f, 24.0f);
            vs.DependencyArrowheadLength = vs.CellSize.Width / 5.0f;
            vs.DependencyArrowWidth      = 2.0f;
            viewSettings.Add(vs);

            currentViewSetting = vs;

            trackBarZoom.Maximum = viewSettings.Count - 1;

            WriteViewSettings();
        }
Beispiel #27
0
        private void ApplyViewSetting(ViewSetting vs)
        {
            ViewSetting oldViewSetting = currentViewSetting;
            SizeF       lastGridSize   = coordinateSystem.Grid;

            currentViewSetting = vs;


            // Calculate grid and cell sizes.
            if (config.RetainOriginalGridSize)
            {
                coordinateSystem.SetGrid(currentViewSetting.CellSize);
                int segmentCount = 0;
                for (int i = 0; i < config.DrawInSeparateLane.Count; i++)
                {
                    if (i < loginfo.SegmentCount && config.DrawInSeparateLane[i])
                    {
                        segmentCount++;
                    }
                }
                if (segmentCount == 0)
                {
                    segmentCount = 1;
                }
                SizeF cellSize = currentViewSetting.CellSize;
                cellSize.Height = Math.Max(cellSize.Height / segmentCount, 1);
                coordinateSystem.SetCell(cellSize);
            }
            else
            {
                coordinateSystem.SetCell(currentViewSetting.CellSize);
                SizeF grid = new SizeF(coordinateSystem.Cell.Width, 0);
                for (int i = 0; i < config.DrawInSeparateLane.Count; i++)
                {
                    if (i < loginfo.SegmentCount && config.DrawInSeparateLane[i])
                    {
                        grid.Height += coordinateSystem.Cell.Height;
                    }
                }
                coordinateSystem.SetGrid(grid);
            }

            // グラデーションの基準サイズが変化するため,ブラシを作り直す
            MakeStageBrushes();
            MakeDependencyArrow();

            UpdateView();

            Point p;

            p   = panelMainView.ScrollPosition;
            p.X = (int)(p.X * coordinateSystem.Grid.Width / lastGridSize.Width);
            p.Y = (int)(p.Y * coordinateSystem.Grid.Height / lastGridSize.Height);
            panelMainView.ScrollPosition = p;

            splitContainer1.Invalidate(true);

            p   = splitContainer1.Panel2.AutoScrollPosition;
            p.X = (int)(-p.X * coordinateSystem.Grid.Width / oldViewSetting.CellSize.Width);
            p.Y = (int)(-p.Y * coordinateSystem.Grid.Width / oldViewSetting.CellSize.Width);
            splitContainer1.Panel2.AutoScrollPosition = p;
        }
        protected void createTabXML()
        {
            Views allViews = new Views();
            DataTable viewtable = ViewDataTable;
            foreach (DataRow drViewRow in viewtable.Rows)
            {
                string ViewID = drViewRow[Constants.ViewField.ViewID].ToString();
                string View = drViewRow[Constants.ViewField.View].ToString();
                string UserGroup = drViewRow[Constants.ViewField.UserGroup].ToString();
                string Permission = drViewRow[Constants.ViewField.Permission].ToString();
                bool IsActionMenu = Convert.ToBoolean(drViewRow[Constants.ViewField.IsActionMenu].ToString());
                bool IsDataSheet = Convert.ToBoolean(drViewRow[Constants.ViewField.IsDataSheet].ToString());
                bool IsRssFeed = Convert.ToBoolean(drViewRow[Constants.ViewField.IsRssFeed].ToString());
                bool IsAlertMe = Convert.ToBoolean(drViewRow[Constants.ViewField.IsAlertMe].ToString());
                int ViewRowID = Convert.ToInt32(drViewRow[Constants.RowID]);
                ViewSetting v = new ViewSetting(ViewID, ViewRowID, View, UserGroup, Permission, IsActionMenu, IsDataSheet, IsRssFeed, IsAlertMe);
                allViews.Add(v);
            }


            SPSecurity.RunWithElevatedPrivileges(delegate
            {
                using (SPSite objSite = new SPSite(SPContext.Current.Web.Url.ToString()))
                {
                    using (SPWeb objWeb = objSite.OpenWeb())
                    {
                        objWeb.AllowUnsafeUpdates = true;

                        SPList list = objWeb.Lists[new Guid(Request.QueryString["List"])];

                        string xml = allViews.ToString();
                        if (allViews.Count > 0 && Helper.IsValidXml(xml))
                        {

                            Helper.CreateConfigFile(list, Constants.ConfigFile.ViewPermissionsFile, xml);
                        }
                        else
                        {
                            Helper.DeleteConfigFile(list, Constants.ConfigFile.ViewPermissionsFile, xml);
                        }

                        objWeb.AllowUnsafeUpdates = false;
                    }
                }
            });

        }