コード例 #1
0
        // GET: api/Logs
        public IEnumerable<LogView> GetLog()
        {
            System.Diagnostics.Debug.Write("fecha hoy: " + DateTime.Today);

            List<LogView> logViewList = new List<LogView>();
            foreach (Log log in db.Log.Where(e => e.Date >= DateTime.Today))
            {
                LogView logView = new LogView();
                logView.dateTime = (DateTime)log.Date;
                logView.Date = ((DateTime)log.Date).ToString("yyyy/MM/dd");
                logView.Time = ((DateTime)log.Date).ToString("hh:mm:ss");
                logView.Action = log.Action;
                logView.Object = log.Object;
                logView.User = log.User;
                logView.Role = log.Role;
                logView.Browser = log.Browser;
                logView.Request = log.Request;
                if (log.Info != null)
                {
                    String[] obj = log.Info.Split(',');
                    logView.Id_object = obj[0];
                    logView.Name = obj[1];
                }
                logViewList.Add(logView);
            }

            return logViewList;
        }
コード例 #2
0
        private void Form1_Load(object sender, EventArgs e)
        {
            logView      = new LogView();
            logView.Dock = DockStyle.Fill;
            logPanel.Controls.Add(logView);
            logView.Log("Application running", LogView.LogType.Information);

            AutobotDisconnected();
            Form form = this;

            HIDDLLInterface.ConnectToHID(ref form);

            clientDataMany = new ClientData[] { };

            CreateDropDownButton();
            CreateDropDownButtonCombinations();

            trayToolStripMenuItem.Checked             = Settings.Default.Settings_Tray;
            topToolStripMenuItem.Checked              = Settings.Default.Settings_Top;
            lastToolStripMenuItem.Checked             = Settings.Default.Settings_Last;
            showReceivedDataToolStripMenuItem.Checked = Settings.Default.Settings_Show_Keys;
            this.TopMost = Settings.Default.Settings_Top;

            tcp = new TCPThread();
            tcp.OnChangeStatus       += Tcp_OnChangeStatus;
            tcp.OnTriggerServerAction = ClientAction;

            logView.Log("IP : " + tcp.LocalAddress, LogView.LogType.Information);
            logView.Log("Port : " + tcp.Port, LogView.LogType.Information);
            logView.Last = Settings.Default.Settings_Last;

            Bot.Instance.OnPingTrigger += Instance_OnPingTrigger;

            tcp.Run();

            botQueue = new BotQueue();
            botQueue.OnErrorOccured += BotQueue_OnErrorOccured;
        }
コード例 #3
0
        void Build()
        {
            paned = new HPaned();

            var mainVBox = new VBox();

            listView = new ListView();
            listView.BorderVisible  = false;
            listView.HeadersVisible = true;
            listStore           = new ListStore(iconField, logMessageTypeField, logMessageTextField, logMessageField);
            listView.DataSource = listStore;

            paned.Panel1.Content = listView;

            var column = new ListViewColumn();

            column.Views.Add(new ImageCellView(iconField));
            column.CanResize = false;
            listView.Columns.Add(column);

            column       = new ListViewColumn();
            column.Title = GettextCatalog.GetString("Type");
            column.Views.Add(new TextCellView(logMessageTypeField));
            column.CanResize = true;
            listView.Columns.Add(column);

            column       = new ListViewColumn();
            column.Title = GettextCatalog.GetString("Message");
            column.Views.Add(new TextCellView(logMessageTextField));
            column.CanResize = true;
            listView.Columns.Add(column);

            logView = new LogView();
            logView.ShowAll();
            paned.Panel2.Content = Toolkit.CurrentEngine.WrapWidget(logView, NativeWidgetSizing.DefaultPreferredSize);

            Content = paned;
        }
コード例 #4
0
        private void AddTask(TaskInfo t)
        {
            foreach (ListViewItem listViewItem in this.taskList.Items)
            {
                TaskInfo taskInfo = listViewItem.Tag as TaskInfo;
                if (taskInfo.FileKey == t.FileKey)
                {
                    FunctionalForm.Infomation(SR.OperationAlreadyAdded);
                    this.taskList.SelectedIndices.Clear();
                    listViewItem.Selected = true;
                    listViewItem.EnsureVisible();
                    return;
                }
            }
            ListViewItem listViewItem2 = LogView.CreateItemStatic(t.ActionType ? LogView.RowType.Add : LogView.RowType.Remove, t.FileKey);

            listViewItem2.SubItems.Add(t.ActionType ? t.NewFile : SR.DeleteFont);
            listViewItem2.SubItems.Add("");
            listViewItem2.Tag = t;
            this.taskList.Items.Add(listViewItem2);
            listViewItem2.EnsureVisible();
            this.btnRun.Enabled = (this.taskList.Items.Count > 0);
        }
コード例 #5
0
 public IActionResult Login(LogView logUser)
 {
     if (ModelState.IsValid)
     {
         User dbUser = dbContext.Users.FirstOrDefault(u => u.Email == logUser.Email);
         if (dbUser != null)
         {
             var hasher = new PasswordHasher <LogView>();
             var result = hasher.VerifyHashedPassword(logUser, dbUser.Password, logUser.Password);
             if (result == 0)
             {
                 ModelState.AddModelError("Email", "Email or password incorrect");
                 return(View("LogView"));
             }
             HttpContext.Session.SetInt32("ID", dbUser.ID);
             System.Console.WriteLine("########################################3");
             System.Console.WriteLine(HttpContext.Session.GetInt32("ID"));
             return(Redirect($"account/{dbUser.ID}"));
         }
         ModelState.AddModelError("Email", "Can't find that email Address");
     }
     return(View("LogView"));
 }
コード例 #6
0
        private void calculate(Action <double> operation, string x)
        {
            var dx = 0d;

            try
            {
                dx    = double.Parse(x);
                Error = "";
            }
            catch (FormatException)
            {
                Error = "Use numbers!";
            }
            catch (Exception ex)
            {
                Error = $"Unexpeced error: {ex.Message}";
            }
            if (Error == "")
            {
                operation(dx);
                MainView.UpdateView();
                if (viewHandler.IsReady(LogView)) //LogView != null && ((Window)LogView).IsVisible)
                {
                    LogView.UpdateView();
                }
            }
            else
            {
                if (!viewHandler.IsReady(ErrorView))          //ErrorView == null || !((Window)ErrorView).IsVisible)
                {
                    ErrorView = container.GetCalcErrorView(); //new ErrorWindow<ICalcController>(model, this);
                }
                ErrorView.UpdateView();
                //((Window)ErrorView).ShowDialog();
                viewHandler.ShowModal(ErrorView);
            }
        }
コード例 #7
0
    private void HandleResult(IResult result)
    {
        if (result == null)
        {
            this.LastResponse = "Null Response\n";
            LogView.AddLog(this.LastResponse);
            return;
        }

        //this.LastResponseTexture = null;

        // Some platforms return the empty string instead of null.
        if (!string.IsNullOrEmpty(result.Error))
        {
            this.Status       = "Error - Check log for details";
            this.LastResponse = "Error Response:\n" + result.Error;
            LogView.AddLog(result.Error);
        }
        else if (result.Cancelled)
        {
            this.Status       = "Cancelled - Check log for details";
            this.LastResponse = "Cancelled Response:\n" + result.RawResult;
            LogView.AddLog(result.RawResult);
        }
        else if (!string.IsNullOrEmpty(result.RawResult))
        {
            this.Status       = "Success - Check log for details";
            this.LastResponse = "Success Response:\n" + result.RawResult;
            this.result_handle(result);
            LogView.AddLog(result.RawResult);
        }
        else
        {
            this.LastResponse = "Empty Response\n";
            LogView.AddLog(this.LastResponse);
        }
    }
コード例 #8
0
        internal void Initialize(MediaPlayer mediaPlayer,
                                 IEnumerable <AdaptiveContentModel> adaptiveContentModels,
                                 HttpClient optionalHttpClient,
                                 LogView loggerControl,
                                 Func <Uri, HttpClient, Task <MediaPlaybackItem> > loadSourceFromUriAsync)
        {
            if (mediaPlayer == null)
            {
                throw new ArgumentNullException("mediaPlayer");
            }
            this.mediaPlayer = mediaPlayer;

            if (adaptiveContentModels == null)
            {
                throw new ArgumentNullException("adaptiveContentModels");
            }
            this.adaptiveContentModels = adaptiveContentModels;

            if (loggerControl == null)
            {
                throw new ArgumentNullException("loggerControl");
            }
            this.loggerControl = loggerControl;

            if (loadSourceFromUriAsync == null)
            {
                throw new ArgumentNullException("loadSourceFromUriAsync");
            }
            this.CreateMediaPlaybackItem = loadSourceFromUriAsync;

            this.optionalHttpClient = optionalHttpClient;

            // Set data context:
            SelectedContent.ItemsSource = this.adaptiveContentModels;
            // Set default item:
            SetSelectedModel(this.adaptiveContentModels.First());
        }
