Example #1
0
        private static string GetAssociatedTargetProjectPath()
        {
            string targetProjectPath;
            string sourceProjectPath = Access.ProjectModel.ProjectPathFromFilePath(SourceTargetInfo.SourcePath);

            if (string.IsNullOrEmpty(sourceProjectPath))
            {
                Logger.Info("CreateClassHelper.GetAssociatedTargetProjectPath, sourceProjectPath is null");
                return(null);
            }

            // check the cache first
            if (SourceTargetInfo.IsSourcePathTest)
            {
                targetProjectPath =
                    Access.ProjectModel.ImplementationProjectFromTestProject(sourceProjectPath);
            }
            else
            {
                targetProjectPath =
                    Access.ProjectModel.TestProjectFromImplementationProject(sourceProjectPath);
            }

            if (!string.IsNullOrEmpty(targetProjectPath))
            {
                Logger.InfoFormat("CreateClassHelper.GetAssociatedTargetProjectPath, found target in cache:{0}", targetProjectPath);
                return(targetProjectPath);
            }

            // ask user in which project they want to create missing test/implementation
            var associateTestProjectDialog = new AssociateTestProject(sourceProjectPath);

            ViewUtil.SetModalDialogOwner(associateTestProjectDialog);

            var dlgResult = associateTestProjectDialog.ShowDialog();

            if (!dlgResult.HasValue || dlgResult != true)
            {
                Logger.Info("CreateClassHelper.GetAssociatedTargetProjectPath AssociateTestProjectDlg cancelled");
                return(null);
            }
            if (!associateTestProjectDialog.ViewModel.RequestCreateProject)
            {
                Logger.InfoFormat("CreateClassHelper.GetAssociatedTargetProjectPath, user picked project through dialog:{0}",
                                  associateTestProjectDialog.SelectedProject);
                return(associateTestProjectDialog.SelectedProject);
            }

            var projectName = associateTestProjectDialog.ViewModel.NewProjectName;

            if (!CreateProjectHelper.CreateProject(projectName))
            {
                Logger.Info("CreateClassHelper.GetAssociatedTargetProjectPath CreateProjectHelper.CreateProject returned false");
                return(null);
            }
            var associatedTargetProjectPath = PathForProject(projectName);

            Logger.InfoFormat("CreateClassHelper.GetAssociatedTargetProjectPath returns:{0}", associatedTargetProjectPath);
            return(associatedTargetProjectPath);
        }
 public void Fill(IDataReader row)
 {
     this.ID             = Convert.IsDBNull(row["ID"]) ? 0 : Convert.ToInt64(row["ID"]);
     this.ViewPath       = Convert.IsDBNull(row["View"]) ? null : ViewUtil.ObtenerNombreDeView(row["View"].ToString());
     this.IdRol          = Convert.IsDBNull(row["IdRol"]) ? null : row["IdRol"].ToString();
     this.TodasLasVistas = Convert.IsDBNull(row["All"]) ? (byte)0 : Convert.ToByte(row["All"]);
 }
Example #3
0
        //----==== PUBLIC ====---------------------------------------------------------------------

        public void ExecuteMenuItem(string label)
        {
            switch (label)
            {
            case ABOUT_MENU_OPT:
                ViewUtil.ExecuteRelayCommand(AboutCommand);
                break;

            case LOGOUT_MENU_OPT:
                ViewUtil.ExecuteRelayCommand(LogoutCommand);
                break;

            case SETTINGS_MENU_OPT:
                ViewUtil.ExecuteRelayCommand(SettingsCommand);
                break;

            case TWEET_MENU_OPT:
                ViewUtil.ExecuteRelayCommand(SendTweetCommand);
                break;

                //case PRIVACY_CMD:
                //	ViewUtil.ExecuteRelayCommand(PrivacyCommand);
                //	break;
            }
        }
Example #4
0
        public void SetService(List <EpgServiceInfo> serviceList)
        {
            stackPanel_service.Children.Clear();
            foreach (EpgServiceInfo info in serviceList)
            {
                var service1 = new StackPanel();
                service1.Width                = Settings.Instance.ServiceWidth - 1;
                service1.Margin               = new Thickness(0, 1, 1, 1);
                service1.Background           = CommonManager.Instance.EpgServiceBackColor;
                service1.MouseLeftButtonDown += (sender, e) =>
                {
                    if (e.ClickCount != 2)
                    {
                        return;
                    }
                    //
                    var serviceInfo = ((FrameworkElement)sender).DataContext as EpgServiceInfo;
                    CommonManager.Instance.TVTestCtrl.SetLiveCh(serviceInfo.ONID, serviceInfo.TSID, serviceInfo.SID);
                };
                service1.DataContext = info;

                var text = ViewUtil.GetPanelTextBlock(info.service_name);
                text.Margin     = new Thickness(1, 0, 1, 0);
                text.Foreground = CommonManager.Instance.EpgServiceFontColor;
                service1.Children.Add(text);

                text            = ViewUtil.GetPanelTextBlock(info.remote_control_key_id != 0 ? info.remote_control_key_id.ToString() : info.network_name + " " + (info.SID & (ChSet5.IsCS(info.ONID) == true ? 0x03FF : 0xFFFF)).ToString());
                text.Margin     = new Thickness(1, 0, 1, 2);
                text.Foreground = CommonManager.Instance.EpgServiceFontColor;
                service1.Children.Add(text);

                service1.ToolTip = Settings.Instance.EpgServiceNameTooltip != true ? null : ViewUtil.ServiceHeaderToToolTip(service1);
                stackPanel_service.Children.Add(service1);
            }
        }
