示例#1
0
        public static void Error(string msg, Exception e, ErrorType type)
        {
            string exception_message = "";

            if (e != null)
            {
                exception_message = "Error: " + e.Message;
            }

            if (messages_level != MessagesLevel.MessagesNone &&
                !(messages_level == MessagesLevel.MessagesBasic && type != ErrorType.FatalError && type != ErrorType.Connect))
            {
                if (type == ErrorType.Connect)
                {
                    //Use specific Error dialog to allow changing of preferences
                    CustomMsgBox msgbox = new CustomMsgBox(msg + "\n" + exception_message, "FlickrSync Error");
                    msgbox.AddButton("OK", 75, 1, msgbox.ButtonCallOK);
                    msgbox.AddButton("Preferences", 75, 2, ButtonCallPref);
                    msgbox.ShowDialog();
                }
                else
                {
                    MessageBox.Show(msg + "\n" + exception_message, "Error");
                }
            }

            string logmsg = msg + "; " + exception_message;

            if (type == ErrorType.FatalError || type == ErrorType.Connect)
            {
                Log(LogLevel.LogBasic, logmsg);
            }
            else
            {
                Log(LogLevel.LogAll, logmsg);
            }

            if (type == ErrorType.FatalError || type == ErrorType.Connect)
            {
                Application.Exit();
            }
        }
示例#2
0
        private void Finish()
        {
            if (InvokeRequired)
            {
                BeginInvoke(new FinishCallBack(Finish));
            }
            else
            {
                if (Finished)
                    return;

                Finished = true;

                if (SyncStarted)
                {
                    if (ThumbnailThread != null && ThumbnailThread.IsAlive)
                        ThumbnailThread.Abort();

                    string msg;
                    if (SyncAborted)
                        msg = "Synchronization aborted.";
                    else
                        msg = "Synchronization finished.";

                    try
                    {
                        FlickrSync.li.SaveToXML();
                        labelSync.Text = "";

                        FlickrSync.Log(FlickrSync.LogLevel.LogBasic, msg + " Updated configuration saved");

                        if (FlickrSync.messages_level != FlickrSync.MessagesLevel.MessagesNone)
                        {
                            //MessageBox.Show(msg + " Updated configuration saved.", "Sync");
                            CustomMsgBox msgbox = new CustomMsgBox(msg + " Updated configuration saved.","FlickrSync");
                            msgbox.AddButton("OK", 75, 1,msgbox.ButtonCallOK);
                            if (FlickrSync.log_level!=FlickrSync.LogLevel.LogNone)
                                msgbox.AddButton("View Log", 75, 2, ViewLog);
                            msgbox.ShowDialog();
                        }
                    }
                    catch (Exception ex)
                    {
                        FlickrSync.Error(msg + " Error saving configuration", ex, FlickrSync.ErrorType.Normal);
                    }

                    if (NewSets.Count > 0)
                        Program.MainFlickrSync.AddNewSets(NewSets);
                }

                this.Close();
            }
        }
示例#3
0
        public static void Error(string msg, Exception e, ErrorType type)
        {
            string exception_message = "";
            if (e != null)
                exception_message = "Error: " + e.Message;

            if (messages_level != MessagesLevel.MessagesNone &&
                !(messages_level == MessagesLevel.MessagesBasic && type != ErrorType.FatalError && type != ErrorType.Connect))
            {
                if (type == ErrorType.Connect)
                {
                    //Use specific Error dialog to allow changing of preferences
                    CustomMsgBox msgbox=new CustomMsgBox(msg + "\n" + exception_message,"FlickrSync Error");
                    msgbox.AddButton("OK", 75, 1, msgbox.ButtonCallOK);
                    msgbox.AddButton("Preferences",75,2,ButtonCallPref);
                    msgbox.ShowDialog();
                }
                else
                    MessageBox.Show(msg + "\n" + exception_message, "Error");
            }

            string logmsg=msg+"; "+exception_message;
            if (type == ErrorType.FatalError || type == ErrorType.Connect)
                Log(LogLevel.LogBasic, logmsg);
            else
                Log(LogLevel.LogAll, logmsg);

            if (type==ErrorType.FatalError || type==ErrorType.Connect)
                Application.Exit();
        }