コード例 #9
0
 public MainView()
 {
     InitializeComponent();
     _traceAndPagesView = new TraceSenderView()
     {
         Dock = DockStyle.Fill
     };
     _logView = new LogView()
     {
         Dock = DockStyle.Fill
     };
     _workspaceView = new WorkspaceView()
     {
         Dock = DockStyle.Fill
     };
     _statisticsGridView = new StatisticsGridView()
     {
         Dock = DockStyle.Fill,
     };
     _dataGridView = new FiltersGridView()
     {
         Dock = DockStyle.Fill,
     };
 }
コード例 #10
0
        /// <summary>
        /// Keep the Actual selected logitems then refresh the view and reset the selected log item
        /// </summary>
        public void RefreshView()
        {
            LogEntryRowViewModel l = SelectedLogItem;

            SelectedLogItem = null;
            if (LogView != null)
            {
                LogView.Refresh();
                RaisePropertyChanged(PROP_LogView);

                // Attempt to restore selected item if there was one before
                // and if it is not part of the filtered set of items
                // (ScrollItemBehaviour may scroll it into view when filter is applied)
                if (l != null)
                {
                    if (OnFilterLogItems(l))
                    {
                        SelectedLogItem = l;
                    }
                }
            }
            UpdateFilteredCounters(LogView);
            CommandManager.InvalidateRequerySuggested();
        }
コード例 #11
0
 private void RequestSetSelectedLogView(LogView logView)
 {
     Mediator.NotifyColleagues(MediatorMessages.RequestSetSelectedLogView, logView);
 }
コード例 #12
0
        void Log(string format, params object [] args)
        {
            string message = string.Format(format + Environment.NewLine, args);

            LogView.WriteText(message);
        }
コード例 #13
0
ファイル: Kernel.cs プロジェクト: schifflee/bjd5
        //���j���[�I����̏���
        public void MenuOnClick(String cmd)
        {
            if (cmd.IndexOf("Option_") == 0)
            {
                if (RunMode == RunMode.Remote)
                {
                    //Java fix RunMOde==Remote�̏ꍇ�̃��j���[����
                    RemoteClient.MenuOnClick(cmd);
                }
                else
                {
                    var oneOption = ListOption.Get(cmd.Substring(7));
                    if (oneOption != null)
                    {
                        var dlg = new OptionDlg(this, oneOption);
                        if (DialogResult.OK == dlg.ShowDialog())
                        {
                            //Ver5.8.6 Java fix
                            //oneOption.Save(OptionIni.GetInstance());
                            oneOption.Save(IniDb);
                            MenuOnClick("StartStop_Reload");
                        }
                    }
                }
            }
            else if (cmd.IndexOf("Tool_") == 0)
            {
                if (RunMode == RunMode.Remote)
                {
                    //Java fix RunMOde==Remote�̏ꍇ�̃��j���[����
                    RemoteClient.MenuOnClick(cmd);
                }
                else
                {
                    var nameTag = cmd.Substring(5);
                    var oneTool = ListTool.Get(nameTag);
                    if (oneTool == null)
                    {
                        return;
                    }

                    //BJD.EXE�ȊO�̏ꍇ�A�T�[�o�I�u�W�F�N�g�ւ̃|�C���^���K�v�ɂȂ�
                    OneServer oneServer = null;
                    if (nameTag != "BJD")
                    {
                        oneServer = ListServer.Get(nameTag);
                        if (oneServer == null)
                        {
                            return;
                        }
                    }

                    ToolDlg dlg = oneTool.CreateDlg(oneServer);
                    dlg.ShowDialog();
                }
            }
            else if (cmd.IndexOf("StartStop_") == 0)
            {
                if (RunMode == RunMode.Remote)
                {
                    //Java fix RunMOde==Remote�̏ꍇ�̃��j���[����
                    RemoteClient.MenuOnClick(cmd);
                }
                else
                {
                    switch (cmd)
                    {
                    case "StartStop_Start":
                        Start();
                        break;

                    case "StartStop_Stop":
                        Stop();
                        break;

                    case "StartStop_Restart":
                        Stop();
                        Thread.Sleep(300);
                        Start();
                        break;

                    case "StartStop_Reload":
                        Stop();
                        ListInitialize();
                        Start();
                        break;

                    case "StartStop_Service":
                        SetupService();     //�T�[�r�X�̐ݒ�
                        break;

                    default:
                        Util.RuntimeException(string.Format("cmd={0}", cmd));
                        break;
                    }
                    View.SetColor();  //�E�C���h�̃J���[������
                    Menu.SetEnable(); //��Ԃɉ������L���E����
                }
            }
            else
            {
                switch (cmd)
                {
                case "File_LogClear":
                    LogView.Clear();
                    break;

                case "File_LogCopy":
                    LogView.SetClipboard();
                    break;

                case "File_Trace":
                    TraceDlg.Open();
                    break;

                case "File_Exit":
                    View.MainForm.Close();
                    break;

                case "Help_Version":
                    var dlg = new VersionDlg(this);
                    dlg.ShowDialog();
                    break;

                case "Help_Homepage":
                    Process.Start(Define.WebHome());
                    break;

                case "Help_Document":
                    Process.Start(Define.WebDocument());
                    break;

                case "Help_Support":
                    Process.Start(Define.WebSupport());
                    break;
                }
            }
        }