Example #5
0
 /**
  * @param   changes     What is different as nested hashes.
  */
 public static void Visit(Dictionary <string, dynamic> parent, Dictionary <string, dynamic> changes)
 {
     foreach (KeyValuePair <string, dynamic> _entry in changes)
     {
         string key    = _entry.Key;
         var    change = changes[key];
         var    child  = parent[key];
         if (IsObject(change))
         {
             Visit((Dictionary <string, dynamic>)(child), (Dictionary <string, dynamic>)(change));
         }
         else
         {
             if (object.ReferenceEquals("x", key))
             {
                 //+ ViewUtil.setPositionX(parent, change);
             }
             else if (object.ReferenceEquals("y", key))
             {
                 //+ ViewUtil.setPositionY(parent, change);
             }
             else if (object.ReferenceEquals("visible", key))
             {
                 ViewUtil.SetVisible((GameObject)(parent["view"]), (bool)(change));
             }
         }
     }
 }
Example #6
0
        private void listBox_Button_Set()
        {
            //エスケープキャンセルだけは常に有効にする。
            var bxr = new BoxExchangeEdit.BoxExchangeEditor(null, this.listBox_recFolder, true);
            var bxb = new BoxExchangeEdit.BoxExchangeEditor(null, this.listBox_bon, true);
            var bxt = new BoxExchangeEdit.BoxExchangeEditor(null, this.ListView_time, true);

            listBox_recFolder.SelectionChanged += ViewUtil.ListBox_TextBoxSyncSelectionChanged(listBox_recFolder, textBox_recFolder);

            if (CommonManager.Instance.NWMode == false)
            {
                //録画設定関係
                bxr.AllowDragDrop();
                bxr.AllowKeyAction();
                bxr.targetBoxAllowDoubleClick(bxr.TargetBox, (sender, e) => button_rec_open.RaiseEvent(new RoutedEventArgs(Button.ClickEvent)));
                button_rec_up.Click   += new RoutedEventHandler(bxr.button_Up_Click);
                button_rec_down.Click += new RoutedEventHandler(bxr.button_Down_Click);
                button_rec_del.Click  += new RoutedEventHandler(bxr.button_Delete_Click);
                button_rec_add.Click  += ViewUtil.ListBox_TextCheckAdd(listBox_recFolder, textBox_recFolder);

                //チューナ関係関係
                bxb.AllowDragDrop();
                button_bon_up.Click   += new RoutedEventHandler(bxb.button_Up_Click);
                button_bon_down.Click += new RoutedEventHandler(bxb.button_Down_Click);

                //EPG取得関係
                bxt.TargetItemsSource = timeList;
                bxt.AllowDragDrop();
                bxt.AllowKeyAction();
                button_delTime.Click += new RoutedEventHandler(bxt.button_Delete_Click);

                new BoxExchangeEdit.BoxExchangeEditor(null, this.listView_service, true);
            }
        }
Example #7
0
 public void Start()
 {
     model.Start();
     view.graph = ControllerUtil.FindGraphByName(model.view.graph, model.view.main);
     ViewUtil.SetupAudio(model.view.main, model.view.sounds);
     ControllerUtil.SetupButtons(this, model.view.buttons);
 }
Example #8
0
 private void InitView()
 {
     try
     {
         this.SetContentView(Resource.Layout.docskit_activity_web_view);
         mWebView = (WebView)ViewUtil.FindViewById(this, Resource.Id.external_webview);
         Intent intent = new Intent(Intent);
         string url    = intent.GetStringExtra("url");
         // Check the validity of the URL.
         if (IsUrlInValid(url))
         {
             Logger.Error(Tag, "url is invalid");
             Finish();
             return;
         }
         // Setting Web Parameters
         InitWebViewSettings();
         mWebView.LoadUrl(url);
     }
     catch (System.Exception e)
     {
         // The system webView is not installed or is disabled.
         Logger.Error(Tag, "initView error: " + e.Message);
         Finish();
     }
 }
Example #9
0
    /**
     * @param	news	If key "state" in news, set descending child to that state.  Recurses news and descendents.  Side effect:  Clears all news.
     *
     * Flash scene graph (called the display list) has movie clips and other display objects, which are automatically assigned member variables of their children when they have a name.  So a JSON shorthand can be employed like {"cup_0": "empty"}.  Unity GameObject is a sealed class that cannot be extended, so instead the corresponding syntax is {"cup_0": {"state": "empty"}}.  C# is strictly typed, and dictionaries are recommended over hashtables, so the syntax is actually much more verbose:  new Dictionary<string, object>(){{"cup_0", new Dictionary<string, object>(){{"state", "empty"}}}}
     */
    public static void SetStates(Dictionary <string, object> news, Dictionary <string, GameObjectTree> descendents)
    {
        GameObjectTree tree;
        GameObject     child;

        foreach (KeyValuePair <string, object> item in news)
        {
            tree  = descendents[item.Key];
            child = tree.self;
            Dictionary <string, object> articles = (Dictionary <string, object>)item.Value;
            for (int index = 0; index < keys.Length; index++)
            {
                string key = keys[index];
                if (articles.ContainsKey(key))
                {
                    string state = (string)articles[key];
                    if ("state" == key)
                    {
                        ViewUtil.SetState(child, state, true);
                    }
                    else if ("text" == key)
                    {
                        Text uiText = child.GetComponent <Text>();
                        ViewUtil.SetText(uiText, state);
                    }
                    articles.Remove(key);
                }
            }
            if (1 <= articles.Count)
            {
                SetStates(articles, tree.children);
            }
        }
        news.Clear();
    }
