コード例 #1
0
        private void tracert_interval_timer_Tick(object sender, EventArgs e)
        {
            tracert_interval_timer.Interval = 240000;
            pingtimer.Stop();
            SaveTimer.Stop();
            event_timer.Stop();



            if (running && got_ping)
            {
                tracert_result.Clear();
                trace_listBox.Items.Add("Tracing....");
                trace_listBox.Update();
                Traceroute(node_id.Text);
                tracert_result.AddRange(traceResults_);
                traceResults_.Clear();
                trace_listBox.Items.Clear();
                foreach (string i in tracert_result)
                {
                    trace_listBox.Items.Add(i);
                    char[]   separators = { ' ', '\r' };
                    string[] tokens     = i.Split(separators);
                }

                tracedone = true;
            }
            pingtimer.Start();
        }
コード例 #2
0
        private void InitializeAttachments()
        {
            Outlook.Inspector inspector = Globals.ThisAddIn.Application.ActiveInspector();
            Outlook.MailItem  mail      = inspector.CurrentItem;
            try
            {
                if (mail.Attachments == null || mail.Attachments.Count <= 0)
                {
                    return;
                }

                foreach (Outlook.Attachment attachment in mail.Attachments)
                {
                    AttachmentsTextBox.Text = $"{AttachmentsTextBox.Text}{attachment.FileName}\r\n";
                }

                SaveTimer.Stop();
                ClearTimer();
                SaveTimer.Start();
            }
            finally
            {
                if (inspector != null)
                {
                    Marshal.ReleaseComObject(mail);
                    mail = null;
                }
                if (inspector != null)
                {
                    Marshal.ReleaseComObject(inspector);
                    inspector = null;
                }
            }
        }
コード例 #3
0
        /// <summary>
        /// 自动保存编辑内容
        /// </summary>
        /// <param name="source"></param>
        /// <param name="e"></param>
        public void SaveEditer(object source, ElapsedEventArgs e)
        {
            if (InvokeRequired)
            {
                EventHandler <ElapsedEventArgs> handler = SaveEditer;
                Invoke(handler, source, e);
            }
            var value = ApplicationContext.GetParameterValue("autoSaveStyle", "关闭自动保存");

            if (value.Equals("直接保存"))
            {
                SaveEditCommand cmd = new SaveEditCommand {
                    HasPopForm = false
                };
                cmd.Execute(null);
                SaveTimer.Stop();
                SaveTimer.Start();
            }
            else if (value.Equals("弹框提示"))
            {
                SaveEditCommand cmd = new SaveEditCommand {
                    HasPopForm = true
                };
                cmd.Execute(null);
                SaveTimer.Stop();
                SaveTimer.Start();
            }
        }
コード例 #4
0
 private void stop_ping_btn_Click(object sender, EventArgs e)
 {
     pingtimer.Stop();
     SaveTimer.Stop();
     tracert_interval_timer.Stop();
     ping_event_box.Items.Clear();
     connected = false;
     tracedone = false;
     running   = false;
 }
コード例 #5
0
 private void node_id_TextChanged(object sender, EventArgs e)
 {
     pingtimer.Stop();
     SaveTimer.Stop();
     tracert_interval_timer.Stop();
     ping_event_box.Items.Clear();
     connected = false;
     tracedone = false;
     running   = false;
 }
コード例 #6
0
        /// <summary>
        /// Implementation for <see cref="AbstractMonitoringService.StopMonitoring"/>
        /// </summary>
        protected override void StopMonitoringImpl()
        {
            if (CurrentMonitor != null && CurrentSrcMLArchive != null)
            {
                SaveTimer.Stop();
                CurrentProject.StopMonitoring();

                CurrentMonitor.FileChanged             -= CurrentMonitor_FileChanged;
                CurrentMonitor.DirectoryAdded          -= CurrentMonitor_DirectoryAdded;
                CurrentMonitor.DirectoryRemoved        -= CurrentMonitor_DirectoryRemoved;
                CurrentMonitor.UpdateArchivesStarted   -= CurrentMonitor_UpdateArchivesStarted;
                CurrentMonitor.UpdateArchivesCompleted -= CurrentMonitor_UpdateArchivesCompleted;

                CurrentProject.Dispose();
                CurrentProject = null;
                CurrentMonitor = null;
            }
        }
コード例 #7
0
        private void SaveButton_Click(object sender, EventArgs e)
        {
            try
            {
                SaveTimer.Stop();
                ClearTimer();

                Outlook.Inspector inspector = Globals.ThisAddIn.Application.ActiveInspector();
                Outlook.MailItem  mail      = inspector.CurrentItem;

                try
                {
                    if (mail != null)
                    {
                        var syncObject = Globals.ThisAddIn.Application.Session.SyncObjects[1];
                        syncObject.SyncEnd         += SyncObject_SyncEnd;
                        syncObject.OnError         += SyncObject_OnError;
                        SaveButton.Enabled          = false;
                        AddAttachmentButton.Enabled = false;
                        mail.Save();
                        syncObject.Start();
                    }
                }
                finally
                {
                    if (inspector != null)
                    {
                        Marshal.ReleaseComObject(mail);
                        mail = null;
                    }
                    if (inspector != null)
                    {
                        Marshal.ReleaseComObject(inspector);
                        inspector = null;
                    }
                }
                SaveTimer.Start();
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                throw;
            }
        }
コード例 #8
0
        private void SaveButton_Click(object sender, RibbonControlEventArgs e)
        {
            try
            {
                SaveTimer.Stop();
                ClearTimer();

                Outlook.Inspector inspector = Globals.ThisAddIn.Application.ActiveInspector();
                Outlook.MailItem  mail      = inspector.CurrentItem;

                try
                {
                    if (mail != null)
                    {
                        mail.Save();
                    }
                }
                finally
                {
                    if (inspector != null)
                    {
                        Marshal.ReleaseComObject(mail);
                        mail = null;
                    }
                    if (inspector != null)
                    {
                        Marshal.ReleaseComObject(inspector);
                        inspector = null;
                    }
                }
                SaveTimer.Start();
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                throw;
            }
        }
コード例 #9
0
ファイル: App.xaml.cs プロジェクト: xenoplayed/DesktopWidgets
        private void App_OnExit(object sender, ExitEventArgs e)
        {
            try
            {
                SaveTimer?.Stop();

                SettingsHelper.SaveSettings();

                TrayIcon?.Dispose();

                AppMutex?.ReleaseMutex();
            }
            catch
            {
                // ignored
            }
            finally
            {
                if (RestartArguments != null)
                {
                    Process.Start(AppHelper.AppPath, string.Join(",", RestartArguments));
                }
            }
        }
コード例 #10
0
 private void Scintilla_TextChanged(object sender, EventArgs e)
 {
     SaveTimer.Stop();
     SaveTimer.Start();
 }