コード例 #14
0
ファイル: Kernel.cs プロジェクト: schifflee/bjd5
        //�T�[�o�ċN���ŁA�ēx���s����鏉����
        public void ListInitialize()
        {
            //Logger���g�p�ł��Ȃ��Ԃ̃��O�́A������ɕۑ����āA���Logger�ɑ���
            var tmpLogger = new TmpLogger();

            //************************************************************
            // �j��
            //************************************************************
            if (ListOption != null)
            {
                ListOption.Dispose();
                ListOption = null;
            }
            //Java fix
            if (ListTool != null)
            {
                ListTool.Dispose();
                ListTool = null;
            }
            if (ListServer != null)
            {
                ListServer.Dispose();
                ListServer = null;
            }
            if (MailBox != null)
            {
                MailBox = null;
            }
            if (LogFile != null)
            {
                LogFile.Dispose();
                LogFile = null;
            }

            //************************************************************
            // ������
            //************************************************************
            //ListPlugin �́BListOption��ListServer�����������Ԃ�����������
            //isTest=true�̏ꍇ�A�p�X��""�ɂ��āA�v���O�C��0�‚ŏ�������������

            //ListPlugin listPlugin = new ListPlugin((isTest) ? "" : string.Format("%s\\plugins", getProgDir()));
            var listPlugin = new ListPlugin(ProgDir());

            foreach (var o in listPlugin)
            {
                //�����[�g�N���C�A���g�̏ꍇ�A���̃��O�́A��₱�����̂ŕ\�����Ȃ�
                if (RunMode == RunMode.Normal)
                {
                    tmpLogger.Set(LogKind.Detail, null, 9000008, string.Format("{0}Server", o.Name));
                }
            }

            //ListOption�Ŋe�I�v�V���������������O�ɁAisJp�����͏��������Ă����K�v������̂�
            //�ŏ���OptionBasic��lang������ǂݏo��
            //Ver5.8.6 Java fix
            //_isJp = OptionIni.GetInstance().IsJp();
            _isJp = IniDb.IsJp();

            ListOption = new ListOption(this, listPlugin);

            //Ver5.9.1
            //���߂Ă�����ʉ߂���Ƃ��A�ߋ��̃o�[�W������Option��ǂݍ��ނ�
            //���I�v�V�����̓I�u�W�F�N�g�̒���OneOption�ɂ̂ݕێ������
            //���̏�ԂŁA�����̃I�v�V�����w���OK����ƁA���̃I�v�V�����ȊO��
            //Option.ini�ɕۑ�����Ȃ����ߔj������Ă��܂�
            //���̖��ɑΏ����邽�߁A�����ň�x�AOption.ini��ۑ����邱�Ƃɂ���
            if (!_isTest)
            {
                ListOption.Save(IniDb);
            }


            //OptionBasic
            var confBasic = new Conf(ListOption.Get("Basic"));

            EditBrowse = (bool)confBasic.Get("editBrowse");

            //OptionLog
            var confOption = new Conf(ListOption.Get("Log"));

            LogView.SetFont((Font)confOption.Get("font"));

            if (RunMode == RunMode.Normal || RunMode == RunMode.Service)
            {
                //LogFile�̏�����
                var saveDirectory = (String)confOption.Get("saveDirectory");
                saveDirectory = ReplaceOptionEnv(saveDirectory);
                var normalLogKind = (int)confOption.Get("normalLogKind");
                var secureLogKind = (int)confOption.Get("secureLogKind");
                var saveDays      = (int)confOption.Get("saveDays");
                //Ver6.0.7
                var useLogFile  = (bool)confOption.Get("useLogFile");
                var useLogClear = (bool)confOption.Get("useLogClear");
                if (!useLogClear)
                {
                    saveDays = 0; //���O�̎����폜�������ȏꍇ�AsaveDays��0��Z�b�g����
                }
                if (saveDirectory == "")
                {
                    tmpLogger.Set(LogKind.Error, null, 9000045, "It is not appointed");
                }
                else
                {
                    tmpLogger.Set(LogKind.Detail, null, 9000032, saveDirectory);
                    try{
                        LogFile = new LogFile(saveDirectory, normalLogKind, secureLogKind, saveDays, useLogFile);
                    } catch (IOException e) {
                        LogFile = null;
                        tmpLogger.Set(LogKind.Error, null, 9000031, e.Message);
                    }
                }

                //Ver5.8.7 Java fix
                //mailBox������
                foreach (var o in ListOption)
                {
                    //SmtpServer�Ⴕ���́APop3Server���g�p�����ꍇ�̂݃��[���{�b�N�X�����������
                    if (o.NameTag == "Smtp" || o.NameTag == "Pop3")
                    {
                        if (o.UseServer)
                        {
                            var conf    = new Conf(ListOption.Get("MailBox"));
                            var dir     = ReplaceOptionEnv((String)conf.Get("dir"));
                            var datUser = (Dat)conf.Get("user");
                            var logger  = CreateLogger("MailBox", (bool)conf.Get("useDetailsLog"), null);
                            MailBox = new MailBox(logger, datUser, dir);
                            break;
                        }
                    }
                }
            }
            _logger = CreateLogger("kernel", true, null);
            tmpLogger.Release(_logger);


            //Ver5.8.7 Java fix �����[�g�N���C�A���g�̏ꍇ����[���{�b�N�X��쐬���Ă��܂��o�O��C��
//            //mailBox������
//            foreach (var o in ListOption){
//                //SmtpServer�Ⴕ���́APop3Server���g�p�����ꍇ�̂݃��[���{�b�N�X�����������
//                if (o.NameTag == "Smtp" || o.NameTag == "Pop3"){
//                    if (o.UseServer){
//                        var conf = new Conf(ListOption.Get("MailBox"));
//                        MailBox = new MailBox(this, conf);
//                        break;
//                    }
//                }
//            }

            ListServer = new ListServer(this, listPlugin);

            ListTool = new ListTool();
            ListTool.Initialize(this);

            View.SetColumnText();    //Log�r���[�̃J�����e�L�X�g�̏�����
            Menu.Initialize(IsJp()); //���j���[�\�z�i����e�[�u���̏������j

            WebApi = new WebApi();
        }
コード例 #15
0
ファイル: Kernel.cs プロジェクト: schifflee/bjd5
        //�N�����ɁA�R���X�g���N�^����Ăяo����鏉����
        private void DefaultInitialize(MainForm mainForm, ListView listViewLog, MenuStrip menuStrip, NotifyIcon notifyIcon)
        {
            RunMode       = RunMode.Normal;
            RemoteConnect = null;//�����[�g����Őڑ�����Ă��鎞���������������

            //logger�����������܂ł̃��O��ꎞ�I�ɕۊǂ���
            //ArrayList<LogTemporary> tmpLogger = new ArrayList<>();

            //�v���Z�X�N�����ɏ����������
            View = new View(this, mainForm, listViewLog, notifyIcon);
            //logView = new LogView(listViewLog);
            LogView  = new LogView(this, listViewLog);
            Menu     = new Menu(this, menuStrip); //�����ł́A�I�u�W�F�N�g�̐����̂݁Amenu.Initialize()�́AlistInitialize()�̒��ŌĂяo�����
            DnsCache = new DnsCache();
            Wait     = new Wait();

            Ver = new Ver(); //�o�[�W�����Ǘ�

            //Java fix
            //RunMode�̏�����
            if (mainForm == null)
            {
                RunMode = RunMode.Service; //�T�[�r�X�N��
            }
            else
            {
                if (Environment.GetCommandLineArgs().Length > 1)
                {
                    RunMode = RunMode.Remote; //�����[�g�N���C�A���g
                }
                else
                {
                    //�T�[�r�X�o�^�̏�Ԃ�擾����
                    var setupService = new SetupService(this);
                    if (setupService.IsRegist)
                    {
                        RunMode = RunMode.NormalRegist; //�T�[�r�X�o�^�������
                    }
                }
            }

            //Ver5.8.6 Java fix
            //OptionIni.Create(this); //�C���X�^���X�̏�����

            IniDb = new IniDb(ProgDir(), (RunMode == RunMode.Remote) ? "$remote" : "Option");

            MailBox = null;

            ListInitialize(); //�T�[�o�ċN���ŁA�ēx���s����鏉����


            if (_isTest)
            {
                return;
            }

            //�E�C���h�T�C�Y�̕���
            var path = string.Format("{0}\\BJD.ini", ProgDir());

            try{
                //�E�C���h�E�̊O�ς�ۑ��E����(View���O�ɏ���������)
                WindowSize = new WindowSize(new Conf(ListOption.Get("Basic")), path);
                View.Read(WindowSize);
            } catch (IOException) {
                WindowSize = null;
                // �w�肳�ꂽWindow���ۑ��t�@�C��(BJD.ini)��IO�G���[���������Ă���
                _logger.Set(LogKind.Error, null, 9000022, path);
            }

            //TraceDlg = new TraceDlg(this, (mainForm != null) ? mainForm.getFrame() : null); //�g���[�X�\��
            TraceDlg = new TraceDlg(this); //�g���[�X�\��

            switch (RunMode)
            {
            case RunMode.Normal:
                MenuOnClick("StartStop_Start");     //���j���[�I��C�x���g
                break;

            case RunMode.Remote:
                RemoteClient = new RemoteClient(this);
                RemoteClient.Start();
                break;

            //Java fix Ver5.8.3
            case RunMode.NormalRegist:
            case RunMode.Service:
                break;

            default:
                Util.RuntimeException("Kernel.defaultInitialize() not implement (RunMode)");
                break;
            }

            //Java fix Ver5.8.3
            View.SetColor();//�E�C���h�F�̏�����
        }
コード例 #16
0
 private void ScrollToItem(object item)
 {
     LogView.ScrollIntoView(item);
 }