Example #10
0
        private string ResolveConflicts(IEnumerable <string> candidateList)
        {
            var correspondingFile = Access.ProjectModel.FindTargetFileInCache(SourceTargetInfo.SourcePath);

            if (!string.IsNullOrEmpty(correspondingFile))
            {
                return(correspondingFile);
            }

            var resolveFileConflictDialog = new ResolveFileConflictDialog(candidateList);

            ViewUtil.SetModalDialogOwner(resolveFileConflictDialog);

            var dlgResult = resolveFileConflictDialog.ShowDialog();

            if (!dlgResult.HasValue || dlgResult != true)
            {
                return(null);
            }

            var selectedFilePath = resolveFileConflictDialog.ViewModel.SelectedFile.Path;

            if (SourceTargetInfo.IsSourcePathTest)
            {
                Access.ProjectModel.AddFileAssociationToCache(selectedFilePath, SourceTargetInfo.TargetPath);
            }
            else
            {
                Access.ProjectModel.AddFileAssociationToCache(SourceTargetInfo.SourcePath, selectedFilePath);
            }

            return(selectedFilePath);
        }
Example #11
0
        public Rect SetProgramList(List <PanelItem <List <ProgramViewItem> > > programGroupList, double height)
        {
            try
            {
                ClearEpgViewPanel();

                //枠線の調整用
                double totalWidth = 0;
                height = ViewUtil.SnapsToDevicePixelsY(height + epgViewPanel.HeightMarginBottom, 2);
                foreach (var programList in programGroupList)
                {
                    var item = new EpgViewPanel();
                    item.SetViewData(viewData);
                    item.Height = height;
                    item.Width  = programList.Width;
                    Canvas.SetLeft(item, totalWidth);
                    item.Items = programList.Data;
                    item.InvalidateVisual();
                    canvas.Children.Add(item);
                    totalWidth += programList.Width;
                }

                canvas.Width        = ViewUtil.SnapsToDevicePixelsX(totalWidth + epgViewPanel.WidthMarginRight, 2);
                canvas.Height       = height;
                epgViewPanel.Width  = Math.Max(canvas.Width, ViewUtil.SnapsToDevicePixelsX(SystemParameters.VirtualScreenWidth));
                epgViewPanel.Height = Math.Max(canvas.Height, ViewUtil.SnapsToDevicePixelsY(SystemParameters.VirtualScreenHeight));
            }
            catch (Exception ex) { MessageBox.Show(ex.ToString()); }
            return(new Rect(0, 0, canvas.Width, canvas.Height));
        }
Example #12
0
        /// <summary>番組の縦表示位置設定</summary>
        protected virtual void SetProgramViewItemVertical()
        {
            //時間リストを構築
            if (viewCustNeedTimeOnly == true)
            {
                var timeSet = new HashSet <DateTime>();
                foreach (ProgramViewItem item in programList.Values)
                {
                    ViewUtil.AddTimeList(timeSet, GetViewTime(LimitedStart(item.Data)), LimitedDuration(item.Data));
                }
                timeList.AddRange(timeSet.OrderBy(time => time));
            }

            //縦位置を設定
            foreach (ProgramViewItem item in programList.Values)
            {
                ViewUtil.SetItemVerticalPos(timeList, item, GetViewTime(LimitedStart(item.Data)), LimitedDuration(item.Data), this.EpgStyle().MinHeight, viewCustNeedTimeOnly);
            }

            //最低表示行数を適用。また、最低表示高さを確保して、位置も調整する。
            ViewUtil.ModifierMinimumLine(programList.Values, this.EpgStyle().MinimumHeight, this.EpgStyle().FontSizeTitle, this.EpgStyle().EpgBorderTopSize);

            //必要時間リストの修正。番組長の関係や、最低表示行数の適用で下に溢れた分を追加する。
            ViewUtil.AdjustTimeList(programList.Values, timeList, this.EpgStyle().MinHeight);
        }