コード例 #17
0
        void CreateControl()
        {
            control = new HPaned();

            store = new Gtk.ListStore(typeof(Gdk.Pixbuf),               // image - type
                                      typeof(bool),                     // read?
                                      typeof(Task));                    // read? -- use Pango weight

            TreeModelFilterVisibleFunc filterFunct = new TreeModelFilterVisibleFunc(FilterTaskTypes);

            filter             = new TreeModelFilter(store, null);
            filter.VisibleFunc = filterFunct;

            sort = new TreeModelSort(filter);
            sort.SetSortFunc(VisibleColumns.Type, SeverityIterSort);
            sort.SetSortFunc(VisibleColumns.Project, ProjectIterSort);
            sort.SetSortFunc(VisibleColumns.File, FileIterSort);

            view                   = new MonoDevelop.Ide.Gui.Components.PadTreeView(sort);
            view.RulesHint         = true;
            view.PopupMenu        += new PopupMenuHandler(OnPopupMenu);
            view.ButtonPressEvent += new ButtonPressEventHandler(OnButtonPressed);
            AddColumns();
            LoadColumnsVisibility();
            view.Columns[VisibleColumns.Type].SortColumnId    = VisibleColumns.Type;
            view.Columns[VisibleColumns.Project].SortColumnId = VisibleColumns.Project;
            view.Columns[VisibleColumns.File].SortColumnId    = VisibleColumns.File;

            sw            = new MonoDevelop.Components.CompactScrolledWindow();
            sw.ShadowType = ShadowType.None;
            sw.Add(view);
            TaskService.Errors.TasksRemoved += (TaskEventHandler)DispatchService.GuiDispatch(new TaskEventHandler(ShowResults));
            TaskService.Errors.TasksAdded   += (TaskEventHandler)DispatchService.GuiDispatch(new TaskEventHandler(TaskAdded));
            TaskService.Errors.TasksChanged += (TaskEventHandler)DispatchService.GuiDispatch(new TaskEventHandler(TaskChanged));
            TaskService.Errors.CurrentLocationTaskChanged += HandleTaskServiceErrorsCurrentLocationTaskChanged;

            IdeApp.Workspace.FirstWorkspaceItemOpened += OnCombineOpen;
            IdeApp.Workspace.LastWorkspaceItemClosed  += OnCombineClosed;

            view.RowActivated += new RowActivatedHandler(OnRowActivated);

            iconWarning = sw.RenderIcon(Gtk.Stock.DialogWarning, Gtk.IconSize.Menu, "");
            iconError   = sw.RenderIcon(Gtk.Stock.DialogError, Gtk.IconSize.Menu, "");
            iconInfo    = sw.RenderIcon(Gtk.Stock.DialogInfo, Gtk.IconSize.Menu, "");

            control.Add1(sw);

            outputView = new LogView();
            control.Add2(outputView);

            Control.ShowAll();

            sw.SizeAllocated += delegate {
                if (outputView.Visible)
                {
                    PropertyService.Set(logSeparatorPositionPropertyName, (double)((double)control.Position / (double)control.Allocation.Width));
                }
            };

            outputView.Hide();

            CreateMenu();

            // Load existing tasks
            foreach (Task t in TaskService.Errors)
            {
                AddTask(t);
            }

            control.FocusChain = new Gtk.Widget [] { sw };
        }
コード例 #18
0
        void ReleaseDesignerOutlets()
        {
            if (ConnectionTimeout != null)
            {
                ConnectionTimeout.Dispose();
                ConnectionTimeout = null;
            }

            if (DBInitialisedOn != null)
            {
                DBInitialisedOn.Dispose();
                DBInitialisedOn = null;
            }

            if (UpdateAppUri != null)
            {
                UpdateAppUri.Dispose();
                UpdateAppUri = null;
            }

            if (EventUTCOffset != null)
            {
                EventUTCOffset.Dispose();
                EventUTCOffset = null;
            }

            if (NotificationsBtn != null)
            {
                NotificationsBtn.Dispose();
                NotificationsBtn = null;
            }

            if (PromptsBtn != null)
            {
                PromptsBtn.Dispose();
                PromptsBtn = null;
            }

            if (LogsBtn != null)
            {
                LogsBtn.Dispose();
                LogsBtn = null;
            }

            if (PromptView != null)
            {
                PromptView.Dispose();
                PromptView = null;
            }

            if (NotificationView != null)
            {
                NotificationView.Dispose();
                NotificationView = null;
            }

            if (CancelBtn != null)
            {
                CancelBtn.Dispose();
                CancelBtn = null;
            }

            if (DatabaseSize != null)
            {
                DatabaseSize.Dispose();
                DatabaseSize = null;
            }

            if (RunningMode != null)
            {
                RunningMode.Dispose();
                RunningMode = null;
            }

            if (CurrentVersion != null)
            {
                CurrentVersion.Dispose();
                CurrentVersion = null;
            }

            if (GoLiveDate != null)
            {
                GoLiveDate.Dispose();
                GoLiveDate = null;
            }

            if (ResponderRegion != null)
            {
                ResponderRegion.Dispose();
                ResponderRegion = null;
            }

            if (EventPasscode != null)
            {
                EventPasscode.Dispose();
                EventPasscode = null;
            }

            if (RefreshViewBtn != null)
            {
                RefreshViewBtn.Dispose();
                RefreshViewBtn = null;
            }

            if (EventName != null)
            {
                EventName.Dispose();
                EventName = null;
            }

            if (SyncDataBtn != null)
            {
                SyncDataBtn.Dispose();
                SyncDataBtn = null;
            }

            if (ResponderId != null)
            {
                ResponderId.Dispose();
                ResponderId = null;
            }

            if (SyncDataInterval != null)
            {
                SyncDataInterval.Dispose();
                SyncDataInterval = null;
            }

            if (SyncMode != null)
            {
                SyncMode.Dispose();
                SyncMode = null;
            }

            if (WANServiceUri != null)
            {
                WANServiceUri.Dispose();
                WANServiceUri = null;
            }

            if (SaveChangesBtn != null)
            {
                SaveChangesBtn.Dispose();
                SaveChangesBtn = null;
            }

            if (LANServiceUri != null)
            {
                LANServiceUri.Dispose();
                LANServiceUri = null;
            }

            if (LastSuccessfulDataPush != null)
            {
                LastSuccessfulDataPush.Dispose();
                LastSuccessfulDataPush = null;
            }

            if (LogView != null)
            {
                LogView.Dispose();
                LogView = null;
            }

            if (LastSuccessfulServiceUpdate != null)
            {
                LastSuccessfulServiceUpdate.Dispose();
                LastSuccessfulServiceUpdate = null;
            }
        }
コード例 #19
0
        public static async Task DeleteLogViewRoutine(IDialogCoordinator dialogCoordinator, object dialogContext, SourceCache <LogView, string> logViewsSourceCache, LogView logView)
        {
            var serviceOperationHelper = new ServiceOperationHelper(typeof(LogView), Plurality.Single, ServiceOperation.Remove, "log views source cache", logView.Name);
            var dialogSettings         = new MetroDialogSettings()
            {
                AffirmativeButtonText = "Yes",
                NegativeButtonText    = "No",
                DefaultButtonFocus    = MessageDialogResult.Negative,
            };

            var dialogResult = await dialogCoordinator.ShowMessageAsync(dialogContext, "Permanently Delete Log View", $"Are you sure that you would like to permanently delete log view \"{logView.Name}\"?", MessageDialogStyle.AffirmativeAndNegative, dialogSettings);

            if (dialogResult == MessageDialogResult.Affirmative)
            {
                await Task.Run(() =>
                {
                    try
                    {
                        serviceOperationHelper.LogServiceOperation(ServiceOperationStatus.Attempting);
                        logViewsSourceCache.Remove(logView);
                        serviceOperationHelper.LogServiceOperation(ServiceOperationStatus.Succeeded);
                    }
                    catch (Exception ex)
                    {
                        serviceOperationHelper.LogServiceOperation(ex.Message);
                    }
                });

                if (serviceOperationHelper.ServiceOperationResult.OperationSuceeded)
                {
                    serviceOperationHelper.ServiceOperationResult = await SettingsService.RemoveLogViewByName(logView.Name, true);
                }
            }

            if (serviceOperationHelper.ServiceOperationResult.OperationFailed)
            {
                await serviceOperationHelper.ServiceOperationResult.ShowUserErrorMessage(dialogCoordinator, dialogContext);
            }
        }
コード例 #20
0
ファイル: MainForm.cs プロジェクト: wangscript007/WES_Aoyou
        private bool LoadModules()
        {
            string reStr = "";

            //扩展view
            asrsCheckoutModifyView = new ExtentViews.AsrsCheckoutModifyView("非正常出库调整");

            logView = new LogView("日志");
            childViews.Add(logView);
            logView.SetParent(this);
            logView.RegisterMenus(this.menuStrip1, "日志查询");
            logView.SetLogDispInterface(this);
            presenter.logRecorder = logView.GetLogrecorder();


            configView = new ConfiManageView();
            childViews.Add(configView);
            configView.SetParent(this);
            configView.RegisterMenus(this.menuStrip1, "配置管理");
            configView.SetLoginterface(logView.GetLogrecorder());

            palletTraceView = new ProduceTraceView("托盘追溯");
            childViews.Add(palletTraceView);
            palletTraceView.SetParent(this);
            palletTraceView.RegisterMenus(this.menuStrip1, "托盘追溯");
            palletTraceView.SetLoginterface(logView.GetLogrecorder());

            asrsCtlView = new AsrsCtlView("立库控制");
            childViews.Add(asrsCtlView);

            if (!asrsCtlView.RegistExtView(asrsCheckoutModifyView, ref reStr))
            {
                Console.WriteLine(reStr);
                return(false);
            }
            asrsCtlView.SetParent(this);
            asrsCtlView.RegisterMenus(this.menuStrip1, "立库控制");
            asrsCtlView.SetLoginterface(logView.GetLogrecorder());
            asrsCtlView.SetAsrsPresenter(presenter.AsrsPresenter);
            asrsCtlView.Init();

            nodeMonitorView = new CtlNodeMonitorView("流程监控");
            childViews.Add(nodeMonitorView);
            nodeMonitorView.SetParent(this);
            nodeMonitorView.RegisterMenus(this.menuStrip1, "流程监控");
            nodeMonitorView.SetLoginterface(logView.GetLogrecorder());

            storageView = new StorageMainView();
            childViews.Add(storageView);
            storageView.SetParent(this);
            storageView.RegisterMenus(this.menuStrip1, "库存管理");
            storageView.SetLoginterface(logView.GetLogrecorder());
            nodeMonitorView.SetAsrsBatchSetCtl(storageView.BatchSetControl);
            nodeMonitorView.SetAsrsMonitors(asrsCtlView.AsrsMonitors);



            AsrsInterface.IAsrsManageToCtl asrsResManage = null;
            AsrsInterface.IAsrsCtlToManage asrsCtl       = presenter.GetAsrsCtlInterfaceObj();

            if (!storageView.Init(asrsCtl, ref asrsResManage, ref reStr))
            {
                // logView.GetLogrecorder().AddLog(new LogModel("主模块", "立库管理层模块初始化错误," + reStr, EnumLoglevel.错误));
                Console.WriteLine("立库管理层模块初始化错误," + reStr);
                return(false);
            }
            asrsCtlView.SetAsrsResManage(asrsResManage);
            asrsCheckoutModifyView.SetAsrsResManage(asrsResManage);
            asrsCheckoutModifyView.AsrsPresenter = presenter.AsrsPresenter;
            AttachModuleView(nodeMonitorView);
            foreach (BaseChildView childView in childViews)
            {
                childView.ChangeRoleID(this.roleID);
            }
            presenter.SetAsrsResManage(asrsResManage);

            string[] nodeEnableCfgIDS = new string[] { "1001", "1002", "1003", "1004", "1005", "1006" };
            List <FlowCtlBaseModel.CtlNodeBaseModel> nodeEnableCfgs = new List <FlowCtlBaseModel.CtlNodeBaseModel>();

            foreach (string nodeID in nodeEnableCfgIDS)
            {
                nodeEnableCfgs.Add(presenter.CtlNodeManager.GetNodeByID(nodeID));
            }
            configView.SetCfgNodes(nodeEnableCfgs);

            return(true);
        }
コード例 #21
0
 private async void RenameLogView(LogView logView)
 {
     await LogViewService.RenameLogViewRoutine(DialogCoordinator, this, LogViewsSourceCache, logView);
 }
コード例 #22
0
        private async void OpenLogView(LogView logView)
        {
            logView.Open();
            AdjustOpenLogViewCount(1);
            RequestSetSelectedLogView(logView);
            logView.IsLoading = true;
            RequestToggleLaunchViewIsOpen();

            await Task.Delay(500);

            if (!logView.IsNew && LogViewToOpenDocumentIn == null)
            {
                OpenableObjectService.SaveOpenableObject(logView);
            }

            var tasks = new List <Task <ServiceOperationResult> >();

            foreach (var logFilePath in logView.LogFilePaths)
            {
                var logFile = LogFilesSourceCache.Lookup(logFilePath);
                if (logFile.HasValue)
                {
                    logFile.Value.Open();
                    OpenableObjectService.SaveOpenableObject(logFile.Value);
                    tasks.Add(LogFileService.LoadLogEntriesIntoSourceCacheAsync(logFile.Value, LogEntriesSourceCache));
                }
            }

            foreach (var databaseName in logView.DatabaseNames)
            {
                var database = DatabasesSourceCache.Lookup(databaseName);
                if (database.HasValue)
                {
                    database.Value.Open();
                    OpenableObjectService.SaveOpenableObject(database.Value);
                    tasks.Add(DatabaseService.LoadLogEntriesIntoSourceCache(database.Value, LogEntriesSourceCache));
                }
            }

            var results = await Task.WhenAll(tasks);

            var failedLogFilesString  = string.Empty;
            var failedDatabasesString = string.Empty;
            var errorMessage          = string.Empty;
            await Task.Run(() =>
            {
                for (int i = 0; i < results.Length - logView.DatabaseNames.Count; i++)
                {
                    var result = results[i];
                    if (result.OperationFailed && logView.LogFilePaths.Count > i)
                    {
                        failedLogFilesString += logView.LogFilePaths[i] + "," + Environment.NewLine;
                    }
                }
                if (failedLogFilesString.Length > 2)
                {
                    failedLogFilesString = failedLogFilesString.Substring(0, failedLogFilesString.Length - 3);
                }

                for (int i = logView.LogFilePaths.Count; i < results.Length; i++)
                {
                    var result = results[i];
                    if (result.OperationFailed)
                    {
                        failedDatabasesString += logView.DatabaseNames[i - logView.LogFilePaths.Count] + "," + Environment.NewLine;
                    }
                }
                if (failedDatabasesString.Length > 2)
                {
                    failedDatabasesString = failedDatabasesString.Substring(0, failedDatabasesString.Length - 3);
                }

                if (!string.IsNullOrWhiteSpace(failedLogFilesString))
                {
                    errorMessage += $"Failed to load log entries for the following log files:{Environment.NewLine + failedLogFilesString}";
                    if (!string.IsNullOrWhiteSpace(failedDatabasesString))
                    {
                        errorMessage += $"{Environment.NewLine + Environment.NewLine}Failed to load log entries for the following databases:{Environment.NewLine + failedDatabasesString}";
                    }
                }
                else if (!string.IsNullOrWhiteSpace(failedDatabasesString))
                {
                    errorMessage += $"Failed to load log entries for the following databases:{Environment.NewLine + failedDatabasesString}";
                }
            });

            if (!string.IsNullOrWhiteSpace(errorMessage))
            {
                //TODO: I'm getting this summary error message and individual error messages. Have to disable the error message for each individual log source.
                await DialogCoordinator.ShowMessageAsync(this, "Failed to Load Log Entries", errorMessage);
            }

            //Notify the LogViewManagementViewModel that the AutoRefreshSetting changed so that it can tell databases and log files
            Mediator.NotifyColleagues(MediatorMessages.AutoRefreshSettingChanged, logView.Settings.AutoRefresh);

            logView.IsLoading = false;
        }
コード例 #23
0
 private void SetLine()
 {
     LogView.SetSelected(LogView.Items.Count - 1, true);
 }
コード例 #24
0
        public IEnumerable<LogView> GetLog(string fromDate, string toDate)
        {
            DateTime dtfromDate = DateTime.ParseExact(fromDate, "yyyy/MM/dd", CultureInfo.InvariantCulture);
            DateTime dtToDate = DateTime.ParseExact(toDate, "yyyy/MM/dd", CultureInfo.InvariantCulture);
            dtToDate = dtToDate.AddHours(23.999999);
            System.Diagnostics.Debug.Write("params: " + dtfromDate + " " + dtToDate);

            List<LogView> logViewList = new List<LogView>();
            foreach (Log log in db.Log.Where(e => e.Date >= dtfromDate && e.Date <= dtToDate))
            {
                LogView logView = new LogView();
                logView.dateTime = (DateTime)log.Date;
                logView.Date = ((DateTime)log.Date).ToString("yyyy/MM/dd");
                logView.Time = ((DateTime)log.Date).ToString("hh:mm:ss");
                logView.Action = log.Action;
                logView.Object = log.Object;
                logView.User = log.User;
                logView.Role = log.Role;
                logView.Browser = log.Browser;
                logView.Request = log.Request;
                if (log.Info != null)
                {
                    String[] obj = log.Info.Split(',');
                    logView.Id_object = obj[0];
                    logView.Name = obj[1];
                }
                logViewList.Add(logView);
            }

            return logViewList;
        }
コード例 #25
0
 public Logger(LogView lv) => LogView = lv;
コード例 #26
0
 public Logger(LogView lv)
 {
     this.LogView = lv;
 }