Example #13
0
        public ActionResult Update(int id, int defaultRoleId, int defaultTemplateId)
        {
            Site site = this._siteService.GetSiteById(id);

            try
            {
                UpdateModel(site, new [] { "Name", "SiteUrl", "WebmasterEmail", "UserFriendlyUrls", "DefaultCulture", "DefaultPlaceholder", "MetaDescription", "MetaKeywords" });
                site.DefaultRole     = this._userService.GetRoleById(defaultRoleId);
                site.DefaultTemplate = this._templateService.GetTemplateById(defaultTemplateId);
                if (ValidateModel(site))
                {
                    this._siteService.SaveSite(site);
                    Messages.AddMessage("SiteUpdatedMessage");
                    RedirectToAction("Index");
                }
            }
            catch (Exception ex)
            {
                Messages.AddException(ex);
            }
            ViewData["Roles"]     = new SelectList(this._userService.GetAllGlobalRoles(), "Id", "Name", site.DefaultRole.Id);
            ViewData["Cultures"]  = new SelectList(Globalization.GetOrderedCultures(), "Key", "Value", site.DefaultCulture);
            ViewData["Templates"] = new SelectList(site.Templates, "Id", "Name", site.DefaultTemplate != null ? site.DefaultTemplate.Id : 0);
            if (site.DefaultTemplate != null)
            {
                string virtualTemplatePath = VirtualPathUtility.Combine(site.SiteDataDirectory, site.DefaultTemplate.Path);
                ViewData["PlaceHolders"] = new SelectList(ViewUtil.GetPlaceholdersFromVirtualPath(virtualTemplatePath).Keys, site.DefaultPlaceholder);
            }
            return(View("EditSite", site));
        }
Example #14
0
        public Rect SetProgramList(List <PanelItem <List <ProgramViewItem> > > programGroupList, double height)
        {
            try
            {
                ClearEpgViewPanel();

                //枠線の調整用
                double totalWidth = 0;
                height = ViewUtil.SnapsToDevicePixelsY(height + epgViewPanel.HeightMarginBottom, 2);
                foreach (var programList in programGroupList)
                {
                    var item = new EpgViewPanel();
                    item.ReplaceDictionaryNormal = epgViewPanel.ReplaceDictionaryNormal;
                    item.ReplaceDictionaryTitle  = epgViewPanel.ReplaceDictionaryTitle;
                    item.Background = epgViewPanel.Background;
                    item.SetBorderStyleFromSettings();
                    item.Height = height;
                    item.Width  = programList.Width;
                    Canvas.SetLeft(item, totalWidth);
                    item.ExtInfoMode = epgViewPanel.ExtInfoMode;
                    item.Items       = programList.Data;
                    item.InvalidateVisual();
                    canvas.Children.Add(item);
                    totalWidth += programList.Width;
                }

                canvas.Width        = ViewUtil.SnapsToDevicePixelsX(totalWidth + epgViewPanel.WidthMarginRight, 2);
                canvas.Height       = height;
                epgViewPanel.Width  = Math.Max(canvas.Width, ViewUtil.SnapsToDevicePixelsX(ViewUtil.GetScreenWidthMax()));
                epgViewPanel.Height = Math.Max(canvas.Height, ViewUtil.SnapsToDevicePixelsY(ViewUtil.GetScreenHeightMax()));
            }
            catch (Exception ex) { MessageBox.Show(ex.Message + "\r\n" + ex.StackTrace); }
            return(new Rect(0, 0, canvas.Width, canvas.Height));
        }
Example #15
0
        private void updatePosition(ref ItemVisualComponent component, PositionComponent positionComponent)
        {
            Vector3Int pos      = positionComponent.position;
            Vector3    scenePos = ViewUtil.fromModelToScene(pos) + new Vector3(0, 0, -0.1f);

            component.spriteRenderer.gameObject.transform.localPosition = scenePos;
        }
Example #16
0
        // set camera target by model
        public void setCameraTarget(Vector3Int position)
        {
            GameView.get().setLayer(position.z);
            Vector3 scenePosition = ViewUtil.fromModelToScene(position);

            setCameraTarget(scenePosition.x, scenePosition.y, scenePosition.z - 1);
        }
Example #17
0
        public void execute(Form hander)
        {
            MainForm mf = hander as MainForm;

            if (ViewUtil.IsEmptyOrder(mf))
            {
                return;
            }

            PayListForm form = new PayListForm(showPayDialog);

            form.listBox1.SelectedValue = typeCode;
            DialogResult dr = form.ShowDialog();

            if (dr == DialogResult.Cancel)  //非正常关闭不做任何处理
            {
                logger.Debug("PayListForm close by esc");
            }
            else
            {
                SystemInfo.LastOrderId = SystemInfo.CurrentOrderId;
                saleOrderService.updateState(SystemInfo.CurrentOrderId, OrderState.Payed.ToString());
                SaleOrder order = saleOrderService.getOrderEntityById(SystemInfo.CurrentOrderId);
                if (SystemInfo.MQ_STATE)  //MQ连接存在发送同步消息
                {
                    logger.Debug("Send sync message Order code is " + order.ordercode);
                    MessageSender.getInstance().asyncSendMessage(order);
                }
                mf.presenter.init();
            }
            if (mf != null)
            {
                mf.barcodeInput.Text = "";
            }
        }
Example #18
0
        public void SetTime(List <DateTime> timeList, bool weekMode, bool tunerMode = false)
        {
            {
                stackPanel_time.Children.Clear();
                bool?  use28 = Settings.Instance.LaterTimeUse == true ? null : (bool?)false;
                double h3L   = (12 + 3) * 3;
                double h6L   = h3L * 2;

                foreach (DateTime time1 in timeList)
                {
                    var      timeMod = new DateTime28(time1, use28);
                    DateTime time    = timeMod.DateTimeMod;
                    string   HourMod = timeMod.HourMod.ToString();

                    var item = ViewUtil.GetPanelTextBlock();
                    stackPanel_time.Children.Add(item);
                    item.Margin = new Thickness(1, 0, 1, 1);

                    if (tunerMode == false)
                    {
                        item.Foreground = this.EpgBrushCache().TimeFontColor;
                        item.Background = this.EpgBrushCache().TimeColorList[time1.Hour / 6];
                        item.Height     = 60 * this.EpgStyle().MinHeight - item.Margin.Top - item.Margin.Bottom;
                        if (weekMode == false)
                        {
                            item.Inlines.Add(new Run(time.ToString("M/d\r\n")));
                            if (item.Height >= h3L)
                            {
                                var color   = time.DayOfWeek == DayOfWeek.Sunday ? Brushes.Red : time.DayOfWeek == DayOfWeek.Saturday ? Brushes.Blue : item.Foreground;
                                var weekday = new Run(time.ToString("ddd"))
                                {
                                    Foreground = color, FontWeight = FontWeights.Bold
                                };
                                item.Inlines.AddRange(new Run[] { new Run("("), weekday, new Run(")") });
                            }
                        }
                        if (item.Height >= h3L)
                        {
                            item.Inlines.Add(new LineBreak());
                        }
                        if (item.Height >= h6L)
                        {
                            item.Inlines.Add(new LineBreak());
                        }
                        item.Inlines.Add(new Run(HourMod)
                        {
                            FontSize = 13, FontWeight = FontWeights.Bold
                        });
                    }
                    else
                    {
                        item.Foreground = time.DayOfWeek == DayOfWeek.Sunday ? Brushes.Red : time.DayOfWeek == DayOfWeek.Saturday ? Brushes.Blue : Settings.BrushCache.TunerTimeFontColor;
                        item.Background = Settings.BrushCache.TunerTimeBackColor;
                        item.Height     = 60 * Settings.Instance.TunerMinHeight - item.Margin.Top - item.Margin.Bottom;
                        item.Text       = time.ToString("M/d\r\n" + (item.Height >= h3L ? "(ddd)\r\n" : ""))
                                          + (item.Height >= h6L ? "\r\n" : "") + HourMod;
                    }
                }
            }
        }
Example #19
0
        public static Bitmap CreateViewportConfigurationBitmap(
            DxfModel model,
            string vportName,
            GraphicsConfig graphicsConfig,
            SmoothingMode smoothingMode,
            int width,
            int height)
        {
            Bitmap      bitmap          = new Bitmap(width, height);
            Rectangle2D targetRectangle = new Rectangle2D(0.0, 0.0, (double)width, (double)height);
            Rectangle   drawingBounds   = new Rectangle(0, 0, width, height);

            using (Graphics graphics = Graphics.FromImage((Image)bitmap))
            {
                graphics.SmoothingMode = smoothingMode;
                graphics.Clear((System.Drawing.Color)graphicsConfig.BackColor);
                GDIGraphics3D gdiGraphics3D = new GDIGraphics3D(graphicsConfig);
                gdiGraphics3D.CreateDrawables(model);
                foreach (DxfVPort vport in (DxfHandledObjectCollection <DxfVPort>)model.VPorts)
                {
                    if (vportName.Equals(vport.Name, StringComparison.InvariantCultureIgnoreCase))
                    {
                        IViewDescription viewDescription = vport.ViewDescription;
                        Matrix4D         transform       = ViewUtil.GetTransform(viewDescription, targetRectangle, true);
                        float            num             = 1f - (float)(viewDescription.ViewportCenter.Y + viewDescription.ViewportHeight / 2.0);
                        RectangleF       rect            = new RectangleF((float)width * (float)(viewDescription.ViewportCenter.X - viewDescription.ViewportWidth / 2.0), (float)height * num, (float)width * (float)viewDescription.ViewportWidth, (float)height * (float)viewDescription.ViewportHeight);
                        graphics.Clip = new System.Drawing.Region(rect);
                        gdiGraphics3D.Draw(graphics, drawingBounds, transform);
                    }
                }
            }
            return(bitmap);
        }
Example #20
0
 public void Start()
 {
     viewModel.Start();
     view.graph = ControllerUtil.FindGraphByName(viewModel.graph, viewModel.main);
     ViewUtil.SetupAudio(viewModel.main, viewModel.sounds);
     ControllerUtil.SetupButtons(this, viewModel.buttons);
 }
Example #21
0
        public SetOtherAppView()
        {
            InitializeComponent();

            button_exe.Click     += ViewUtil.OpenFileNameDialog(textBox_exe, false, "", ".exe");
            button_playExe.Click += ViewUtil.OpenFileNameDialog(textBox_playExe, false, "", ".exe");

            //エスケープキャンセルだけは常に有効にする。
            var bx = new BoxExchangeEdit.BoxExchangeEditor(null, this.listBox_bon, true);

            if (CommonManager.Instance.NWMode == false)
            {
                bx.AllowDragDrop();
                bx.AllowKeyAction();
                button_up.Click   += bx.button_Up_Click;
                button_down.Click += bx.button_Down_Click;
                button_del.Click  += bx.button_Delete_Click;
                button_add.Click  += (sender, e) => ViewUtil.ListBox_TextCheckAdd(listBox_bon, comboBox_bon.Text);
            }
            else
            {
                label3.IsEnabled           = false;
                panel_bonButtons.IsEnabled = false;
                button_add.IsEnabled       = false;
            }
        }