コード例 #27
0
        void CreateControl()
        {
            control = new HPaned();

            store = new Gtk.TreeStore(typeof(Xwt.Drawing.Image),               // image - type
                                      typeof(bool),                            // read?
                                      typeof(Task),                            // read? -- use Pango weight
                                      typeof(string));

            TreeModelFilterVisibleFunc filterFunct = new TreeModelFilterVisibleFunc(FilterTasks);

            filter             = new TreeModelFilter(store, null);
            filter.VisibleFunc = filterFunct;

            sort = new TreeModelSort(filter);
            sort.SetSortFunc(VisibleColumns.Type, SeverityIterSort);
            sort.SetSortFunc(VisibleColumns.Project, ProjectIterSort);
            sort.SetSortFunc(VisibleColumns.File, FileIterSort);

            view = new PadTreeView(sort);
            view.ShowExpanders = true;
            view.RulesHint     = true;
            view.DoPopupMenu   = (evnt) => IdeApp.CommandService.ShowContextMenu(view, evnt, CreateMenu());
            AddColumns();
            LoadColumnsVisibility();
            view.Columns[VisibleColumns.Type].SortColumnId    = VisibleColumns.Type;
            view.Columns[VisibleColumns.Project].SortColumnId = VisibleColumns.Project;
            view.Columns[VisibleColumns.File].SortColumnId    = VisibleColumns.File;

            sw            = new MonoDevelop.Components.CompactScrolledWindow();
            sw.ShadowType = ShadowType.None;
            sw.Add(view);
            TaskService.Errors.TasksRemoved += DispatchService.GuiDispatch <TaskEventHandler> (ShowResults);
            TaskService.Errors.TasksAdded   += DispatchService.GuiDispatch <TaskEventHandler> (TaskAdded);
            TaskService.Errors.TasksChanged += DispatchService.GuiDispatch <TaskEventHandler> (TaskChanged);
            TaskService.Errors.CurrentLocationTaskChanged += HandleTaskServiceErrorsCurrentLocationTaskChanged;

            IdeApp.Workspace.FirstWorkspaceItemOpened += OnCombineOpen;
            IdeApp.Workspace.LastWorkspaceItemClosed  += OnCombineClosed;

            view.RowActivated += new RowActivatedHandler(OnRowActivated);

            iconWarning = ImageService.GetIcon(Ide.Gui.Stock.Warning, Gtk.IconSize.Menu);
            iconError   = ImageService.GetIcon(Ide.Gui.Stock.Error, Gtk.IconSize.Menu);
            iconInfo    = ImageService.GetIcon(Ide.Gui.Stock.Information, Gtk.IconSize.Menu);
            iconEmpty   = ImageService.GetIcon(Ide.Gui.Stock.Empty, Gtk.IconSize.Menu);

            control.Add1(sw);

            outputView = new LogView();
            control.Add2(outputView);

            Control.ShowAll();

            control.SizeAllocated += HandleControlSizeAllocated;

            bool outputVisible = PropertyService.Get <bool> (outputViewVisiblePropertyName, false);

            if (outputVisible)
            {
                outputView.Visible = true;
                logBtn.Active      = true;
            }
            else
            {
                outputView.Hide();
            }

            sw.SizeAllocated += HandleSwSizeAllocated;

            // Load existing tasks
            foreach (Task t in TaskService.Errors)
            {
                AddTask(t);
            }

            control.FocusChain = new Gtk.Widget [] { sw };
        }
コード例 #28
0
ファイル: ErrorListPad.cs プロジェクト: lasloyu/monodevelop
        void CreateControl()
        {
            control = new HPaned();

            store = new Gtk.TreeStore(typeof(Xwt.Drawing.Image),               // image - type
                                      typeof(bool),                            // read?
                                      typeof(TaskListEntry),                   // read? -- use Pango weight
                                      typeof(string));
            SemanticModelAttribute modelAttr = new SemanticModelAttribute("store__Type", "store__Read", "store__Task", "store__Description");

            TypeDescriptor.AddAttributes(store, modelAttr);

            TreeModelFilterVisibleFunc filterFunct = new TreeModelFilterVisibleFunc(FilterTasks);

            filter             = new TreeModelFilter(store, null);
            filter.VisibleFunc = filterFunct;

            sort = new TreeModelSort(filter);
            sort.SetSortFunc(VisibleColumns.Type, SeverityIterSort);
            sort.SetSortFunc(VisibleColumns.Project, ProjectIterSort);
            sort.SetSortFunc(VisibleColumns.File, FileIterSort);
            sort.SetSortFunc(VisibleColumns.Category, CategoryIterSort);

            view = new PadTreeView(sort);
            view.Selection.Mode = SelectionMode.Multiple;
            view.ShowExpanders  = true;
            view.RulesHint      = true;

            view.DoPopupMenu += ShowPopup;

            AddColumns();
            LoadColumnsVisibility();
            view.Columns [VisibleColumns.Type].SortColumnId     = VisibleColumns.Type;
            view.Columns [VisibleColumns.Project].SortColumnId  = VisibleColumns.Project;
            view.Columns [VisibleColumns.File].SortColumnId     = VisibleColumns.File;
            view.Columns [VisibleColumns.Category].SortColumnId = VisibleColumns.Category;

            sw            = new MonoDevelop.Components.CompactScrolledWindow();
            sw.ShadowType = ShadowType.None;
            sw.Add(view);
            TaskService.Errors.TasksRemoved += ShowResults;
            TaskService.Errors.TasksAdded   += TaskAdded;
            TaskService.Errors.TasksChanged += TaskChanged;
            TaskService.Errors.CurrentLocationTaskChanged += HandleTaskServiceErrorsCurrentLocationTaskChanged;

            IdeApp.Workspace.FirstWorkspaceItemOpened += OnCombineOpen;
            IdeApp.Workspace.LastWorkspaceItemClosed  += OnCombineClosed;

            view.RowActivated += OnRowActivated;

            iconWarning = ImageService.GetIcon(Ide.Gui.Stock.Warning, Gtk.IconSize.Menu);
            iconError   = ImageService.GetIcon(Ide.Gui.Stock.Error, Gtk.IconSize.Menu);
            iconInfo    = ImageService.GetIcon(Ide.Gui.Stock.Information, Gtk.IconSize.Menu);
            iconEmpty   = ImageService.GetIcon(Ide.Gui.Stock.Empty, Gtk.IconSize.Menu);

            control.Add1(sw);

            logView = new LogView {
                Name = "buildOutput"
            };
            control.Add2(logView);

            control.ShowAll();

            control.SizeAllocated += HandleControlSizeAllocated;
            sw.SizeAllocated      += HandleSwSizeAllocated;

            logView.Visible = OutputViewVisible;
            logBtn.Active   = OutputViewVisible;

            // Load existing tasks
            foreach (TaskListEntry t in TaskService.Errors)
            {
                AddTask(t);
            }

            control.FocusChain = new Gtk.Widget [] { logView };
        }