Example #22
0
        private void SetBasicView_tabItem4()
        {
            // tabItem4 - HTTPサーバー

            // 保存できない項目は IsEnabled = false にする
            if (CommonManager.Instance.NWMode == true)
            {
                ViewUtil.DisableControlChildren(tabItem4);
            }
            else
            {
                string httppublicIniPath = SettingPath.SettingFolderPath + "\\HttpPublic.ini";
                textBox_ffmpegPath.Text = IniFileHandler.GetPrivateProfileString("SET", "ffmpeg", "", httppublicIniPath);
                textBox_readexPath.Text = IniFileHandler.GetPrivateProfileString("SET", "readex", "", httppublicIniPath);
            }

            // 読める設定のみ項目に反映させる
            if (IniFileHandler.CanReadInifile)
            {
                int enableHttpSrv = IniFileHandler.GetPrivateProfileInt("SET", "EnableHttpSrv", 0, SettingPath.TimerSrvIniPath);
                checkBox_httpServer.IsChecked = enableHttpSrv > 0;
                checkBox_httpLog.IsChecked    = enableHttpSrv == 2;

                textBox_httpPort.Text = IniFileHandler.GetPrivateProfileString("SET", "HttpPort", "5510", SettingPath.TimerSrvIniPath);

                string gitdir     = Environment.GetEnvironmentVariable("git_install_root");
                string opensslExe = string.IsNullOrEmpty(gitdir) ? "" : gitdir + "\\usr\\bin\\openssl.exe";
                button_generatePem.IsEnabled = false;
                textBox_opensslPath.Text     = IniFileHandler.GetPrivateProfileString("SET", "OpensslExeFile", opensslExe, SettingPath.TimerSrvIniPath);

                textBox_httpAcl.Text        = IniFileHandler.GetPrivateProfileString("SET", "HttpAccessControlList", "+127.0.0.1", SettingPath.TimerSrvIniPath);
                textBox_httpThreads.Text    = IniFileHandler.GetPrivateProfileInt("SET", "HttpNumThreads", 3, SettingPath.TimerSrvIniPath).ToString();
                textBox_httpTimeout.Text    = IniFileHandler.GetPrivateProfileInt("SET", "HttpRequestTimeoutSec", 120, SettingPath.TimerSrvIniPath).ToString();
                textBox_httpSSLVersion.Text = IniFileHandler.GetPrivateProfileInt("SET", "HttpSslProtocolVersion", 2, SettingPath.TimerSrvIniPath).ToString();

                string document_root = CommonManager.Instance.NWMode ? "" : TimerSrvFolder + "\\HttpPublic";
                textBox_docrootPath.Text = IniFileHandler.GetPrivateProfileString("SET", "HttpPublicFolder", document_root, SettingPath.TimerSrvIniPath);

                checkBox_httpAuth.IsChecked = File.Exists(TimerSrvFolder + "\\glpasswd");
                textBox_httpAuthDom.Text    = IniFileHandler.GetPrivateProfileString("SET", "HttpAuthenticationDomain", "mydomain.com", SettingPath.TimerSrvIniPath);

                checkBox_dlnaServer.IsChecked = IniFileHandler.GetPrivateProfileInt("SET", "EnableDMS", 0, SettingPath.TimerSrvIniPath) == 1;
            }
            if (CommonManager.Instance.NWMode == false)
            {
                // ローカル接続時はファイルやフォルダの存在確認をしておく
                CheckHttpFiles();
                CheckHttpsFiles();
                CheckDlnaFiles();
            }
            else
            {
                // ネットワーク接続時は警告を出さない
                warn_http.Visibility       = Visibility.Collapsed;
                warn_ssldll.Visibility     = Visibility.Collapsed;
                warn_sslcertpem.Visibility = Visibility.Collapsed;
                warn_dlna.Visibility       = Visibility.Collapsed;
            }
        }
Example #23
0
        public void setTargetModel(Vector3Int value)
        {
            modelPosition.Set(value.x, value.y, value.z);
            modelPosition = bounds.putInto(modelPosition);
            Vector3 scenePosition = ViewUtil.fromModelToScene(modelPosition);

            target.Set(scenePosition.x, scenePosition.y, scenePosition.z - 0.1f); // get scene position by model
        }
        private void BtnCapNhapSoLuongVoucher_Click(object sender, RoutedEventArgs e)
        {
            int maVoucher = Convert.ToInt32((dtgKhuyenMai.SelectedItem as DataRowView).Row[0]);
            int soLuong   = Int32.Parse(txtSoLuong2.Text);

            BaseDAO.CapNhatSoLuongVoucher(maVoucher, soLuong);
            ViewUtil.loadView(ViewEnum.ChuongTrinhKhuyenMai);
        }