コード例 #29
0
        public static async Task RenameLogViewRoutine(IDialogCoordinator dialogCoordinator, object dialogContext, SourceCache <LogView, string> logViewsSourceCache, LogView logView)
        {
            var result          = new ServiceOperationResult();
            var maxCharLength   = 100;
            var oldLogViewName  = logView.Name;
            var keepPrompting   = true;
            var dialogSettings1 = new MetroDialogSettings()
            {
                AffirmativeButtonText = "Rename",
                DefaultText           = oldLogViewName,
            };

            while (keepPrompting)
            {
                var newLogViewName = await dialogCoordinator.ShowInputAsync(dialogContext, "Rename Log View", "New name:", dialogSettings1);

                if (newLogViewName == null)
                {
                    keepPrompting = false;
                }
                else if (string.IsNullOrWhiteSpace(newLogViewName))
                {
                    await dialogCoordinator.ShowMessageAsync(dialogContext, "Invalid Log View Name", "The new log view name cannot be null or whitespace.");
                }
                else if (newLogViewName.Length > maxCharLength)
                {
                    await dialogCoordinator.ShowMessageAsync(dialogContext, "Invalid Log View Name", $"The new log view name cannot be greater than {maxCharLength} characters.");

                    dialogSettings1.DefaultText = newLogViewName.Substring(0, maxCharLength);
                }
                else if (logViewsSourceCache.Keys.Contains(newLogViewName))
                {
                    var dialogSettings2 = new MetroDialogSettings()
                    {
                        AffirmativeButtonText = "Overwrite",
                        NegativeButtonText    = "Pick a new name",
                        DefaultButtonFocus    = MessageDialogResult.Negative,
                    };
                    var dialogResult = await dialogCoordinator.ShowMessageAsync(dialogContext, "Log View Already Exists", $"There is already a log view with the name \"{newLogViewName}\". Would you like to overwrite the existing log view?", MessageDialogStyle.AffirmativeAndNegative, dialogSettings2);

                    if (dialogResult == MessageDialogResult.Affirmative)
                    {
                        //Remove the old log view and the log view which will be replaced, rename the log view, and add it back in
                        await Task.Run(() =>
                        {
                            try
                            {
                                result.Status = ServiceOperationStatus.Attempting;
                                AppInfo.BaseAppInfo.Log.QueueLogMessageAsync($"Attempting to rename {typeof(LogView).Name} from \"{oldLogViewName}\" to \"{newLogViewName}\" which will overwrite existing log view with name \"{newLogViewName}\".", LogMessageType.Verbose);
                                logViewsSourceCache.Edit(innerCache =>
                                {
                                    innerCache.RemoveKey(newLogViewName);
                                    innerCache.RemoveKey(oldLogViewName);
                                    logView.Name     = newLogViewName;
                                    logView.IsEdited = true;
                                    innerCache.AddOrUpdate(logView);
                                });
                                result.Status = ServiceOperationStatus.Succeeded;
                                AppInfo.BaseAppInfo.Log.QueueLogMessageAsync($"Successfully renamed {typeof(LogView).Name} from \"{oldLogViewName}\" to \"{newLogViewName}\".", LogMessageType.Verbose);
                            }
                            catch (Exception ex)
                            {
                                result.Status = ServiceOperationStatus.Failed;
                                result.UserFriendlyErrorMessage = $"{AppInfo.BaseAppInfo.AppName} failed to rename {typeof(LogView).Name} from \"{oldLogViewName}\" to \"{newLogViewName}\".";
                                result.ErrorMessage             = result.UserFriendlyErrorMessage + $" {ex.Message}";
                                AppInfo.BaseAppInfo.Log.QueueLogMessageAsync(result.ErrorMessage, LogMessageType.Error);
                            }
                        });

                        if (result.OperationSuceeded)
                        {
                            //Remove old log view from settings
                            result = await SettingsService.RemoveLogViewByName(oldLogViewName);
                        }

                        keepPrompting = false;
                    }
                }
                else
                {
                    //Remove the old log view, rename it, and add it back in
                    await Task.Run(() =>
                    {
                        try
                        {
                            result.Status = ServiceOperationStatus.Attempting;
                            AppInfo.BaseAppInfo.Log.QueueLogMessageAsync($"Attempting to rename {typeof(LogView).Name} from \"{oldLogViewName}\" to \"{newLogViewName}\".", LogMessageType.Verbose);
                            logViewsSourceCache.Edit(innerCache =>
                            {
                                innerCache.RemoveKey(oldLogViewName);
                                logView.Name     = newLogViewName;
                                logView.IsEdited = true;
                                innerCache.AddOrUpdate(logView);
                            });
                            result.Status = ServiceOperationStatus.Succeeded;
                            AppInfo.BaseAppInfo.Log.QueueLogMessageAsync($"Successfully renamed {typeof(LogView).Name} from \"{oldLogViewName}\" to \"{newLogViewName}\".", LogMessageType.Verbose);
                        }
                        catch (Exception ex)
                        {
                            result.Status = ServiceOperationStatus.Failed;
                            result.UserFriendlyErrorMessage = $"{AppInfo.BaseAppInfo.AppName} failed to rename {typeof(LogView).Name} from \"{oldLogViewName}\" to \"{newLogViewName}\".";
                            result.ErrorMessage             = result.UserFriendlyErrorMessage + $" {ex.Message}";
                            AppInfo.BaseAppInfo.Log.QueueLogMessageAsync(result.ErrorMessage, LogMessageType.Error);
                        }
                    });

                    if (result.OperationSuceeded)
                    {
                        //Remove old log view from settings
                        result = await SettingsService.RemoveLogViewByName(oldLogViewName);
                    }

                    keepPrompting = false;
                }
            }

            if (result.OperationFailed)
            {
                await result.ShowUserErrorMessage(dialogCoordinator, dialogContext);
            }
            else
            {
                await Task.Delay(100);

                Mediator.NotifyColleagues(MediatorMessages.RequestSetSelectedLogView, logView);
            }
        }