Example #25
0
 public static void SetupButtons(Controller controller, string[] addresses)
 {
     for (int index = 0; index < addresses.Length; index++)
     {
         string address = addresses[index];
         ViewUtil.SetupButton(controller, address);
     }
 }
        private void BtnCapNhapVoucher_Deadlock_fixed_Click(object sender, RoutedEventArgs e)
        {
            int    maVoucher = Convert.ToInt32((dtgKhuyenMai.SelectedItem as DataRowView).Row[0]);
            string GiaTri    = Convert.ToString((dtgKhuyenMai.SelectedItem as DataRowView).Row[5]);

            BaseDAO.CapNhatVoucher_Deadlock_fixed(maVoucher, GiaTri);
            ViewUtil.loadView(ViewEnum.ChuongTrinhKhuyenMai);
        }
        private void BtnDungVoucher_LostUpdate_fixed_Click(object sender, RoutedEventArgs e)
        {
            DataRowView      dataRow = dtgKhuyenMai.SelectedItem as DataRowView;
            List <DataTable> result  = BaseDAO.DungVoucher_LostUpdate(Convert.ToInt32(dataRow.Row[0]));

            MessageBox.Show($"Số lượng ban đầu: " + Convert.ToString(result[0].Rows[0][0]) + "\n Số lượng còn lại: " + Convert.ToString(result[1].Rows[0][0]));
            ViewUtil.loadView(ViewEnum.ChuongTrinhKhuyenMai);
        }
Example #28
0
 public static void SetStateArray(GameObject[] gameObjects, string[] states, bool isRestart = false)
 {
     for (int index = 0; index < gameObjects.Length; index++)
     {
         GameObject gameObject = gameObjects[index];
         string     state      = states[index];
         ViewUtil.SetState(gameObject, state, isRestart);
     }
 }
Example #29
0
 public static void PlaySounds(List <string> soundBaseNames)
 {
     for (int index = 0; index < soundBaseNames.Count; index++)
     {
         string filename = soundBaseNames[index];
         ViewUtil.PlaySound(filename);
     }
     soundBaseNames.Clear();
 }
Example #30
0
 protected bool ReloadReserveData()
 {
     if (ViewUtil.ReloadReserveData() == false)
     {
         return(false);
     }
     ReloadReserveViewItem();
     return(true);
 }
Example #31
0
        protected bool RenderText(String text, ref List<TextDrawItem> textDrawList, ViewUtil.ItemFont itemFont, double fontSize, double maxWidth, double maxHeight, double x, double baseline, ref double useHeight, SolidColorBrush fontColor, Matrix m)
        {
            double totalHeight = 0;
            double fontHeight = fontSize * itemFont.GlyphType.Height;

            string[] lineText = text.Replace("\r", "").Split('\n');
            foreach (string line in lineText)
            {
                List<ushort> glyphIndexes = new List<ushort>();
                List<double> advanceWidths = new List<double>();

                //ベースラインの位置
                double dpix = x * m.M11;
                double dpiy = (totalHeight + baseline) * m.M22;
                // ビットマップフォントがかすれる問題 とりあえず整数にしておく
                Point origin = new Point(Math.Round(dpix / m.M11), Math.Round(dpiy / m.M22));

                //メイリオみたいに行間のあるフォントと MS P ゴシックみたいな行間のないフォントがあるので
                //なんとなく行間を作ってみる。
                totalHeight += Math.Max(fontHeight, fontSize + 2);
                double totalWidth = 0;

                for (int n = 0; n < line.Length; n++)
                {
                    // XAML に合わせて、行頭の空白を無視する
                    if (glyphIndexes.Count == 0 && (line[n] == ' ' || line[n] == '\x3000'))
                        continue;

                    //この辞書検索が負荷の大部分を占めているのでテーブルルックアップする
                    //(簡単なパフォーマンス計測をした結果、2~10倍くらい速くなったようだ)
                    //ushort glyphIndex = itemFont.GlyphType.CharacterToGlyphMap[line[n]];
                    //double width = itemFont.GlyphType.AdvanceWidths[glyphIndex] * fontSize;
                    ushort glyphIndex = itemFont.GlyphIndexCache[line[n]];
                    if (glyphIndex == 0)
                    {
                        itemFont.GlyphIndexCache[line[n]] = glyphIndex = itemFont.GlyphType.CharacterToGlyphMap[line[n]];
                        itemFont.GlyphWidthCache[glyphIndex] = (float)itemFont.GlyphType.AdvanceWidths[glyphIndex];
                    }
                    double width = itemFont.GlyphWidthCache[glyphIndex] * fontSize;

                    if (totalWidth + width > maxWidth)
                    {
                        if (glyphIndexes.Count > 0)
                        {
                            TextDrawItem item = new TextDrawItem();
                            item.FontColor = fontColor;
                            item.Text = new GlyphRun(itemFont.GlyphType, 0, false, fontSize,
                                glyphIndexes, origin, advanceWidths, null, null, null, null,
                                null, null);
                            textDrawList.Add(item);
                        }
                        if (totalHeight > maxHeight)
                        {
                            //次の行無理
                            useHeight = totalHeight;
                            return false;
                        }
                        else
                        {
                            //次の行いける
                            dpiy = (totalHeight + baseline) * m.M22;
                            origin = new Point(Math.Round(dpix / m.M11), Math.Round(dpiy / m.M22));
                            totalHeight += Math.Max(fontHeight, fontSize + 2);
                            totalWidth = 0;

                            glyphIndexes = new List<ushort>();
                            advanceWidths = new List<double>();

                            // XAML に合わせて、行頭の空白を無視する
                            if (line[n] == ' ' || line[n] == '\x3000')
                                continue;
                        }
                    }
                    glyphIndexes.Add(glyphIndex);
                    advanceWidths.Add(width);
                    totalWidth += width;
                }
                if (glyphIndexes.Count > 0)
                {
                    TextDrawItem item = new TextDrawItem();
                    item.FontColor = fontColor;
                    item.Text = new GlyphRun(itemFont.GlyphType, 0, false, fontSize,
                        glyphIndexes, origin, advanceWidths, null, null, null, null,
                        null, null);
                    textDrawList.Add(item);
                }
            }
            useHeight = Math.Floor(totalHeight);
            return true;
        }
Example #32
0
        protected bool RenderText(String text, DrawingContext dc, ViewUtil.ItemFont itemFont, SolidColorBrush brush, double fontSize, double maxWidth, double maxHeight, double x, double baseline, ref double useHeight, bool nowrap = false)
        {
            if (x <= 0 || maxWidth <= 0)
            {
                useHeight = 0;
                return false;
            }

            double totalHeight = 0;
            double fontHeight = fontSize * itemFont.GlyphType.Height;

            string[] lineText = text.Replace("\r", "").Split('\n');
            foreach (string line in lineText)
            {
                //高さ確認
                if (totalHeight + fontHeight > maxHeight)
                {
                    //これ以上は無理
                    useHeight = totalHeight;
                    return false;
                }

                // ベースラインの位置の計算
                // ビットマップフォントがかすれる問題 とりあえず整数にしておく
                Point origin = new Point(Math.Round(x), Math.Round(totalHeight + baseline));

                //メイリオみたいに行間のあるフォントと MS P ゴシックみたいな行間のないフォントがあるので
                //なんとなく行間を作ってみる。
                totalHeight += Math.Max(fontHeight, fontSize + 2);
                double totalWidth = 0;

                List<ushort> glyphIndexes = new List<ushort>();
                List<double> advanceWidths = new List<double>();
                for (int n = 0; n < line.Length; n++)
                {
                    // XAML に合わせて、行頭の空白を無視する
                    if (glyphIndexes.Count == 0 && (line[n] == ' ' || line[n] == '\x3000'))
                        continue;

                    //ushort glyphIndex = glyphType.CharacterToGlyphMap[line[n]];
                    //double width = glyphType.AdvanceWidths[glyphIndex] * fontSize;

                    ushort glyphIndex = itemFont.GlyphIndexCache[line[n]];
                    if (glyphIndex == 0)
                    {
                        itemFont.GlyphIndexCache[line[n]] = glyphIndex = itemFont.GlyphType.CharacterToGlyphMap[line[n]];
                        itemFont.GlyphWidthCache[glyphIndex] = (float)itemFont.GlyphType.AdvanceWidths[glyphIndex];
                    }
                    double width = itemFont.GlyphWidthCache[glyphIndex] * fontSize;

                    if (totalWidth + width > maxWidth)
                    {
                        if (nowrap == true) break;//改行しない場合ここで終り
                        if (totalWidth == 0) return false;//一文字も置けなかった(glyphIndexesなどのCount=0のまま)

                        if (totalHeight + fontHeight > maxHeight)
                        {
                            //次の行無理
                            //glyphIndex = glyphType.CharacterToGlyphMap['…'];
                            //double widthEllipsis = glyphType.AdvanceWidths[glyphIndex] * fontSize;
                            glyphIndex = itemFont.GlyphType.CharacterToGlyphMap['…'];
                            double widthEllipsis = itemFont.GlyphType.AdvanceWidths[glyphIndex] * fontSize;
                            while (totalWidth - advanceWidths.Last() + widthEllipsis > maxWidth)
                            {
                                totalWidth -= advanceWidths.Last();
                                glyphIndexes.RemoveAt(glyphIndexes.Count-1);
                                advanceWidths.RemoveAt(advanceWidths.Count - 1);
                            }
                            glyphIndexes[glyphIndexes.Count - 1] = glyphIndex;
                            advanceWidths[advanceWidths.Count - 1] = widthEllipsis;

                            GlyphRun glyphRun = new GlyphRun(itemFont.GlyphType, 0, false, fontSize,
                                glyphIndexes, origin, advanceWidths, null, null, null, null,
                                null, null);

                            dc.DrawGlyphRun(brush, glyphRun);

                            useHeight = totalHeight;
                            return false;
                        }
                        else
                        {
                            //次の行いけるので今までの分出力
                            GlyphRun glyphRun = new GlyphRun(itemFont.GlyphType, 0, false, fontSize,
                                glyphIndexes, origin, advanceWidths, null, null, null, null,
                                null, null);

                            dc.DrawGlyphRun(brush, glyphRun);

                            origin = new Point(Math.Round(x), Math.Round(totalHeight + baseline));
                            totalHeight += Math.Max(fontHeight, fontSize + 2);
                            totalWidth = 0;
                            glyphIndexes = new List<ushort>();
                            advanceWidths = new List<double>();

                            // XAML に合わせて、行頭の空白を無視する
                            if (line[n] == ' ' || line[n] == '\x3000')
                                continue;
                        }
                    }
                    glyphIndexes.Add(glyphIndex);
                    advanceWidths.Add(width);
                    totalWidth += width;
                }
                if (glyphIndexes.Count > 0)
                {
                    GlyphRun glyphRun = new GlyphRun(itemFont.GlyphType, 0, false, fontSize,
                        glyphIndexes, origin, advanceWidths, null, null, null, null,
                        null, null);

                    dc.DrawGlyphRun(brush, glyphRun);
                }
            }
            useHeight = totalHeight;
            return true;
        }