コード例 #30
0
        private View getView()
        {
            var table = new TableView()
            {
                Intent          = TableIntent.Settings,
                HasUnevenRows   = true,
                BackgroundColor = ColorHelper.White,
            };

            #region IntervalUpdate
            _lblInterval = new Label()
            {
                Text = getIntervalString(), TextColor = ColorHelper.DarkGray
            };
            var _updateIntervallLayout = new StackLayout()
            {
                Padding         = new Thickness(20, 10, 20, 10),
                Orientation     = StackOrientation.Vertical,
                VerticalOptions = LayoutOptions.FillAndExpand,
                Spacing         = 3,
                Children        =
                {
                    new Label()
                    {
                        Text = "Intervallo di aggiornamento", TextColor = ColorHelper.Black, FontFamily = "Droid Sans Mono"
                    },
                    _lblInterval
                }
            };
            _updateIntervallCell = new ViewCell()
            {
                View = _updateIntervallLayout, IsEnabled = Settings.BackgroundSync
            };
            _updateIntervallCell.Tapped += _updateIntervallCell_Tapped;

            #endregion


            #region AggiornamentoBackground
            _backgroundSyncSwitch = new Switch()
            {
                IsToggled = Settings.BackgroundSync, HorizontalOptions = LayoutOptions.EndAndExpand
            };
            _lblBackgroundSync = new Label()
            {
                Text = getBackgroundSyncString(), TextColor = ColorHelper.DarkGray
            };
            var _backgroundSyncLayout = new Grid()
            {
                Padding         = new Thickness(20, 10, 20, 10),
                VerticalOptions = LayoutOptions.FillAndExpand,
                RowSpacing      = 0,

                RowDefinitions =
                {
                    new RowDefinition {
                        Height = GridLength.Auto
                    },
                    new RowDefinition {
                        Height = GridLength.Auto
                    },
                },
                ColumnDefinitions =
                {
                    new ColumnDefinition {
                        Width = new GridLength(2, GridUnitType.Star)
                    },
                    new ColumnDefinition {
                        Width = new GridLength(1, GridUnitType.Star)
                    },
                }
            };
            _backgroundSyncLayout.Children.Add(new Label()
            {
                Text = "Aggiornamento background", TextColor = ColorHelper.Black, FontFamily = "Droid Sans Mono"
            }, 0, 1, 0, 1);
            _backgroundSyncLayout.Children.Add(_backgroundSyncSwitch, 1, 2, 0, 1);
            _backgroundSyncLayout.Children.Add(_lblBackgroundSync, 0, 1, 1, 2);

            _backgroundSyncCell = new ViewCell()
            {
                View = _backgroundSyncLayout
            };
            _backgroundSyncSwitch.Toggled += (object sender, ToggledEventArgs e) =>
            {
                if (_backgroundSyncSwitch.IsToggled)
                {
                    Settings.BackgroundSync        = true;
                    _updateIntervallCell.IsEnabled = true;
                }
                else
                {
                    Settings.BackgroundSync        = false;
                    _updateIntervallCell.IsEnabled = false;
                }
                _lblBackgroundSync.Text = getBackgroundSyncString();
            };
            #endregion

            #region Notifiche
            _notificheSwitch = new Switch()
            {
                IsToggled = Settings.Notify, HorizontalOptions = LayoutOptions.EndAndExpand
            };
            _lblNotifiche = new Label()
            {
                Text = getNotificheString(), TextColor = ColorHelper.DarkGray
            };
            var _notificheLayout = new Grid()
            {
                Padding         = new Thickness(20, 10, 20, 10),
                VerticalOptions = LayoutOptions.FillAndExpand,
                RowSpacing      = 0,

                RowDefinitions =
                {
                    new RowDefinition {
                        Height = GridLength.Auto
                    },
                    new RowDefinition {
                        Height = GridLength.Auto
                    },
                },
                ColumnDefinitions =
                {
                    new ColumnDefinition {
                        Width = new GridLength(2, GridUnitType.Star)
                    },
                    new ColumnDefinition {
                        Width = new GridLength(1, GridUnitType.Star)
                    },
                }
            };
            _notificheLayout.Children.Add(new Label()
            {
                Text = "Notifiche", TextColor = ColorHelper.Black, FontFamily = "Droid Sans Mono"
            }, 0, 1, 0, 1);
            _notificheLayout.Children.Add(_notificheSwitch, 1, 2, 0, 1);
            _notificheLayout.Children.Add(_lblNotifiche, 0, 1, 1, 2);

            _notificheCell = new ViewCell()
            {
                View = _notificheLayout
            };
            _notificheSwitch.Toggled += (object sender, ToggledEventArgs e) =>
            {
                if (_notificheSwitch.IsToggled)
                {
                    Settings.Notify = true;
                }
                else
                {
                    Settings.Notify = false;
                }
                _lblNotifiche.Text = getNotificheString();
            };
            #endregion


            #region LastUpdate
            _lblLastUpdate = new Label()
            {
                Text = Settings.LastUpdate, TextColor = ColorHelper.DarkGray
            };
            var _lastUpdatelLayout = new StackLayout()
            {
                Padding         = new Thickness(20, 10, 20, 10),
                Orientation     = StackOrientation.Vertical,
                VerticalOptions = LayoutOptions.FillAndExpand,
                Spacing         = 3,
                Children        =
                {
                    new Label()
                    {
                        Text = "Ultimo Aggiornamento", TextColor = ColorHelper.Black, FontFamily = "Droid Sans Mono"
                    },
                    _lblLastUpdate
                }
            };

            _lastUpdateCell = new ViewCell()
            {
                View = _lastUpdatelLayout
            };
            _lastUpdateCell.IsEnabled = false;
            #endregion

            var sectionSync = new TableSection("Sincronizzazione")                //TableSection constructor takes title as an optional parameter
            {
                _backgroundSyncCell,
                _notificheCell,
                _updateIntervallCell,
                _lastUpdateCell,
            };

            #region Corsi Preferiti
            _lblCorsiPreferiti = new Label()
            {
                TextColor = ColorHelper.DarkGray
            };
            getPreferitiString();
            var _corsiPrefLayout = new StackLayout()
            {
                Padding         = new Thickness(20, 10, 20, 10),
                Orientation     = StackOrientation.Vertical,
                VerticalOptions = LayoutOptions.FillAndExpand,
                Spacing         = 3,
                Children        =
                {
                    new Label()
                    {
                        Text = "Corsi Preferiti", TextColor = ColorHelper.Black, FontFamily = "Droid Sans Mono"
                    },
                    _lblCorsiPreferiti
                }
            };
            _corsiPreferitiCell = new ViewCell()
            {
                View = _corsiPrefLayout
            };
            _corsiPreferitiCell.Tapped += async(object sender, EventArgs e) =>
            {
                var nav = new GestionePreferitiView();
//				nav.BindingContext = orariViewModel;
                await this.Navigation.PushAsync(nav);
            };
            #endregion

            #region Manage File
            _lblFile = new Label()
            {
                TextColor = ColorHelper.DarkGray
            };
            getFileString();

            var _fileLayout = new StackLayout()
            {
                Padding         = new Thickness(20, 10, 20, 10),
                Orientation     = StackOrientation.Vertical,
                VerticalOptions = LayoutOptions.FillAndExpand,
                Spacing         = 3,
                Children        =
                {
                    new Label()
                    {
                        Text = "File generati", TextColor = ColorHelper.Black, FontFamily = "Droid Sans Mono"
                    },
                    _lblFile
                }
            };
            _fileCell = new ViewCell()
            {
                View = _fileLayout
            };
            _fileCell.Tapped += async(object sender, EventArgs e) =>
            {
                if (fileCount > 0)
                {
                    var nav = new ManageFileView();
                    await this.Navigation.PushAsync(nav);
                }
            };
            #endregion

            var sectionFavourit = new TableSection("Gestione")                //TableSection constructor takes title as an optional parameter
            {
                _corsiPreferitiCell,
                _fileCell
            };



            #region DatiStatistici
            //_statisticSwitch = new Switch() {IsToggled = !Settings.DisableStatisticData, HorizontalOptions = LayoutOptions.EndAndExpand};
            //_lblStatistic = new Label () { Text = getStatisticString(), TextColor = ColorHelper.DarkGray };
            //var _statistcLayout = new Grid () {
            //	Padding = new Thickness(20, 10, 20, 10),
            //	VerticalOptions = LayoutOptions.FillAndExpand,
            //	RowSpacing = 0,

            //	RowDefinitions =
            //	{
            //		new RowDefinition { Height = GridLength.Auto },
            //		new RowDefinition { Height = GridLength.Auto },
            //	},
            //	ColumnDefinitions =
            //	{
            //		new ColumnDefinition { Width = new GridLength(2, GridUnitType.Star) },
            //		new ColumnDefinition { Width = new GridLength(1, GridUnitType.Star) },
            //	}
            //	};
            //_statistcLayout.Children.Add(new Label(){Text = "Dati Statistici", TextColor = ColorHelper.Black, FontFamily = "Droid Sans Mono"}, 0, 1, 0, 1);
            //_statistcLayout.Children.Add(_statisticSwitch, 1,2,0,1);
            //_statistcLayout.Children.Add(_lblStatistic, 0, 1, 1, 2);

            //_statisticCell = new ViewCell (){ View = _statistcLayout};
            //_statisticSwitch.Toggled += (object sender, ToggledEventArgs e) =>
            //{
            //	if (_statisticSwitch.IsToggled) {
            //		Settings.DisableStatisticData = false;
            //	} else {
            //		Settings.DisableStatisticData = true;
            //	}

            //	_lblStatistic.Text = getStatisticString();
            //};
            #endregion

            #region Tutorial
            var _tutorialLayout = new StackLayout()
            {
                Padding         = new Thickness(20, 10, 20, 10),
                Orientation     = StackOrientation.Vertical,
                VerticalOptions = LayoutOptions.FillAndExpand,
                Spacing         = 3,
                Children        =
                {
                    new Label()
                    {
                        Text = "Tutorial", TextColor = ColorHelper.Black, FontFamily = "Droid Sans Mono"
                    },
                }
            };

            _tutorialCell = new ViewCell()
            {
                View = _tutorialLayout
            };
            _tutorialCell.Tapped += async(object sender, EventArgs e) => await Navigation.PushModalAsync(new TutorialView());

            #endregion

            #region Version
            var _versionLayout = new StackLayout()
            {
                Padding         = new Thickness(20, 10, 20, 10),
                Orientation     = StackOrientation.Vertical,
                VerticalOptions = LayoutOptions.FillAndExpand,
                Spacing         = 3,
                Children        =
                {
                    new Label()
                    {
                        Text = "Versione", TextColor = ColorHelper.Black, FontFamily = "Droid Sans Mono"
                    },
                    new Label()
                    {
                        Text = Settings.Versione, TextColor = ColorHelper.DarkGray
                    }
                }
            };
            _versionCell = new ViewCell()
            {
                View = _versionLayout
            };                                                                  //, IsEnabled = false };
            _versionCell.Tapped += async(object sender, EventArgs e) => await Navigation.PushModalAsync(new AboutView());

            #endregion

            #region Log
            var _logLayout = new StackLayout()
            {
                Padding         = new Thickness(20, 10, 20, 10),
                Orientation     = StackOrientation.Vertical,
                VerticalOptions = LayoutOptions.FillAndExpand,
                Spacing         = 3,
                Children        =
                {
                    new Label()
                    {
                        Text = "Log", TextColor = ColorHelper.Black, FontFamily = "Droid Sans Mono"
                    },
                }
            };
            _logCell = new ViewCell()
            {
                View = _logLayout
            };                                               //, IsEnabled = false };
            _logCell.Tapped += async(object sender, EventArgs e) =>
            {
                var nav = new LogView();
                await this.Navigation.PushAsync(nav);
            };
            #endregion

            #region Logout
            var _logoutLayout = new StackLayout()
            {
                Padding         = new Thickness(20, 10, 20, 10),
                Orientation     = StackOrientation.Vertical,
                VerticalOptions = LayoutOptions.FillAndExpand,
                Spacing         = 3,
                Children        =
                {
                    new Label()
                    {
                        Text = "Esci", TextColor = ColorHelper.Black, FontFamily = "Droid Sans Mono"
                    },
                }
            };

            _logoutCell = new ViewCell()
            {
                View = _logoutLayout
            };
            _logoutCell.Tapped += _logoutCell_Tapped;
            #endregion



            var sectionInfo = new TableSection("Informazioni")
            {
                //_statisticCell,
                _tutorialCell,
                _versionCell,
            };

            //ONLY FOR ADMIN USER = sid:e5a1e2a28de7725e0c27afcb4ed0a9e4
            if (Settings.UserId == "sid:e5a1e2a28de7725e0c27afcb4ed0a9e4")
            {
                sectionInfo.Add(_logCell);
            }

            sectionInfo.Add(_logoutCell);

            table.Root = new TableRoot()
            {
                sectionSync,
                sectionFavourit,
                sectionInfo
            };

            return(table);
        }
コード例 #31
0
 public SelectedLogViewChangedEventArgs(LogView oldLogView, LogView newLogView)
 {
     OldLogView = oldLogView;
     NewLogView = newLogView;
 }
コード例 #32
0
 protected void UpdateViewLogHistory()
 {
     LogView.Refresh();
     ClearModel();
 }